Core building blocks and which programming language to study first

Michael Choi
8 min readApr 27, 2020

--

All programming languages whether that is Python, Javascript, C++, C#, Java, Ruby, Perl, Go, PHP all boils down to what I consider to be 5 core building blocks of software, which are:

  1. variables (including arrays)
  2. if/else statements
  3. loops (including a for loop)
  4. functions
  5. Object Oriented Programming (OOP in short)

Everything in software can really be created using these 5 building blocks. Any frameworks such as Rails, Django, Flask, CodeIgniter, Laravel, Angular, jQuery, React, Ember, Backbone, Vue.js, Express, .NET, .NET Core, Spring are merely collection of codes that other developers wrote using these 5 core building blocks.

The goal of this article is to show you how these building blocks look in different programming languages so that at a glance, you can easily see the similarities as well as differences. This comparison can also be especially helpful for developers who constantly have to switch from one language to another.

We’ll also cover which programming language is better to learn as the first language, and which programming language, after you’ve learned your first, is ultimately the language you should focus on.

First, let’s go over how the 5 core building blocks of software work across 6 major programming languages.

Core building blocks across Javascript, PHP, C++, Java, Python, and Ruby

Notice how there are subtle differences between one language to next but overall, the differences are quite minor. When you get into OOP, the way different languages approach OOP is quite different, especially for languages such as Ruby, but overall, a good developer with strong logics in any of the programming language, can read and digest a code written in another programming language.

There are additional comments I made for different programming languages, (shown in yellow text in the comparison chart). One of the key points is that all programming languages cover these 5 core building blocks and how they are implemented are not that different. In fact, some of them look very similar to each other.

Which language to learn first

Now let’s shift our focus to which programming language would be good for a new coder to learn as their first language.

If you are new to coding, my recommendation would be for you to learn Javascript. Javascript is easy to learn, is a C-family language, and is widely popular. About #1 jobs in software also in Javascript roles (a dominating 40%+ of jobs in the U.S.). It also helps that with Javascript, you can also create a back-end (using Node.js) and also now even create native mobile apps (using React Native). Learning advanced Javascript is not that easy, especially when it comes to understand callbacks, promises, closures, Prototypes and ES6 syntaxes, arrow functions, immediate function, etc, but it’s possible to avoid these advanced topics and just focus on the core fundamentals in the beginning.

PHP is also a good C-family language to learn but it’s not in high demand (less than a few percentage of total jobs) and because it’s so easy to learn, a lot of new coders who didn’t have good coding skills yet wrote codes that were not really that streamlined, causing this language to have built a strong negative impression in the developers community. It is possible to build enterprise level web applications using PHP (especially when using a framework such as Laravel or CodeIgniter) but it’s also possible to build crappy applications using PHP. Majority of PHP projects I have seen in the past, fall in the latter category. PHP developers also make significantly less money than Javascript or Python developers.

C++ is a good solid language to learn, but useless if you want to build web applications. It’s a good foundational language but not really used for building anything web or mobile related.

Java is an average language to learn for beginners. It has a higher learning curve especially as you have to define variable type and also specify what variable type the function is going to return (int, string, void if it’s not returning anything, etc). Java wasn’t built for web, although you could use Java to build a web applications (using frameworks such as Spring). It’s great for teaching the low level of computer programming, especially in terms of memory allocations/management, how compilers work, etc. However, memory management is not as big of an issue now compared to when the computer was still early (say where you had only a few kilobytes or RAM for your program to use). Therefore, worrying about how much memory your variables are going to use, and specifying whether the variable is going to store an integer, string, array of 100 integers or floats, are not that critical anymore. Plus those limitations will inevitably cause a lot more complexities later when you are doing operations between different variable types, forcing you to repeatedly convert one variable from one type to another.

C# is similar to Java. You also have to declare variable types and what the function will be returning. Microsoft has gone a long way to get the open source community to embrace their tools but C# is still a harder language for a new beginner to learn and the learning curve for learning frameworks such as .NET can seem daunting for new coders.

Python is a good language for a beginner as you’re forced to indent your code using spaces (typically 4 spaces). It also has great libraries used by scientists (which is why Python has become one of the dominant languages for machine learning). However, for myself, coming from a background where I started with C++ and then learned Java, I like the beauty of seeing curly brackets. For some reason, putting a closing curly bracket at the end of my function or for loop, give me a sense of satisfaction, kind of like when I am going outside, putting my shoes on, and tying my shoes as that last step before going outside.

For Python, if you want to create enterprise level applications, you’ll have to pick up frameworks such as Django. Learning curve for learning Django, especially if you have never built anything with a MVC framework, could be very daunting. You could alternatively study Flask (another framework but lighter weight and lacking the structure as in Django), but there is also a learning curve for learning Flask.

Ruby, in my opinion, is the worst language, out of this list, for beginners to learn. It is great for experienced developers as Ruby allows you to write very concise codes (things that would take 5–10 lines of code, almost always, you can do that in Ruby in a single line). Rails takes it a step further and what developers would have normally written 100–500 lines of code, Rails allows you to create them all within a few lines using terminal commands. It almost comes to the point where it feels too “magical”. For experienced developers, this could be great as it saves them having to type codes (at least for simple operations) but for a new beginner, who must focus on the fundamentals repeatedly until it becomes second nature for them, Ruby and Rails, unfortunately, is downright horrible.

Now, these are languages that I think is best for someone new to learn as the “first” language. As developers, you’ll most likely have to learn at least one or two more programming languages to truly reach mastery.

So, which language is ultimately best?

So now that you’ve mastered one programming language, which programming language is ultimately best for someone to specialize in? Is one programming language better than another?

If you had asked me these questions twelve years ago, I would have said “I am not sure…. I only know PHP, C++, Perl, and a bit of Ruby…. so I can’t really tell you….

If you were to ask me now though, “which programming language is ultimately best for people to specialize?”, my answer would be:

None of them. Focus on the five core building blocks! Once you truly master that, you can switch back and forth between any programming language within a day or two. Use the first programming language, whatever you pick, to truly master the five core buildings, to the point that you can create anything you can think of using those building blocks”.

Now, I can speak with more force and conviction because over the last twelve years, I’ve had the privilege of learning all the languages and frameworks mentioned in this article. It took me a long time but now I understand all the major programming languages (used for web and mobile) and have learned, mastered and taught the dominant framework associated with each programming language. This took me hundreds of hours to study each programming language, at least one framework for that language, and to build out projects in that language/framework to better understand their approach.

In addition, if you were to ask me, “Okay.. Then, which programming framework is best?”, then my response would be

None of it is best. If you truly mastered the core building blocks, you will be able to create any framework like React, Angular, Laravel, Rails, Flask, and Django by yourself. After all, these frameworks are merely collections of core building blocks that other developers put together for other people to use. You can also do the same if you achieved true masterly over the fundamentals.”

After all, I have seen great developers (as well as a small fraction of my top students), who have reached this mastery, and then created a light version of frameworks similar to Flask, Django, jQuery, and Angular, all within days.

When you’ve reached this mastery, one becomes language agnostic and also framework agnostic.

In some ways, this reminds me of martial art movies where a new hero initially learns and grows through one school/style, but when they reach ultimate mastery, they become agnostic of one particular fighting style. It’s also interesting that as I gained mastery and confidence over software development, I am seeing more and more how everything really boils down to these 5 building blocks and the difference between a 10x developer and an average developer is simply how fast and effectively they can build something using these 5 building blocks. There are lots of similarities between martial art and coding…. This is a topic for another article though…

Want to learn more?

I have found in my teaching career that the best way for someone to learn to code is NOT by learning about different topics and then writing code. It’s interesting as this is how I was taught and how all universities and sites teach coding. They teach you how if/else statements work and then you are to write an if/else statement. They teach you how a loop works, and then you write it. They also teach you many other topics that are not core to programming and that are language-specific. This could cause confusion and slow down your learning.

The best way, I have discovered, for someone to learn coding is by giving a bunch of codes, and then for them to simply predict the output of the given code. Don’t have them write a single line of code yet. Simply have them predict the output.

I have discovered that this simple method could get what normally takes people 2–3 weeks to learn down to 5–15 hours and where in that short amount of time, they walk away understanding the first four core building blocks. If you’re interested in taking this approach, you can check out a teaching tool I’ve built: www.hackerhero.com and start with the first module there. Yes, it does teach the concepts using Javascript but you can also solve the challenges in Python and Java also.

You can also follow me or check out other articles I’ve written about this topic. Thanks for reading!

--

--