The Five Principles of Programming
How to think like a computer scientist.
Thinking Procedurally
sub procedures — contains a series of instructions that perform a specific task. This is the most common way to break down a problem into smaller. individual tasks.
identifiers — a term used by programmers to uniquely identify a variable, an object, a sub-procedure, etc.
Thinking Logically
iteration — the process of repeating series of instructions. It can be expressed by using the FROM TO loop and the WHILE loop statements.
conditional statement — performs different instructions depending on a Boolean test. The IF-ELSE statement is comonly used.
Thinking Ahead
pre-planning — the process of planning something in advance
prefetching — getting data or instructions from memory into the cache before they are actually needed. For example, when a program requests data that was previously fetched, the program can use the cache data instead of taking from the slower main memory.
Gantt chart — a type of bar chart widely used for project schedule and management as a way of showing activities, tasks and events.
Thinking Concurrently
concurrent processing — the execution of different instructions simultaneously by multiple processors.
Concurrent processing requires good planning and coordination of resource management. Without this, it may cause serious problems in the program.
Thinking Abstractly
abstract thinking — reflecting on events in a general manner that hides all unnecessary details of specific objects.
Object oriented programming (OOP) — uses abstraction, and is based on the principle of considering everything as an entity. These entities are objects, and OOP uses programming objects to describe the data (properties) and behaviour (methods) of real objects. It is a way of procedural programming, which uses procedures to exchange data as building blocks of programming.
Example 1:
Example 2: