Coding Basics 101: What is code and how does it work?

Coding Basics 101: What is code and how does it work?

a newbies guide to coding and programming languages.

Hi there!

I guess this is not your first time hearing about "code" and if it is, don't you worry, you’ll get to learn quite a lot about it here.

Coding is an integral part of your life whether you are a software developer or not. Every time you solve a problem, you make use of some level of programming logic.

This article briefly introduces coding, how it works, and programming languages for web and mobile devices. Think of it as a teaser into the world of programming. Hence, you don't need any previous knowledge as I've incorporated easy-to-follow examples to aid understanding.

So, first things first:

What is Code?

TechTarget defines code as:

the set of instructions, or a system of rules, written in a particular programming language (i.e., the source code). It is also the term used for the source code after it has been processed by a compiler and made ready to run on the computer (i.e., the object code).

That's quite a mouthful. Try not to memorise or bother about words like "compiler", "source code" and "object code" for the time being.

Simply put, it is a set of instructions given to a computer to execute a task.

You might be thinking, why is it necessary for computers to execute tasks? The fact is that computers in general are invented to solve problems, whether it is a simple device like a digital calculator or a more sophisticated one like a MacBook.

An essential way computers achieve this is through programs. Hence, you have different programs running on computers to solve problems through the execution of tasks sequentially.

A program is a set of instructions (code) executed in a step-wise manner that enables the computer to carry out a task geared towards solving a problem.

Notice how we've introduced a new term "algorithm" into the mix in the illustration above. Can you guess what it means? Yes, the Algorithm refers to the sequential steps in the program.

Now that I know about code, how does it work?

Remember the terms source code, object code, and compiler, which I told you to forget about earlier? It's time to face them.

Source code is generally understood to mean programming statements (Codes) created with a text editor or an Integrated Development Environment (IDE) and then saved in a file. Object code generally refers to the output, a compiled file, which is produced when the Source Code is compiled with a C compiler.

I know that's a lot of technical "jargon". Let's be more practical:

Imagine you are a native English speaker who wants to give directions to someone who understands Italian much faster than English. Which of these options will solve the problem of the language barrier fastest?

  • Ask your friend who speaks Italian to translate.

  • Still communicate in English.

If you chose the first option, then you are on the right track.

Consider the source code to be programming statements which are easy to understand by the developer but less so by the computer. Therefore, the compiler's job is to simplify the code and make it easier for the computer to understand.

Whenever you write a code, your device's compiler translates it to object code such as binary code –– a sequence of "1s" and "0s" that tells your computer what switches to turn on or off.

What about programming languages?

In the preceding sections, I hinted at programming languages using phrases such as "statements or programming statements". So, you already have a fair idea about what they are.

Now, let's get technical:

A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language ( C, C++, Java, Python) to perform a specific task.

The above definition is what you would find on Javatpoint and shares similarities with other resources. The description of a programming language is usually divided into two parts of syntax (form) and semantics (meaning), which are usually defined by a formal language.

Looking at the numbers, there are over 300 programming languages. This means more than 300 ways of getting computers to perform actions.

Why is this so?

The answer is simple: "ease and speed". Programming languages are constantly being invented with specific features to make performing specific tasks faster. C++ or C#, for example, is used to make video games for PCs and consoles. See a sample C# code that returns as "Hello World!" below:

using System;
namespace HelloWorld
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Hello World!");    
    }
  }
}

Don't fret if you don't understand the code. We would be discussing more about programming languages in the next section.

Types of programming languages

Asides from the text-based and graphical classification, other ways of classifying the languages include:

  • High-level programming language

  • Low-level programming language

High-level languages are easier to write and understand for humans (low abstraction) and low-level languages are machine friendly i.e. with high abstraction. For more context, peep the illustration below;

Programming languages are used to create web and mobile applications.

Web development covers both front-end and back-end technologies. Front-end focuses on the look and feel of any website (client-side). The most well-known front-end technologies include HTML, CSS, and JavaScript. Conversely, back-end is server-side and is concerned with storing user data. If you are interested in knowing more, here's this article to get started.

Mobile application development is the process of designing and building mobile applications. A mobile application can be pre-installed or downloaded from an app store or mobile web browser. Java, Python, C++, Kotlin, and Rust are popular app development languages ranked among the world's top 10 most preferred languages in 2022. Do you want to build the next Spotify? Here's a free course to get you started.

A mobile app must have a network connection to a remote server or computer, which is facilitated by an application programming interface (API).

Wrapping things up

Up until now, I have painted a clear picture of some fundamental concepts in computer science and programming. Having a firm understanding of these basics will help you not get easily confused in this dynamically changing tech space.