Things I learnt in “Programming School” — It’s all about the basics (Part 1, Hardware)

Oluwole Kolawole
4 min readJul 12, 2016

--

I remember, without too much fondness, the phrase “differentiation from first principles”. You may guess that calculus was not one of my favourite subjects and you would be right. But “first principles”, without the offending word “differentiation”, stuck in my head and has been a guiding principle for me as a programmer ever since; I always look out for the basics, the first principles! The basics are the building blocks upon which all the other layers are built (see my earlier article on Layers); understand the basics and the layers will make sense.

I was, in many ways, an accidental programmer. I was admitted to the Federal University of Technology Akure (FUTA), in Nigeria, to study Biochemistry, but when I told them that I actually hated Chemistry, I was given the option to transfer to Industrial Mathematics and Computing (IMC). In those days, it really didn’t matter what course you were admitted to as long as you were admitted…you got into the university first, and sorted out the details later!

Fortuitously, FUTA’s IMC department couldn’t find any lecturers to teach Industrial Mathematics, so we all (just the twelve of us), ended up ditching the “IM” and doing only the “C”…Computing. I had found my calling!

The first computer program I ever wrote was in C language on a Perkin Elmer mini-computer that ran Unix. The program had to accept any user-supplied string of characters and spit out a message saying whether or not the string was a “palindrome” (i.e. a word that spells the same way when written either forwards or backwards); for example, civic, madam, radar, sexes and tenet are all palindromes.

Being a word that neither I nor my fellow students had ever heard before, palindrome caused no end of mirth amongst our merry band of 2nd year IMC students, and we twisted it’s pronunciation and meaning any which way we could to great comic effect.

By the time we had successfully written, debugged (looked at the code over and over again; there were no debugging tools back then that we knew of) and tested our palindrome program, I had been bitten by the development bug and there was no going back.

Back to BASICs

Contrary to what this sub-title suggests, and the fact that the BASIC programming language was one of my first loves, this article is not about BASIC, I just like the alliteration.

This article is actually about computer hardware basics. At the basic level, computers are a bunch of transistors electrically wired together to respond at extremely high speeds in a totally predictable manner. A single transistor is an electronic device that, depending on it’s input current, will either produce an output current, or it won’t; there are no in-betweens; so a transistor can either be “on” (representing the number 1) or “off” (representing the number 0). Combine millions and millions of these transistors in various ways and you get your standard general purpose binary (i.e zeros and ones) computing device.

011010001110010101111 — You were saying?

So, you’ve got a whole load of transistors that spit out zeros and ones depending on whether you apply an electrical current or not…how do you turn that into something more useful? Two things are done to produce computers that do stuff:

  1. Different combinations of zeros and ones are designated as commands or instructions that do various things; and
  2. Different combinations of transistors are combined together to execute these instructions and produce the desired results.

For all of this to work, transistors are combined into seven simple “logic gates” which are used as the basic building blocks for electronic “decision making”. They operate by interpreting one or two electrical input signals (which can either be on or off — one or zero) to produce one defined output based on some internal logic. These seven simple logic gates are AND, OR, XOR, NOT, NAND, NOR and XNOR:

The seven basic logic gates

Combining these logic gates in various ways makes it possible to design and implement very complex decision engines which can execute the various Instruction Sets that make computers function. Exactly how this is done is beyond the scope of this article, but a little imagination, the basic information here and lots of Googling should help you fill in the gaps. Hopefully, you won’t look at computers in the same way again.

Yet another thing I learnt in “Programming School”.

In “Part 2”, I talk about what I’ve learned about the basics of software development.

— OAK

--

--