Skip to content

Intro to Programming

In the simplest term, programming is just creating a set of executable instructions for a computer. These instructions are collectively known as Software or Program.

In this module, we will understand what exactly is a program and how its created by going over the following topics:

  • Understanding Program
  • Program Execution Workflow
  • How Program is Made
  • Understanding Java
  • Creating a Project



› Understanding Program

A program is just a set of instructions that a computer uses to perform a very specific function. As an analogy, you can think of a program as equipment usage instructions that have precise steps on how to use them.

These instructions are written in the form of Machine Code, which the CPU understands and processes. For example, this is the instruction set of the Google Chrome browser program.
Google Chrome Program Instructions

When these instructions are installed into your computer as a program or software, your computer can execute them by utilizing the following hardware.

  • Hard Drive (HD)
  • Random Access Memory (RAM)
  • Central Processing Unit (CPU)
  • Input/Output Unit (I/O)

Image title

  • Permanent storage unit where data is stored physically
  • Data is technically indestructible
  • Holds all folders, installed programs, and operating systems
  • Takes a long time to retrieve data

Image title

  • Temporary storage unit, where data is stored in the form of electricity
  • Holds currently running program’s instructions and data
  • Supports hyper-fast data retrieval

Image title

  • The brain of a computer
  • Executes provided machine code instructions
  • Can execute 3 billion instructions per second

Image title

  • Collection of physical devices and software (called drivers)
  • Handles data input to the computer from external input devices
  • Handles data output to the external devices

Now with these hardware components in mind, let's understand how a typical program gets executed.



› Execution Workflow

When the user initiates program execution by double-clicking the program files, the following execution workflow gets initiated. Let's understand this workflow by using Google Chrome browser program as an example.

  1. The user double-clicks the Google Chrome program file.
  2. The program, which is stored in Hard Driver, will be sent to RAM.
  3. RAM will send the instructions in the program files to the CPU.
  4. CPU will execute these instructions.
  5. The output of the instruction execution will be directed to I/O Unit.
  6. I/O Unit handles the rendering of the result to the end-user.

This program execution workflow is extremely helpful for understanding Object-Oriented Programming concepts that we will go over later in training.



› How Program is Made

We use Java programming languages to develop a program. Java belongs to the group of high-level programming languages that are designed to reduce the complexity and amount of code required to develop a program. Some of the other notable high-level programming languages are:

  • Python
  • C#
  • Ruby
Instructions created by using the Java programming language is called Source Code, and it is easy to understand since its human-readable.
Example of Java Source Code

  • Human readable code (instructions)
  • Designed to reduce the complexity of creating program
  • Only human understand them, computer won't understand it
  • Need to be translated into Machine Code

We have to translate this Source Code into Machine Code where CPU can understand and executed them. This translation process is known as compiling.

Please watch the following video to understand Java source code compiling:

Command seen in the video:

javac Demo.java # complies the Java source code in Demo.java
java  Demo      # executes the machine code in Demo executable file 

The compiling generates an executable file containing machine code instructions, which we generally refer to as a program or software.



› Understanding Java

It is essential to understand that Java is two things; first, it is a general-purpose, high-level programming language, and second, it is a Runtime Environment (JRE).

The JRE is actually one of three Java platform components that are required for any Java program to run successfully. The Java Development Kit (JDK) and Java Virtual Machine (JVM) are the other two components.

Java Runtime Environment (JRE)

JRE is a folder required in your computer to run a Java program. It is used to execute a JAVA program and contains various Java libraries necessary to operate the JVM. As an analogy, JRE0000 is the test road with gas stations and tire change sections.

Java Development Kit (JDK)

The JDK is a folder that contains a collection of software tools you can use to develop Java applications. By default, it includes JRE and JVM. An an analogy, JDK is a manufacturing facility with assembly lines, car parts, and a test roads.

Java Virtual Machine (JVM)

The JVM is utility program that runs the Java program line by line with the help of the CPU. It allows Java programs to run on any device and any operating system. As an analogy, JVM is like an engine that is installed into a car.