Computers at a glance
Computers have taken the world by storm, as is evident in its diverse areas of applications. From its simple beginning as an analytical machine, it controls the power stations and chemical plants. They drive airplanes, rockets and ships. Businesses need them for online transactions; Doctors require them for precise medical diagnosis and to predict the health of patients. Scientists, Astronomers and researchers need them for complex computations, documentations; which otherwise would have taken years of time and considerable man power. Artists use them to draw and create 3D models and chefs use them to assist in cooking. They route the communication networks worldwide and into space. They implement connecting and messaging portals like Facebook, WhatsApp, Google mail, YouTube etc.
A computer can only execute instructions and it’s quite fascinating to see, how such a machine that can only do few simple operations such as flipping, zeroing and testing a bit  could accomplish such a wide range of operations.
• How does a computer attain such feats of ability, through these simple operations?
• What is it that translates these operations into those examples listed above?
Complementing the advances in sensor, memory, high end processors, communication and other hardware technologies, let’s try to answer these questions and be part of this great movement.
Understanding Algorithms, A Cookery Example
Let’s take an analogy, from the cooking process. We all like to have a strong cup of tea in morning, or a cut of dessert after lunch. Let’s analyze a simple cooking process and try to understand our subject. Suppose you are told to make tea for guests arrived, and below are the steps taken by you to make the tea;
STEP 1: Initially, move to the kitchen and set up the materials required (tea bags, sugar, milk, tea cups or glass, gas stove and boiling pan);
STEP 2: boil the water in the pan using the stove;
STEP 3: When it starts boiling, add tea powder and sugar to the boiling water;
STEP 4: Once properly boiled, mix the boiled tea with milk in a cup;
STEP 5: Check the sugar content, taste it and serve if fine;
From the above steps, one can figure out that the materials like tea bags, sugar and milk are input to the cooking process, whereas the tea cups or glasses, gas stove, boiling pan, including the cook are considered hardware to the process and the final tea served is the output of the process. The steps taken to transform the raw materials to tea, is known as a ‘recipe’ or in computing terminology known as ‘Algorithm’.
Here an important point to consider is that, it’s the recipe that selects the required raw materials and other kitchen utensils needed for making TEA. Similarly, in Computing it’s the appropriate algorithms that give life to computers and accomplish such great feats mentioned above and even drive the need to invent new and better hardware.
How Computers Understand Human Invented Algorithms
Algorithms similar to recipes are ideas formed inside oneself. These are transformed to machine executable constructs using programming languages such as Assembly language, C, C++, Python, PHP etc.
Computer scientists have devised programming languages such that a programmer (A Cook in our example) can express his ideas (Algorithms) based on few constructs, which are suitable for computer execution.
Basically, computers don’t even understand the algorithms expressed in a programming language. These typed in codes are translated to computer executable logic using compilers and interpreters (which are known as system software, usually supplied along with the machine by the manufacturer).
Thus computer languages allow one to express his ideas or algorithms, in a human understandable format, which are then translated to computer executable constructs using system software.
The Problem With Languages And What To Choose From
Computer languages are designed, keeping in mind the way humans think and express a particular problem. Thus some languages are designed to express mathematical equations (like Fortran, ALGOL), while some are designed for developing graphics user interfaces (like QT framework, Java) and some languages are used to create webpages (like HTML, Java scripts). These languages have specific constructs, libraries and routines that cater to specific problems and as such it’s quite natural for a programmer to express and write his thoughts directly in a particular language.
Considering examples from procedural language (example C) and Object Oriented language (example C++).
First let’s take a problem to design an automatic watering system for household plants. Suppose appropriate hardware is selected, one can write down the Algorithm as below:
STEP 1: Initialize the system, and get the user input for soil threshold level;
STEP 2: Sense the soil moisture content, check if it’s equal to the threshold level;
STEP 3: If the soil moisture is less than the threshold, trigger the water pump to water the plants;
STEP 4: else if the soil moisture content is more than the threshold, Switch OFF the water pump.
STEP 5: Repeat STEP 2.
The above steps, typically describes an automatic plant watering system and analyzing the algorithm, we can see that, it involves a series of STEPS of operations, Conditional checking like ‘if’ and ‘else if’ and ‘repetition’ operations.
If a programmer can program the above steps, in a similar language as written above, he can well express his problem, and get the computer to do what he wants without going into the low-level details (bit level) of the system. The above STEPS could be expressed in procedural programming languages like Embedded C, Arduino Sketches etc. Considering constructs like if, if-else, while and for loops.
Consider another example, where one is given the task to simulate real world events. For example, the simulation of traffic in a T junction that connects three streets. Such simulation provides information to identify the frequency of traffic jams in a particular time of day and minimize them by taking necessary preventive steps.
You are welcome to express the problem similar to plant watering system.
Once tried? You will notice that it is quite difficult to express the problem as a series of steps similar to plant watering system and natural to specify such a program by describing the behavior of each object participating in the simulation such as vehicles, Traffic lamps. One can describe the problem as:
Vehicle objects are generated by the simulation program with a frequency that depends on the time of day and statistics collected. Each vehicle object entering the junction from a particular street, messages the traffic lamp object to indicate its arrival and the lamp object maintains the number of vehicles in the traffic. Another vehicle object entering the traffic will query on the status of the traffic by messaging the traffic lamp. Based on the reply, vehicle object can decide to stay on the traffic or not. The traffic object periodically changes its signals for the flow of traffic, once it’s green for a particular direction, it messages all the vehicle objects that it’s green and these vehicle objects are deleted from the traffic or program.
Such a description of the above problem based on Objects and their messaging to update its status is natural for many real world scenarios (example, simulating check out queues in malls, growth of fishes in ponds etc.) and implementing them using procedural languages (C, Assembly) is quite difficult for a programmer.
This is where Object oriented languages such C++, Java, Python etc come in. They help a programmer to express his ideas in terms of objects (vehicles, traffic lamps, fishes etc) and express their connectivity, there by simulating real world scenario.
AN EXAMPLE OF IMPACT OF LANGUAGES ON PROGRAMMING
An example, where languages have inspired and encouraged different background of people into programming is in embedded domain. The embedded domain was initially programmed using Assembly and C language. It was specialized skill, as learning and implementing them required considerable amount of time and effort.
It was then by around 2010, Arduino sketches and python language is being used for embedded programming on a wider scale. The Arduino sketches are self-learning, simple and it is designed for non technical people to enter into programming. Many People with non programming background were influenced by the Arduino constructs and were encouraged to implement their own ideas.
Thus, Thanks to computer scientist for inventing languages, the same PC with appropriate hardware can be used to deal with problems in diverse areas with ease. As Computers are being still pushed to diverse areas of applications, huge research potential to develop new programming languages and other hardware or software system exists.
If you are working on a problem and find that it’s quite difficult to express your problem in particular language, then either you have to switch to an appropriate language with necessary constructs or will have to invent a new one.
Thus answering the initial question, ‘Algorithms’ form the soul of computing, their natural expression (similar to human thinking) for computer execution drive the need to develop better computer languages, advanced hardware and other supporting systems (system software, editors etc.).
Finally, the basic question to ask is;
Given such hardware resources, plethora of programming languages and innumerable example of application, what will you make next?
1 . Algorithmics, The spirit of computing, Third edition. David Herel and Yishai Feldman.
Very informative info
Thank you for your feedback.
This is a good introduction to programming. I can see the end result in my mind, but putting it on paper is another story. The only language I have a grasp of is PLC/ladder logic. Fortunately, when integrating control systems in the field there was a great group of programmers supporting me who had mastered RPM – Read Paul’s Mind!
Itz quite informative… Very good presentation..
The way of presentation is very good and the article is informative.
Awesome content. Complex topic explained well. Thank you Fadhel!
Thanx sherbaz ..:)
Explained well and it’s easily digestible for even non IT guys, well done..
yes .. That was my objective ..
Make such topics / discussions available to general readers.
Nice Article-Perfect Composition . Well Done Fadhel Habeeb.
Nice write up fadhel
Great Article presented in a simple,lucid language.expecting more articles of this sort which will help even a non academician to understand complex scientific issues effortlessly.
From my understanding;
Topics related to science / engineering have a “HISTORY”.
Once one understands ..
how it has evolved from it’s origin to present?
how it was different from other similar concepts at that time?
and how it solved a problem for humanity at that time?
Then , a candidate is in a better position to understand the concept.
At present, many people undergoing engineering education (or many not related to science / engg) are introduced to a concept and not to it’s HISTORY.
Thus, it becomes difficult for them to understand.
Yes., Working on few other topics also.
Very informative as well as well narrated.It would have been more useful if it were in PDF format .A lot of thanks!!!
Really nice information sir thanku
Thank you for your feedback.