Compiling vs Interpreting Code
Compiling and interpreting are two methods used to convert programming code into machine code that your computer can understand and execute.
Think of compiling like writing a letter to a friend who speaks French. You write the entire letter and then use Google Translate to convert to French. When the translation is ready you copy the full translation and send it to your friend. All of the translation is done at once before the letter, or program is given to its recipient. If you wanted to send the same letter in a different language, you would need to start the whole process over again to do a full translation. Consider your friend who receives the entire letter and is able to read it very quickly because the full document is provided at once.
Interpreting can be compared to having a live conversation with your same French-speaking friend with the use of an in-person translator in the same room as you. You would say a thought or two, the translator would relay it in French to your friend. This type of translation is done on-the-fly. Consider again your friend who is only receiving a portion of your full conversation at a time. It is much slower to understand the full message this way.
|Compiled Languages||Interpreted Languages|
Statically Typed vs Dynamically Typed
Statically and dynamically typed refer to how a language handles different types of data.
Consider that in both types of languages we are going to create a variable to hold a user’s username.
Initially, all usernames are integers. In a statically typed language, we create a variable to hold the username, tell it that it will be holding an integer, and assign the first integer value. In the dynamically typed language, we again create a username and assign the first integer value.
So far, they are very similar.
Later in our program, we need to convert from using an integer username to assigning the username based on a provided email address. A dynamically typed language creates an additional assignment statement and assigns the same variable a new value as a string. In a statically typed language, we can’t do this. Once the variable is created to hold an integer it can only contain integers. We would have to create a second variable to hold a string value.
Statically typed languages are considered safer; dynamically typed languages are considered easier to use and require fewer variables.
|Statically Typed Languages||Dynamically Typed Languages|
Object Oriented vs Non-Object Oriented
Our physical world is made up of objects. On my desk, there is a keyboard object, pencil object, and computer mouse object. You know what these things do even without seeing my desk because we have a basic understanding of the functionalities any given object can perform and general attributes that define the appearance of each one.
Object-oriented programming languages organize their code in similar structures to the physical world, creating programming objects that share similar appearances and functionality.
Consider a person in the real world. We could describe a person by defining their height, age, and name. Our computer person object would have the same attributes defined. Within our program, this person object will need to take some actions, like registering an account or depositing and withdrawing funds from an account. By thinking in objects our code becomes easier to manage and quicker to reproduce. We don’t have to create each person from scratch and decide each time what data to include; instead, we know that all people in our program share common attributes and should be able to perform the same tasks.
|Object-Oriented Languages||Non-Object Oriented Languages||Provides Some Object-Oriented Support|