What is Programming and Coding?

There are a lot of things that a computer or a program can do. Like solving difficult problems that you as a human being have a hard time doing on your own. But, in order for the computer or program to be able to do that, you have to, so to speak, “tell them”. Computers obey instructions that humans have given them – this is what is known as programming.

Programming is used to solve problems using a computer. You enter instructions for how the computer is going to solve the problem, in a language that the computer understands. In other words, a so-called programming language.

Computers today only understand machine code and it is a language that is difficult for us humans to understand. That is why a programming language has been created. It is then easier for us humans to write and read this language and it can also be translated into machine language. The computer language basically consists only of (power) ON or OFF, 1 and 0.

There are several different programming languages ​​to use such as Javascript, Python, Ruby, and Scala. Different languages ​​are good for different things. The programming languages ​​are in English.

Small dictionary for programming languages

HTML: This is the language used to build websites.

CSS: Used to design websites.

JavaScript: This is one of the most widely used languages ​​on the web and is used to program websites.

Python: A slightly older language but is a good language to start with as it is easier to understand than many others.

Ruby: A clear and simple language with the aim of making it easy to learn.

C, C ++, and C #: C is an older programming language that influenced basically all popular programming languages ​​used today. It can be a little more difficult to learn, but once you know them, it will be easier to learn other languages. C ++ and C # are more modern variants of the language, Java has also been developed from C.

Finding solutions

Programming is not just about writing code, it is also about finding solutions to problems. Many times, there can be several different solutions to one and the same problem. The best way when you are going to program is to think of a solution first, describe it in ordinary words and then write your code based on it.

With the help of programming, it is possible to create a lot of different things. You can make games, programs, apps, music, and so on. Everything that is digital is made up of code. Things we use in everyday life are also programmed such as mobile phones, toys, microwaves, cars, robots, and more.

What is an algorithm?

If it is a particular problem or task that has an instruction on how to solve it, then this instruction is called an algorithm. Today, programs consist of several algorithms, ie several instructions.

Because the computer is a machine that only does exactly what it is told to do, you need to be extra clear when writing instructions for a computer.

When an algorithm is created, it must be in the correct order, because the computer can not understand if it should be done in another order. It must also be accurate as a computer does not understand if you accidentally misspelled or failed to insert a particular character. In addition, your algorithm must be complete, as a computer cannot interpret incomplete sentences.

There is a lot more to say about programming, program code, and algorithms. Among other things, you can also work with scripts, but we will address this in another post.

To understand what programming is and what it means, you need to know a little about how a computer works. This magical machine that is so wonderful hides a dark past that we programmers must know. Namely, a computer is a mathematical manikin that only follows clear instructions that are determined in advance.

What does this mean then? Well, you can see a computer (actually the processor in the computer) as an advanced calculator. By definition, there is also no difference between a modern calculator and an advanced personal computer (PC) or for that matter an XBox.

Instructions

With a standard calculator, we can enter data (input) in the form of numbers and decide what to do with them. We can add, subtract, multiply and divide with a simple calculator. These operations or instructions work the same as on a personal computer where the processor has a certain number of instructions that it can handle.

Now, a processor has significantly more instructions than a simpler calculator where the four calculation methods are just part of the instructions that can be executed. The calculator then outputs the result on a small display. With a personal computer, we can use significantly more aids, such as keyboards, mice, microphones, scanners, etc. to enter data. A personal computer can also provide output in a number of different ways, such as via screen, speakers, and printers.

What is a program?

What is a program (computer program?) Well, it can be described as a pre-determined series of instructions that build up what we in everyday speech call a program. Now, a computer does not function as “ordinary” people but has the peculiarity that it only understands and can process binary numbers (data), ie. the famous ones and zeros. This has to do with basic digital technology, which we will not go into here, but will content ourselves with stating that as a programmer you have the benefit of knowing how binary (and hexadecimal) numbers work.

Source code and machine code

To elaborate on this further, there are programs in two formats, source code and machine code (sometimes binary code). Because it is very difficult for us humans to create machine code directly, the programs are written (programmed) in source code (sometimes short and good code). Source code can be compared to a food recipe that describes step by step what to do.

It is important that the source code is written correctly and with the correct “grammar” which is called syntax and which depends on the programming language used (more on this later). Source code cannot be understood directly by the computer, but must be translated into machine code (compiled) so that the computer can run the program (also called execution). The program that translates the source code into machine code is called a compiler.

Different programming languages

There are lots of different programming languages to choose from. There are actually over a hundred of which about ten are common today. One can a little carelessly say that all programming languages ​​are good at something or developed for a certain application or to work in a certain environment. This in combination with the fact that certain programming languages ​​have been further developed means that there are so many variants of programming languages.

The largest programming languages ​​that you should know are C, C ++, Java, C #, Assembler, VB, and Python. Program languages ​​are traditionally divided into two categories, low-level language, and high-level language. There are also so-called scripting languages ​​where languages ​​such as PHP, Perl, ASP, Javascript, and more belong. A scripting language is not compiled but interpreted in a specific environment.

Low-level language mainly includes assemblers, but C is also considered a low-level language today. What characterizes a low-level language is that you write very detailed code that is very close to the language that the computer speaks (machine code). In Assembler e.g. then a program is built up instruction by instruction, which requires that you have a good knowledge of how the processor works and the address register.

This makes it very cumbersome to create more advanced programs. The advantage is that the programmer has full control over what happens and that programs created with low-level language become very resource-efficient and efficient.

Low-level language was what was used to develop programs a long time ago (70s). As high-level languages ​​have become more powerful and compilers are spitting out ever better (optimized) programs, the use of low-level languages ​​has decreased. Today, low-level languages ​​are used only for small embedded systems and very demanding parts of an operating system.

High-level language is significantly more powerful than low-level language. This means that we as programmers can achieve more with less effort and that is absolutely perfect.

When you use high-level language, you describe more what should be done and not exactly how it should be done. In any case, we do not need to know at a detailed level how the program we write is executed. This is the compiler’s problem. Most modern programming languages ​​are object-oriented. This means we will not go through in detail because course A only concerns the most basic things in programming. However, you should be aware of Object Oriented Programming (OOP) and that it is a way to structure and manage code that facilitates when creating larger and more advanced programs. One can i.a. reuse code to a greater extent.

Choice of programming language

Choosing a programming language can be difficult. Depending on who you ask, you get different explanations for why one language is better than another. All languages ​​have their advantages and those who have learned a language usually stick to this. Most often, a discussion about programming language results in a sandbox war. The most common and most important languages ​​are C # (eg. Everything with .NET which will be explained in more detail later), Java and C ++.

In fact, the most common languages ​​have more similarities than differences. This means that if you master one programming language, you can relatively easily switch to another and you learn the new one very quickly. The difference in syntax between C # and Java is not large.

Which language should you choose?

It’s a bit of a matter of taste and preference.

C # is a very powerful and easy-to-use language created and developed by Microsoft. The biggest competitor to C # is Java created by SUN. Both languages ​​are actually platform-independent, which means that the code you create can be run on different types of computers without changing it.

This is more pronounced in connection with Java because Java’s virtual machine is available for significantly more platforms.

Programs created in C # (actually .NET’s virtual machine) are slightly faster than similar programs created in Java. This varies slightly depending on the platform used (java vs c #). An advantage with Java is the freedom of choice, because there are about 30 different virtual machines to choose from (can also be a disadvantage according to some) and that Java dominates in certain industries.

Leave a Comment