Introduction to programming

Your program will do exactly what you tell to do. Nothing extra and nothing less.

Photo by Chris Ried on Unsplash

Assuming you are just starting your journey in this field - it is tough. Sometimes you just want to throw your laptop away with the words “F*CK these small dots, variables, and everything together!”.

To start, continue, and finish strong make programming part of your life. Involve with our community. Watch news and movies about it. Socialize with your classmates.

A program is a set of instructions that can be executed by a computer to perform a specific task. Your program will do exactly what you tell to do. Nothing extra and nothing less.

Computer

A computer is a hardware machine. To list some computers: your laptop, your smartphone, your smartwatch, your fridge, etc. Almost every computer has input devices, output devices, CPU(central processing unit), RAM(random access memory), auxiliary memory(secondary memory).

Some input devices: keyboard, mouse, microphone.

Some output devices: screen, speaker.

CPU(central processing unit) is the brain of the computer that executes program instructions. The CPU performs basic arithmetic, logic, controlling, and input/output operations.

RAM(random access memory) holds data of the current running program. The data stored in RAM disappears when you shut down your computer. RAM is much faster than auxiliary memory.

Auxiliary memory. The data exist in auxiliary memory when the computer’s power is off. Hard Driver is an auxiliary(secondary memory).

Program

A program is a set of instructions that can be executed by a computer to perform a specific task.

Most of the programs will fit in the above diagram. The program takes input and processes it and produces output. Our job is to write a code that will process input and produce output. A requirement of the program will tell us what kind of task we are trying to achieve.

Let’s take for example google.com search engine. It takes input as a search key and processes it and gives us output as results of the search.

Every program is solving a certain problem otherwise it won't exist.

An algorithm is a sequence of instructions to solve a problem. Algorithms play a big role in the progress of information technologies. A well-designed algorithm can boost the efficiency of the program by 100s or even 1000s times, especially when dealing with big input data.

Phone Book Algorithm by David J. Malan

Pseudocode is a plain language description of an algorithm.

Abstraction

You might already hear that the computer can only work with 0 and 1. This is a binary system. Computer use 0s and 1s because it uses electrical switches which can be in off or in on stages. On — there is power, off — there is no power.

Humans use the decimal system and computers use the binary system. it’s all abstraction or we can say rules to store some amount of data(numbers).

Let’s say in a decimal system I have 101 as a number. How do we know by looking into 101 that it’s actually representing one hundred one pieces (amount) of something? If an alien will read 101 he might think it actually 2(1 + 0 + 1) or whatever. We know that it’s really one hundred one because we know how does the decimal system work. In decimal, we have ten numbers to represent all possible amounts.

The same story with a binary system. Binary uses only two numbers to represent different amounts. These two numbers are 0 and 1. One hundred one in binary is 1100101.

We can think about memory in the computer as a canvas of cells. Each cell is a switch that can by 0 or 1.

101 in binary is 1100101

Each cell is a bit. The bit is the smallest measurement.

Memory hierarchy

The above picture shows the memory measurements hierarchy. Now, when you say I have 8 GB RUM memory on my laptop, you know that you are talking about 64,000,000,000 bits which can store 0 or 1 only.

Ok, we have learned about numbers. How about characters? How do we work characters if we can store only numbers using a binary system?

Each character has a specific number representation. We have a standard mapping for characters. The name for this standard encoding is ASCII.

https://simple.wikipedia.org/wiki/ASCII

ASCII is an abbreviation for American Standard Code for Information Interchange.

How about pictures and videos?

The screen consists of small blocks known as pixels. Each pixel can take a specific color. By mixing red, green, and blue we can have all spectrums of colors.

Group of pixels makes a picture
A pixel consists of 3 Bytes

And the video is a collection of pictures executed in sequence.

Did you see how we went from 0, 1 to videos? Because we always abstract things out and create some kind of interface to able make it more comfortable for us. You will see the same thing when we will start writing code in Java. We will not use 0 and 1 to write our programs. Java is a high-level programming language and we will deal with keywords that pretty much intuitive and understandable.

This article is part of the series of articles to learn Java programming language from Tech Lead Academy.

1. Introduction to programming 
2. OS, File, and File System
3. Working with terminal
4. Welcome to Java Programming Language
5. Variables and Primitives in Java
6. Methods wiht Java
7. Conditional branching, comparision and logical operators
8. Switch statemet and ternary operator
9. Enum
10. String and its methods in Java
11. Loops in Java
12. Class, Object and constructor in Java
13. Object Oriented Programming in Java
14. Encapsulation in Java
15. Inheritance in Java
16. Abstraction in Java
17. Polymorphism in Java
18. Overriding vs Overloading in Java
19. OOP Design Principles in Java
20. Array in Java
21. Data Structures with Java
22. Collection framework in Java
23. ArrayList in Java
24. Set in Java
25. Map in Java
26. LocalDate in Java
27. Exception in Java
28. IO in Java
29. Design Patterns
30. JUnit

Software Developer, Java Instructor https://www.techleadacademy.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store