Compiled Languages Vs Interpreted
I think that every developer should know a Compiled language very well - unknown Google Engineer
Why is it that the giant tech companies always have job postings for Java or C++? Even while asking questions during a google engineering webinar supplied through my Bootcamp, a google engineer gave me some very interesting advice. After telling me that a programmer should be practicing every single day, they also left me with the interesting quote above. Every developer should know a compiled language very well. This quote holds a lot of merits when you consider the job postings in my city as well. There are over 5.5k Java positions from Junior to Senior and over 2k for C++. In my research of trying to figure out why I also came upon an interesting bit of information about compiled languages in general vs interpreted languages. I would like to share this information with you, the reader in case you are thinking about the age-old question “What programming language should I learn now?”
Compiled vs Interpreted
What does that even mean, compiled programming language?
A compiled language is a programming language in which the code is directly translated to machine code (i.e, something the computer understands) from human code. Machine code is simply 1s and 0s. That is the basis of all programming when done to machines. Languages like C, C++, Erlang, Haskell, Rust, And Go are compiled programming languages. These types of languages require that the source code is “built” or compiled before the program can be executed. This also has to be done after every change that the developer has written.
So for example, let’s say that you are building an application that would allow you to calculate the difference between feet and miles. Then one day a new unit of measurement for distance is invented. You would program this new unit into your application as you would normally but it would have to be re-compiled before it would execute on the new code. If you wrote a bug but then wanted to fix it, you would have to re-compile once more. This type of language has benefits and certain downfalls that we’ll get to in a moment.
An interpreted language is a programming language in which the code isn’t directly converted to machine code but another program known as an interpreter translates the code line by line as it’s being run. If we use the same application example up above, you would be able to make changes to your source code without ever needing to build or compile. Chances are you have most likely used this type of programming language. Python, Javascript, Ruby, PHP, and others belong to this category of interpreted languages.
So what does this all mean and which language should you learn, a compiled language or an interpreted one?
First, let’s layout the advantages and disadvantages of both types and go from there.
Compiled Languages
Adv:
Usually faster,
More control over the hardware of which you are writing on such as memory management and CPU usage,
Need to only need with converting to machine code once and then execute any amount of times. This creates very efficient code
Disadv:
Needs to be compiled after every change,
Is not as flexible as Interpreted code because it is very dependent on platformInterpreted Languages
Adv:
Is usually platform agnostic because it is being translated at runtime no matter, the platform, this leads to very flexible code,
Programs are usually smaller in size,
Dynamic Typing
Disadv:
Usually slower (This slowly changing or becoming less of an issue because of J.I.T)
So should you learn a compiled language or an interpreted language first?
…That really depends, I personally learned C first and it really opened my mind to what “true” programming is. I use that word extremely loosely but it was my first real dive into programming and as you know C is a compiled language. It makes it so you have to manage and be aware of all things that you build and many things that we take for granted in modern languages have to be built from scratch. Do I recommend this way of learning programming? Definitely, if you aren’t faint of heart and really want to see if software engineering is for you. If you want to do a quick course and just get your feet wet, I would suggest an interpreted language as it has more modern features and what others call conveniences that C does not. Either away program and practice every day! (That’s something I struggle with still…)
Side Note:
There are some languages that are and can be both, such as Java which we will talk about in more detail as I personally learn more about Java!
As always thank you so much for taking the time if you read all of this, I really appreciate it.
If anything about this post is wrong please don’t hesitate to let me know via Linkedln: https://www.linkedin.com/in/brandontyus/ I’d love a chance to fix it and learn something more.