Notes on computer science compiled as I read SICP.
Computer science is much like magic. Socerers command the spirits of the ancestors to perform tasks. In computer science, we invoke the spirits of the computer to perform computations. We do so in the guise of computational processes.
“A process is an abstract being that inhabits a computer and as it evolves it mutates other abstract things called data.” A process is much like a Socerers idea of a spirit. It is abstract and magical but it does real things. Socerers invoke spirits using spells. Spells in computer science and computer programming are called procedures.
A procedure is a set of rules or more likely a pattern of local evolution of a process. It directs the evolution of a computational process. A procedure is the spell used by a programmer or computer scientist to command processes to do stuff. Socerers dispense spells using esoteric languages. Their spells are communicated in ancient Babylonian, Summerian or something. In computing, we need precise and well formalized languages for communicating our ideas about processes in procedures. SICP uses LISP for this purpose.
A programming language is a tool for expressing our ideas about computational processes. It is also a framework for taming the complexity of the systems that evolve from the computational processes we compose. Much like languages used by socerers, the language should come with some building blocks from which our computational systems are constructed.
3 main building blocks every programming language should have are:
Primitive Elements In the form of primitive data and procedures that come with the language. Most languages come with numbers, characters and primtive operators to combine and factor these elements.
Means of Combination Means and glues for combining the primitive elements to build our own idealized components. Much like means of combinging spells to form bigger spells, family spells or combining lego blocks to build larger blocks. Modern languages have glues like classes, arrays, maps, functions, methods and files for combining elements.
Means of Abstraction It becomes increasingly cumbersome to pass around huge structural blocks around a system. In natural languages, there exist single words that describe hectic and hairy processes. The word “marathon” for example informs a communicator at one end about the set of physicial activities and events encompassing running, resting, cheering etc. All of these are described by a single word.
A programming language should have means by which programmers can name complex components and pass them around as single units in the same sense that simple words can be used to communicate complex information. Programming languages provide means for naming objects, classes, functions, files etc so that using these units can be as simple as passing around the names that identify them.