DEV Community

OnRampDev
OnRampDev

Posted on

Picking a first programming language

Screenshot of some javascript

The first step in making the decision to get into programming is to develop the right mindset. The second step is to decide what language you're going to choose as your first. This can feel pretty overwhelming when starting out. There's Ruby, Python, Javascript, something called C, something that sounds like C called C++ and some coffee language called Java. Rust, Dart, Go, Scala, ...the list goes on. So which should you choose first?

I won't bury the lede - Javascript is your safest bet, with Python as a good alternative pick. Read on to find out why.

Why Are There So Many? Shakespeare in Spanish

So why exactly are there so many programming languages and what do they all mean?

If you've ever studied a foreign language you'll know that usually you don't translate the same sentences word-for-word. If want to say "I'm thirsty" in Spanish I might say "Tengo sed" which literally translates to "I have thirst". It's close but as a native English speaker the latter sounds a little weird to me. Different programming languages are a means of expressing the same concepts using different patterns.

Here is a program that adds 2 numbers together in 3 different languages:

def add(x, y)
  x + y
end
add 1, 2
Enter fullscreen mode Exit fullscreen mode
int add(int x, int y) {
  return x + y;
}
add(1,2);
Enter fullscreen mode Exit fullscreen mode
(defn add [x y] (+ x y))
(add 1 2)
Enter fullscreen mode Exit fullscreen mode

The first is Ruby, the second is C, and the third is Clojure. These are very different programs that create the same result. But there are tradeoffs in each. C code will beat equivalent Ruby code in performance, hands-down. But it'll take you longer to write and will probably be insecure and buggy if you're not careful (which takes even longer). Clojure is what's called a "functional" language, meaning some things are just harder to do (side-effects) but it makes some ideas much easier to communicate.

Circling back on the language analogy, I'm sure someone has translated Shakespeare to Spanish but I bet it doesn't have the same qualities as in English. Some ideas are probably harder to express and some may be downright impossible. It's the same with programming languages. And it turns out programming languages are written by people as creative and diverse as the world around us, meaning different people prefer to express ideas in different ways. So lots of people will create new languages just for fun, or because a particular language doesn't do what they want in the exact way they want it (programmers are finicky).

There are pragmatic engineering concerns as well. Google created Go in part to make it easier to reason about what's called "concurrent" programming. If they do their job right this means software running in Go will get better utilization out of the underlying hardware (vs. say, Ruby). This translates to actual cost in terms of engineering time and how expensive it is to run the software.

What Makes a Good First Programming Language

Ok, that's all well and fine. We've learned that people like to create programming languages because they want to be Shakespeare...or something. How does that help in choosing a first language? Well it doesn't but hopefully you have a slightly better understanding of the landscape.

In my humble opinion, a programming language well-suited to beginners should be 1) flexible, 2) used in the industry, and 3) have a large community and resources behind it.

Versatility

A good first language shouldn't box you into any specific paradigms. And by that I mean it should be somewhat un-opinionated in how you write your code. Clojure, from earlier, isn't a great language to start with unless you have very specific reasons to do so. It's built to impose certain constraints on what you can do because it's opinionated about how good software programs are built. This makes it a very interesting language to learn at some point, but not a great starter choice.

P.S. I've heard it said that everyone should learn a Lisp-based language at some point and this is a great one to pick up.

Usage

ALGOL is the Latin of programming languages. I'm oversimplifying and I'm sure there's some computer somewhere in the world running an ancient ALGOL program that only hooded mages know how to modify. But unless you're planning to throw on a hood yourself, stick to languages that lots of people use today, which brings me to the next point...

Community

Community is good because it means there are lots of resources for when you inevitably get stuck. If I wrote a programming language tomorrow and asked you to learn it, would you? Aww, you're sweet, but that'd be a terrible idea. You won't be able to Google the error messages. There won't be any plugins in your favorite text editor. Again continuing with our language analogy it'd be the equivalent of learning Dothraki or High Valyrian.

And The Winner Is...

Finally we come to the end and the TL;DR is that you should just pick Javascript or Python. Let me explain...

Both Javascript and Python are largely built around Object-Oriented Programming which is a specific way of modeling the world in software (i.e. they're kind of opinionated), but you don't actually have to write OO style code (under the hood everything is modeled as objects anyway but that's a different story). Contrast this to say, Java, where you have to create a class before you even know or care what you're modeling and it's a big difference.

Javascript is used everywhere. It's actually a little frightening since I don't know it as well myself :). But if you're writing code for the web then you're writing Javascript at some point. And of all the different kinds of programming work you could do web development will be the easiest to break into. Python is pretty popular too and cool open-source projects like Django, Pandas, and SQLAlchemy demonstrate its versatility.

Finally, you can Google any message you get running Python or Javascript code and you will find an answer.

Wrapping Up

We talked about different kinds of programming languages and how they differ. We discussed Shakespeare, Spanish, and talked a little Latin too (in vino veritas). Most importantly, we talked about why Javascript and Python are very safe choices as first programming languages, especially if you plan to pursue web development.

Hope this helps. By the way, don't forget to join my mailing list so I can continue my language rants in your inbox and tell you why I secretly want you to learn Clojure. :)

P.S. This is reposted from my main site at https://onrampdev.com/ - check it out for insights.

Top comments (1)

Collapse
 
monish_munagala profile image
Naga Monish Munagala

Great post! Although I feel like the second step should be learning pseudocode. If you are completely brand new to programming, pseudocode can help you get started with all the basics of what you might learn in an actual programming language.

I'm still in high school, so I might not have much knowledge. But when I learned pseudocode, I was able to quickly learn other languages such as python or sql.