The most Powerful two letter Word in the World by@Mozfet

The most Powerful two letter Word in the World

image
Wynand Vermeulen HackerNoon profile picture

Wynand Vermeulen

Cross Platform Full Stack Developer, Payments and Security Expert, Entrepreneur.

This word represents the laws of cause and effect that guide the universe and all life. It is a tiny word that does nothing on its own but is defined entirely by its context. No other word carries as much power packed into two letters than the word IF.

IF Donald Trump pushes a big red button on his desk, a nuclear missile launches. IF you commit murder, you go to jail. IF you have sugar in your urine, you (probably) have Diabetes. IF you have no money, you go bankrupt. IF you choose the red pill, you reveal the Matrix. IF you enjoy reading this, you will like and share it on social media. :)

IF is used in all aspects of Language, Mathematics, Science, Law, Business, Health, Finance, Politics, Sport, and even human Emotion. I think the reason that IF is only a two letter word, is because we use it so much.

Our parents teach us the universal laws of cause and effect from a young age: IF you eat your broccoli, you can have ice cream. Even wild animals instinctively know cause and effect: IF you see a predator, run.

After 20 years of designing digital systems and developing software, I am a master of using IF in computer programming. But it is quite easy for anyone to be an expert in all aspects of the power of IF, without having to be a software coder.

Image Source — infografx / 123RF Stockfotos

In this writing, I’m going to make you a master of the most powerful two letters in the world. We are going to travel from the bottom up, from Boolean Algebra to Electronics, to Low-Level Programming, to High-Level Programming, to Software Modelling, to Minecraft, and even on to Human Relationships, exploring all the forms of IF.

Binary Mathematics

At the beginning of my tertiary studies, I was studying Electrical Engineering and attending my first Digital Systems class at University. I was still recovering from my hangover from a campus party the night before when our lecturer entered the classroom to find the chaos of students that precedes most university lectures.

He stood in the front of the class and patiently waited for us to start paying attention, which took a while… but once there was silence, he delayed some more, just looking at us, and then calmly started our semester with an epic and well-articulated statement that I will never forget:

“In the beginning, there was nothing, and there was something.”

He then proceeded to write the numbers one and zero with chalk on the blackboard and told the class that these two numbers were all we are going to learn about the entire semester.

And he was not kidding, we spent the entire semester covering number systems and binary logic for ones and zeros, there is a lot more to them than meets the eye. In the binary number system, there are only two numbers, one and zero, true and false, the basis of everything digital.

The most basic logic functions are the NOT, AND and OR gates.

  • IF something is FALSE, then it is NOT TRUE.
  • IF some OR another value is TRUE, the result is TRUE.
  • IF some AND another value is TRUE, the result is TRUE.

Here is a diagram with the 3 most basic logic gate symbols and truth tables.

Image Source — https://vicgrout.files.wordpress.com

Using deductive reasoning, an algorithmic IF can be constructed from logic.

  • Because TRUE AND TRUE equals TRUE, using TRUE and AND, an unknown value can be tested for being TRUE.
  • Because FALSE OR TRUE equals TRUE, using FALSE and OR, an unknown VALUE can be tested for being TRUE.

I admit that I was suffering during my class in my hungover state, however, the information was presented so simply that I managed to follow; in fact, it felt like I already knew all of this, and I did because all humans know this, it is part of our genetic makeup.

Boolean Algebra is the universal law of cause and effect, expressed as the mathematics of ones and zeros. At their core, all software programs are essentially decision trees that are the result of deeply nested IF statements.

Electronic Logic

Image Source — Wikipedia — History of the Transistor

In electronics, resistor-transistor logic is used to build logic gates in direct current applications. Typically, ZERO is represented by 0 Volt and TRUE by 5 Volt.

Transistors have physical properties that, when you apply a high enough positive voltage at the base of an (NPN) transistor, it allows current to flow from the collector to the emitter. Resistors have physical properties that cause a voltage drop when current flows through it (Ohms Law).

Here is an an example a circuit diagram for an AND gate.

Image Source — electronics-tutorials.ws

The detailed theory of electronics and semiconductors and resistor-transistor logic and how they work is a very large volume of information and is not covered here.

Electronic Algorithms

By combining lots of electronic logic gates, mathematical functions such as addition, subtraction, multiplication, and division can be constructed.

An Algorithmic Logic Unit (ALU) is a complex structure of electronic logic gates, that provide frequently used calculations, as used by software programs.

Every Central Processing Unit (CPU) which is present in all types of computers and devices, contains an ALU to provide a collection of algorithms that are exposed to software programs executed on the CPU.

CPUs are also massive networks of logic gates but have the purpose of processing instructions and moving data between internal components, such as the ALU and external components, such as hard drives and Random Access Memory (RAM).

Image Source — thebeginnerspoint.com

CPUs and the software programs that are used to control them are the electronic foundation that powers all computer software and networks.

Low-Level Programming

In programming, an IF statement is specified with three parts:

  • EXPRESSION (the test to determine what to do next)
  • THEN (what to do when EXPRESSION is TRUE)
  • ELSE (what to when EXPRESSION is FALSE).

Note that ELSE is optional because the outcome can also be to do nothing.

In machine language inside the CPU, it’s all ones and zeros and is not suited for humans to work with directly, so I will not cover it here, and instead, I will jump to the lowest level of programming suited to humans, which is assembly.

Image Source — microchip.com

Using the assembly instruction set of a simple Microchip 8-bit PIC16F84 micro-controller, IF looks like this:

1: BTFSS FLAGS, 3
2: BSF PORTB, 0
3: BCF PORTB, 0

The Plain English equivalent of this is: If Bit 3 of FLAGS register is set, THEN set Bit 0 of the PORTB, ELSE clear Bit 0 of PORT B. Where:

  • BTFSS = Bit Test File (Register, Bit) Skip (IF) Set
  • FLAGS = The name of an address of 1 byte of RAM memory
  • BSF = Bit Set File (Register, Bit)
  • PORT B = The register connected to the output port (pins) of the chip to power or communicate with external electronic components, such as an LED.

These 3 instructions check the third bit in a register that is named FLAGS to see if it is TRUE. IF TRUE, output Pin 0 of the Chip’s B Port is set to 5V, ELSE it is set to 0V. If an LED is connected on to the output pin, it would turn the LED on or off based on the value of the flag.

The CPU processes each instruction one by one, using their position in persistent memory, and in this (hypothetical) example RAM memory locations 1–3 — where the instruction at address 1 contains the IF and the EXPRESSION, the instruction at address 2 contains the THEN, and the instruction at address 3 contains the ELSE.

Assembly directly resembles machine code and requires a detailed understanding of how the CPU works. It is difficult to read and write, and easy to make mistakes, and thus over time, higher level programming languages evolved to make it simpler for people to use.

High-Level Programming

High-Level programming languages are designed to make programming easier for humans. The human code is compiled into machine code before being sent to the CPU.

Image Source — Wikipedia — Java Programming Language

In Java, JavaScript, C/C++/C#, the IF operation looks like this:

if (someValue === true)
doSomething()
else
doSomethingElse()

This is much easier to understand than assembly, even if you have never seen computer code before. The Plain English equivalent is: IF some value is true THEN do something, ELSE do something else.

Software Modelling

Software Modelling is the design of software applications. Unified Modeling Language (UMLTM) is a widely used international diagram standard for designing software and processes.

The UML Activity Diagram (aka Flowchart) includes Decision Nodes that represent IF visually as a diamond (as below), with one input and two or more outputs.

Image Source — infografx / 123RF Stockfotos

Computer Gaming

In Minecraft, the popular computer game, IF can be constructed by the player in a virtual world, using square blocks and by constructing gates using Redstone.

Image Source — Wikipedia — Minecraft

Redstone makes automation possible within Minecraft. It can be used for controlling pistons and doors and lights and used extensively in automatic farming, traps, controlling railroads, and controlling various aspects of your base.

Redstone changes conductive behavior, based on the position of the block it is placed on. There is a simple, yet not always intuitive way that signals flow using Redstone. Here is a video where I try to explain the basics of binary logic using Redstone in Minecraft.

Redstone Logic In Minecraft

Human Relations

In human language, as used within a business relationship, IF is often expressed as a condition for doing something as part of an agreement. IF you give me $1000 per month, you can rent the apartment.

Image Source — oneinchpunch / 123RF Stock Photo

IF can often be found in personal relationships. IF you cook tonight, I will wash the dishes. IF you love me, you will… well, umm… perhaps it’s best to draw from your personal experiences here.

So far so good. This is sufficient to cover all the practical theory behind the classical IF. IF only it were that simple, THEN you could stop reading now…

Nested IF

It is important to note that the classical IF programming statement only performs one test to determine one of two outcomes, THEN (what to do when the EXPRESSION is TRUE) and ELSE (what to do when the EXPRESSION is FALSE).

In practice, however, a single IF is usually not enough to solve complex problems and multiple nested and/or sequential IFs may be needed to determine an outcome or flow. In high-level computer languages, the IF operation also has some advanced forms of IF such as the SWITCH and the BRANCH.

The SWITCH operation is an IF-ELSE chain with tests for literal values, such as numbers and strings, and the BRANCH operation is an IF-ELSE chain with truth tests for multiple expressions.

Image Source — Flowchart created on Gliffy

After years of developing software, I have concluded that the BRANCH is the most useful and universal conditional logic pattern. The reason is that BRANCH supports Literal Values as well as Expressions and can have more than two outcomes, yet can still function as a simple IF as well as a SWITCH.

Image Source — Flowchart created on Gliffy

Once you understand how a BRANCH works, you will quickly realize how you can construct any decision tree. Because of its utility, BRANCH was selected over simple IF as a core component of our drag and drop logic design language.

Image Source — Created on ExpertBox.com

While IF is the most powerful word in the world and BRANCH is its most universal pattern, it means nothing by itself other than indicating that conditions exist. Without EXPRESSIONS and LITERALS, there is no meaning.

It is the logic and nesting of the subject domain knowledge that gives the word IF its power, and with great power comes great responsibility. IF the logic is wrong, THEN the result is wrong.

In these times of Globalisation, Standardization, Regulation, and Automation, knowledge is becoming uniform and many professional roles in society, like Lawyers, Accountants, Doctors and Financial Advisors, will be partially or even entirely replaced by machines that are powered by IF and another mighty two-letter abbreviation AI (Artificial Intelligence).

IF you are a master of IF AND IF you are a professional in any structured knowledge domain, THEN you should consider automating your knowledge, ELSE an AI from a big multinational company might just take your job.

The Expert Box is a logic driven knowledge automation platform designed for knowledge workers and business process automation. Sign up for free and use your IF mastery to automate, monetize and share your knowledge.

This article was originally posted on ExpertBox.com

Wynand Vermeulen HackerNoon profile picture
by Wynand Vermeulen @Mozfet.Cross Platform Full Stack Developer, Payments and Security Expert, Entrepreneur.
Read my stories

Comments

Signup or Login to Join the Discussion

Tags

Related Stories