From the course: Programming Foundations: Fundamentals

Exploring languages - Python Tutorial

From the course: Programming Foundations: Fundamentals

Exploring languages

- There are hundreds of programming languages out there. Let's take a look at the most popular. At the time of this recording, Java is number one, closely followed by C, C++, and our friend, Python. And you might be surprised to know that they're all related. That's right, Java, Python, and C++ all inherit ideas from C. The C programming language was developed in the 1970s. It's used for programming operating systems, games, smart devices, and even compilers for other languages. Here's an example of a program in C. Let's walk through it. The include statement we see here on line number one is very common in C and C-based languages. It's the way you as a programmer get to link to code that someone else wrote into your program. Did you know you could do that? This is very important to know because as programmers, it's our job to develop software that meets a business need. And we often do this with a specific deadline in view, so it wouldn't make much sense to write the same types of functions again and again, especially if they're already available and have been verified by other programmers. In fact, this is so common in computer programming that we call the grouping of variables and functions that someone else has written and verified, a library. In our example, we want to link to the standard input and output library. This is available for the C language. This library includes the code for the print F function. We use print F to display our hello world message to the user. Okay, enough about libraries. Let's go to the next line of code. The two forward slashes are how we create a comment in C, whereas if you recall in Python, we use a hash mark. There's a function here called main. This is a very important function in C-based languages because it's the function where the program begins. And just like what we've seen with Java and JavaScript, curly braces are used for the function's body. Both languages adopted that syntax from the C language. And finally, as our function's body, we make a call to the print F function to display our message. And that's it for our C program. If you're interested in making a desktop, web, or mobile application, C is not really your best choice. It's a low-level language and requires more advanced programming knowledge. However, some of its successors are ideal for these types of applications. Let's take a look at a few. First up, Java. Java is a cross-platform programming language. This means that you can write your Java code, compile it, and then any device that has the needed program installed can run it. It's famous for desktop applications and mobile apps for Android. It's a C-based language, but unlike C, everything in Java is in what's called a class. Here's some Java code. It looks pretty close to what we saw with the C programming language with its use of curly braces, semicolons, and the main function. One of the new additions is the class keyword. This is how the Java language prefers to organize its code. Now let's take a look at one more language, C++. C++, as the name hints at, is also a C-based language. It's earlier to learn and work with than C because it has something called garbage collection. Garbage collection cleans up unused variables for us so that we don't have to worry about handling it ourselves. C++ is used for games and game engines. In this video, we've only covered three programming languages and there are dozens more. Swift and Objective-C for iOS development, Ruby and JavaScript for web apps, and so on. With so many languages available, you're probably wondering, which one should you choose? Well, you already have the basics of the Python language under your belt, so it makes sense to continue with that. I recommend the course Python Essential Training to help further your knowledge of the language. However, depending on what you want to develop, now you know what other languages you can pursue.

Contents