DEV Community

Cover image for What I learned from building REST APIs in 3 different languages
Lucia Cerchie
Lucia Cerchie

Posted on

39 7

What I learned from building REST APIs in 3 different languages

While I was in bootcamp in 2020, I built REST APIs using JavaScript and Python.

Recently, using @karanpratapsingh's helpful tutorial, I got started on building a REST API in Golang.

It was during the process of following the Golang tutorial that certain things really clicked for me. I'm writing to share them with you!

1. The basics of REST APIs are the same in all three of these languages

Building a REST API enabled me to establish a CRUD pattern, whether I was doing it in JavaScript, Python, or Golang.

In each of those languages, I had many of the same considerations. Which CRUD operations did I really need for my end project? How was I going to handle errors? Security? Testing? I am now understanding by my own experience that API design can be language-agnostic!

2. It's ok to build something without having memorized every last bit of the syntax

Since I wrote my Python and JavaScript APIs in a fast-paced bootcamp, I was 'forced' to dive in headfirst after a quick review of language syntax. My Golang API is a side-project so there was none of that external pressure, and for that reason I put it off for a long time.

But after about the twelfth video on the ins and outs of pointers, I realized it was time to get started actually building something-- because getting to know language syntaxes is like getting to know people: learning the names is the beginning, but you have to start interacting with them to understand their behavior.

3. Python, JavaScript, and Golang are all different languages

I know, shocker. ;)

But after working with them all I understand the differences better. When I only knew Python and JS, I thought maybe Golang was more like Python than I realize it is now, and that Python and JS were less alike than I think they are now.

I got hung up on the syntax differences -- try and catch in JS vs try and except in Python -- without realizing that these languages had some similarities as well. For example, JS and Python are both dynamically typed. You can declare a variable and the runtime gods will determine its type. Just try that with Golang! It won't let you, because you, as a Go developer, must declare a variable's type, it's not the runtime's concern.

As far as similarities go, all three languages also participate in object-orientation to varying degrees/in varying ways -- as always, this depends on how you define object-orientation! That could be a whole separate blog post so I'm stopping here.

Conclusion

If you normally build something in one language, try it in a new one! The perspective you gain may surprise you.

Image of AssemblyAI tool

Challenge Submission: SpeechCraft - AI-Powered Speech Analysis for Better Communication

SpeechCraft is an advanced real-time speech analytics platform that transforms spoken words into actionable insights. Using cutting-edge AI technology from AssemblyAI, it provides instant transcription while analyzing multiple dimensions of speech performance.

Read full post

Top comments (4)

Collapse
 
nasrulhazim profile image
Nasrul Hazim Bin Mohamad

API can be written in any programming language. usually there is API gateway that expose the APIs, that sometimes written in different kind of programming languages. Usually these APIs called as polyglot, doesn't matter what programming languages, as long it serve as API.

Collapse
 
briankopp profile image
Brian Kopp

Nice article! There are also significant runtime differences in the languages, like how they handle threading, async, and such. These become things to consider when building more complex apps.

Collapse
 
cerchie profile image
Lucia Cerchie

Say more!

Collapse
 
cerchie profile image
Lucia Cerchie

Thanks Dewald, glad you liked it!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay