Choosing a language: Python, JavaScript or Go
Why three languages exist, what each one is genuinely good at, and the honest fact that your first language matters far less than people say.
Python, JavaScript and Go can all add two numbers, walk a list and define a function. So why do three languages exist, and why do working programmers argue about them? Because a language is not only a way of writing instructions. It is also a community, a set of libraries, and a set of priorities about what should be easy and what should be hard.
Python is the language of data and scripting. Files, spreadsheets, statistics, machine learning, small tools that glue other programs together. Its syntax stays out of the way, so the shape of the problem is what you read on the screen. The trade-off is speed: Python is usually slower to run than the other two, and for a script that runs once a night nobody cares.
import csv
with open("sales.csv") as f:
total = sum(float(row["price"]) for row in csv.DictReader(f))
print(total)Python: read a spreadsheet, add up a column, print the answer. Nine lines.JavaScript is the language of the browser, and that is not a preference, it is a fact about the world: it is the only language every browser runs. If your program has to react to a click and change what a person sees, JavaScript is already there, on every device, with nothing to install. It also runs on servers, so the same language can cover both ends of a website.
document.querySelector("#total").textContent = "42"
button.addEventListener("click", () => {
count = count + 1;
});JavaScript: change what is on the page, then react when a button is clicked.Go is the language of services that must be fast and simple. It was built by people who were tired of large, slow, complicated server programs. It compiles to a single file you can copy onto a machine and run, it starts in milliseconds, and its type checker catches whole categories of mistakes before the program ever starts. The trade-off is verbosity: you write more words to say the same thing.
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("ok"))
})
http.ListenAndServe(":8080", nil)Go: answer a health check, then serve on a port. Two statements and a running service.Here is the honest part. The concepts you met in the previous three lessons do not belong to any language. Values and types, conditions, loops, functions, scope: every language you will ever meet has all of them, and they work the same way. Only the spelling changes.
same ideas, three spellings
value + type name = "Ada" const name = "Ada" var name string
condition if age >= 18: if (age >= 18) { if age >= 18 {
loop over list for s in scores: for (const s of ...) for _, s := range ...
function def f(a, b): function f(a, b) { func f(a, b) float64
map {"soup": 2.50} { soup: 2.50 } map[string]float64{...}One row per concept. Four columns of spelling, one column of meaning.The first real decision factor is readability, and it means something specific: how quickly can a person who did not write this code understand what it does? Code is read far more often than it is written, and it is read by people who are tired and in a hurry. A language that makes the common case short and obvious earns its place. This is the honest reason Python is popular for teaching and for data work, and it is why Go refuses to let you write the same thing in six different ways.
So here is the conclusion, stated plainly. The first language you learn matters much less than people tell you. What you are really learning right now is the shape of the ideas: that a type is a set, that a condition is a boolean, that a loop is a cost, that a function is a box with one output. Those transfer completely and permanently. The syntax you will forget and relearn in a weekend, several times, for the rest of your working life. Choose any of the three, finish a real small project with it, and you will be able to read the other two.
Practice
You are building a page where clicking a button changes a number on screen, and it must work on a phone with nothing installed. Which language does the situation choose for you?
Hints
- Ask where the code has to run, not which language looks nicest in a tutorial.
- A browser already contains exactly one of these three, and it is not the one you install.
Match each situation with the language that fits it best, and with the honest reason.
Hints
- Match the shape of the problem to the shape of the tool: files and numbers, a page, or a service under load.
- None of these strengths is absolute. A language is good at something because the libraries around it are good at it.
You join a small team that must ship a working product in two months. Put the considerations in the order a good engineer actually weighs them.
- 1Check that the libraries the job needs exist for a language we can use
- 2Revisit the choice only if a real limit shows up in production
- 3Prefer the language the team can already read and maintain
- 4Ask what the program has to do and where it has to run
- 5Write it, keeping the code readable for the next person
Hints
- What breaks first when a project gets big is rarely the syntax.
- The user never sees your language. The user sees whether the page opens and whether the button works.