From the course: Computer Science Principles: Programming

Forms of programming

From the course: Computer Science Principles: Programming

Start my 1-month free trial

Forms of programming

- As programming has evolved over the decades, the types of programming you can do have changed as well. Depending on what you want to do, there are different types or forms of programming languages that will work in different ways. As a programmer, some forms of programming give you direct access to the computer processor while others abstract the hardware into more human language that needs to be translated or converted into the native language of the hardware. Here are some example forms of programming that you might encounter. Machine languages allow programmers to code instructions directly to the processor or hardware. Processors can be programmed by sending sequences and patterns of bits through the processor to enable actions to take place. As a result, the code that is entered by the programmer is almost natively written. Assembly language, which is an abstraction of machine language, uses codes to modify processor registers and perform functions. Interpreted languages are readable by humans more easily than assembly or machine languages. The programmer writes the code and then runs it. A component called an interpreter reads each line of code and then interprets it into native instructions for the computer. The process is much slower than machine language since the interpreter needs to convert each instruction provided by the programmer. JavaScript is an example of an interpreted language. A programmer can stop the execution of the program, make a change to a line, and then run it again without any other steps. A compiled language takes instructions written by a human and sends that code to something called a compiler. A compiler takes the program instructions and converts it to binary bytecode or native code for the hardware and creates a program called an executable. This program is native to the hardware and operating system and can't easily be converted back to the original program instructions. With the code now in the native computer format, it runs much faster than interpreted code. But if you need to make a change, you need to adjust the original program instructions and recompile it to create a new executable. If you're creating programs for multiple types of processors, you need to compile unique versions for each native instruction code for the target platforms. C is an example of a compiled language. Object-oriented programming or OOP treats everything as an object. An object can store values, perform actions called methods, and accept and return values. An object is defined using a template called a class that defines what an object can do. A programmer can then create an instance of that class that has all the capabilities defined by the class. Java and C# are examples of object-oriented languages. There are languages that are specifically designed at working with data. One example is SQL, pronounced as sequel, which is a language designed for working with databases. This is a query language where you ask a database a question and it gives you a dataset as a result. You can use SQL to combine multiple databases together to create combinations that you can then analyze. R is another example of a data language. R is designed for statistical computing and graphing. Functional programming approaches programming in a much different way. Think of it like this. In a traditional programming language which is called imperative, you are defining the state of a value, object, or a component. You create and define tasks to complete called an algorithm that goes from beginning to end. Functional programming isn't bound by an algorithm. In a functional language, you perform transformations on values like a function in mathematics. You take a value or object and modify it with the ability to string multiple transformations together using functions. Examples of functional languages include Haskell, Scala, and F#. Operating systems regularly need to execute commands to configure servers, install software, or perform maintenance. To automate that process, there are scripting languages that allow systems like Windows, Linux, and MacOS to save common commands as a script that can be run multiple times or distributed to multiple computers. PowerShell, Perl, and Bash are examples of scripting languages. As you can see, there are multiple types of programming languages that you can work with to perform different types of tasks. This course will focus on concepts found in object-oriented, compiled, and interpreted languages like JavaScript, Java, C#, and Swift.

Contents