Java isn’t Javascript? A beginner’s guide to programming languages.
Despite studying I.T, we aren’t always exposed to a wide range of programming languages throughout our university courses. With many units involving algorithmic concepts or business applications, the specifics of what language we program in and how we use them tend to be glossed over.
This piece aims to give you an overview of the most common programming languages where we’ll go through some differences between the languages and how they can be used in the real world.
Let’s start with the general purpose programming languages:
1. Python
Python is one of the easiest to read languages because of its use of indents (spaces/tabs), lack of curly { } brackets and ability to express concepts with minimal amounts of code.
Simply doing something in Python generally requires less code than in other languages. In Python, memory management is performed automatically allowing the coder to focus on the logic of their code rather than how it impacts the computer. With a large standard library (pre-written functions) Python is a powerful but easy to understand language great for beginners but also experts.
Where is it used?: Some common notable applications are writing unit tests that automatically test components of a system.
How do you run it?: Once Python is installed, .py scripts can be executed directly from either the command prompt/terminal or from an IDE ( a program where you can write and run code).
2. Java
Java (not to be confused with Javascript) is a powerful language that has a strong focus on classes and objects making it great for object-oriented programming (thinking about the parts of a program as objects that interact with each other). This means it’s designed to allow the programmer to write something once and to be able to use it everywhere, such as making a “Person” object that can be duplicated for any new person added to the system. Like Python, Java also has automatic memory management and a standard library but its code is harder to read as it generally contains longer function names.
Where is it used?: Java is used in many applications ranging from servers to desktop software but most notably it is the language that Android applications are written in.
How do you run it?: With Java installed, a project can be created and executed in an IDE or .java scripts can be compiled into a .class file and multiple .class files can be put together into a .jar file which can be executed.
3. C
C is one of the older languages on this list but it still has relevance in today’s technology, most notably it's used when coding for systems with limited resources. This is because C allows the programmer close control over how the program uses the computer’s resources and requires the programmer to manually assign memory that will be used. This gives the potential for a programmer to get the most out of a computer’s resources. Compared to languages such as Python and Java, C can be more difficult to learn and write in because of its manual nature.
Where is it used?: C has been used to write things such as device drivers and operating systems.
How do you run it?: C generally requires a Unix system such as Linux or macOS where the .c file can be compiled then executed using the terminal.
4. C++
Influenced by C, C++ is essentially the C language plus support for classes and objects. This means it supports the manual memory management found in C but also the ability to make classes and objects like in Java. Having this hybrid of features makes C++ a very popular language for developing programs for both resource-constrained and large systems. Its syntax is very much similar to C.
Where is it used?: Software for resource-constrained and large scale systems.
How do you run it?: Much like C programs, C++’s .cc file must be compiled into an executable. Unlike C, it can be easily compiled on various operating systems.
5. C#
Inspired by C++ and developed by Microsoft, C# takes the functionality of C++ but removes its manual memory management complexity focusing on its object-oriented nature. C# is much like Java in that they both follow the C style syntax and focus on object oriented programming.
Where is it used?: C# has been used to develop desktop applications, most notably windows 8/10 applications.
How do you run it?: C#’s files (such as .cs) can be compiled and run with Visual Studio as well as in the command prompt.
6. Objective-C
Being a superset of C, Objective-C has all the capabilities of C with added object-oriented features from another language known as Smalltalk which works a little differently than how it does in C++. It had become very popular because of its use in developing iOS and OS X applications but now has since been replaced by Apple’s new language known as Swift.
Where is it used?: Objective-C has been used in developing iOS and OS X applications.
How do you run it?: Objective-C’s .m files must be compiled and run using Apple’s XCode software.
7. Ruby
Ruby is an easy to understand and simple language. It has mostly the same functionality as what is found in other dynamic languages (object orientation, automatic memory management etc). Much like Python, Ruby aims to make clean, readable and concise code but has a different philosophy in that Ruby has many ways to perform a specific task whereas Python has an understood preferred way to do things. Ruby is also highly used in web applications where the Ruby on Rails framework is used.
Where is it used?: Ruby is mostly used alongside its Rails framework in web applications.
How do you run it?: With Ruby installed, .rb files can be run in the command prompt/terminal.
Next lets go into some more application specific languages:
8. SQL (used in database systems)
SQL which stands for Structured Query Language is a language and is essentially the language that a person can use to update and retrieve data from a database. Unlike general purpose languages, SQL is solely used within database systems.
Where is it used?: SQL is used in common relational database systems such as Oracle, Access and Microsoft SQL Server.
How do you run it?: SQL scripts can be run in relational database management system such as Oracle or in a command prompt window that’s connected to a database.
9. Javascript (used in web sites and applications)
Javascript is code that runs in your web browser which enables the creation of online programs and interactive web pages. Javascript can’t function alone but works alongside HTML and CSS. To put it simply, HTML places the items such as text and pictures on the web page, CSS makes the items look pretty (colours, fonts etc.) and Javascript performs the logic behind how the items on the page work.
Where is it used?: Javascript is used on almost all modern websites.
How do you run it?: Javascript can be a separate .js file that’s referred to or can be contained in the HTML file of a website. It is run by the web browser such as Chrome, Firefox and Safari.
Below is a comparison between how many lines it takes to write a simple "Hello World" program in various languages.
Overall, there are many programming languages widely used today, even though a lot of them have similar names, they all have uniquely different characteristics and strengths. There are many more programming languages and even frameworks for these languages that haven't been able to be included here but these are some of the essential ones to be aware of.