An Analysis of a Computer Program

by Haig. Average Reading Time: about 4 minutes.

As we are already aware Binary is a conceptual model that people have invented to represent the workings of a machine. Binary resultantly forms the basis of all software because as mentioned earlier no matter what programming language you use that code must be translated into a machine readable format before it can be interpreted by a machine, the product of this translation is usually represented as binary code.
Computer Software is conceptual and intangible as opposed to hardware which is tangible such as a motherboard, a CPU, an optical drive or a monitor. As a result the word software is intentionally used to contrast the term hardware. Programming is a means of creating software and a computer program is a type of software. Specifically, a program is a set of instructions issued to a computer in a programming language, such as Processing. These instructions are usually made up of one or many statements. Depending on what language you are programming in statements can consist of several different parts, such as


Statements can also be made up of many other parts not mentioned here, but for now we are most interested in two of these components making up a statement, commands and expressions, the rest we will get to later.


If you were to compare a statement in computer programming to a sentence in a natural language, a computer programming statement could be considered to be somewhat imperative. For example the following sentence in a natural language:

“Run, as fast as you can!”

This would be an imperative statement in English issued to the implied subject. In extending this comparison, a verb in an imperatively spoken sentence would have the same purpose as a command in a programming language. A command in a programming language usually implies a directive issued to a computer, in other words it’s a means of telling a computer to do something. In Processing we often use functions to tell a computer what to do, a function in this sense is a type of command. Functions are the building blocks of Processing programs, as you will come to see. Additionally many functions in Processing accept parameters, which modify how the function is interpreted the by program.
If we were to extend on our previous example and apply this programmatically, the word “Run” in the sentence would be a function and “as fast as you can!” would be representative of a parameter.


Expressions in computer programming languages can consist of single or multiple different types of data such as numbers, typographic characters and many other types of data that can be interpreted in various ways according to rules established by the language you are programming in. The process of how this expressional data is interpreted is known as evaluation and is similar to the term as it is used in mathematics. For example
3 + 2 is an expression that evaluates to 5.
Mathematical operators such as +, -, *, etc. work in Processing, as you would probably expect them to. As the term implies the programmatic mathematical operator is often interchangeable with the standard classical mathematical operator in Processing. For example the statement in Processing:


Consists of two parts, first the function println() which accepts a parameter. In this case the second part of the statement, the parameter, is an expression and the expression is 5+3 which evaluates to 8.
One of the basic features of Processing is it’s ability to act as a calculator when computing values separated by mathematical operators such as + (plus), – (minus), * (multiply), / (divide) and % (modulus). But this inherent ability of Processing extends a lot further than simply evaluating numerical expressions, as expressions amongst other types of data can also consist of other typographic characters that can be evaluated. For example the statement:

println(“h” + “i”);

This statement evaluates to “hi”. Using a mathematical operator in this way is known as operator overloading and is an inherent quality of Processing that comes from it being a C based programming language. Operator overloading is a common feature in higher level languages and simply refers to the level of abstraction built into a higher or mid level programming language that allows us to use the same operator in more ways than one. For example the plus sign can be used to add numbers or other typographic characters, but not numbers and characters at the same time without the use of a process known as typecasting (which we will cover in more detail later).
What makes operator overloading so useful is that we often don’t need to be aware of it, because the way that the operator is used will be determined by the context in which the programmer has used it and this is something that the program converting our human readable code into a version that is more machine readable will handle for us.

An example of operator overloading and typecasting in Processing’s PDE

No comments on ‘An Analysis of a Computer Program’

Leave a Reply