Definitions Assignment

Introduction

Hello Marksmen,

Here is my attempt to solve this assignment. It basically involves three explanations of a technical term from my area of studies, and for that I chose “boolean variables”. Every programmer encounters boolean variables at an early stage in their software development years, so I decided it should be a good idea to include an explanation of them.

Parenthetical

Boolean variable (a variable that can hold values of either true or false)

Sentence

A boolean variable is a data type that acts like a light switch that can be on (true) or off (false).

Expanded

History & Etymology

Boolean variables take their name from the English logician George Boole, who invented a system of logic in the 19th century. ALGOL 60 (built in 1960) was one of the first programming languages to ever implement the idea of a boolean variable. From then on, various other languages adopted this idea and so in 1995, for instance, Java included this data type in their architecture. Nowadays, Java has not only boolean primitive variables but also Boolean Objects, which can also hold the value of Null. Hence, such an object can be said to operate on a ternary logic (because there are 3 possible values that it can hold: true, false, or Null).

Operating Principle

Usually a boolean can be seen in conditional statements, which control the flow of execution of a program. However, there are cases in which local boolean variables are declared by some complex boolean logic conditions, involving function calls, logical operators (such as >, <, ==). All of the operators specified previously are binary in the sense that they take two arguments, and they return a boolean value. The “==” operator is used in various languages to test equality of two primitive data types or it can be also used to test if two objects are exactly the same instance.

Example

One example of a boolean variable usage is when one has to keep track of whether the battery of a phone is charging or not. In that case, they would use a variable such as isBatteryCharging, and whenever the phone would be charging this variable would set to true, and it would be false otherwise. The first picture below illustrates the analogy between a boolean variable and a light switch, while the second picture shows the symbol used for a battery that is charging (for which we can keep track of using a boolean variable).

Works cited

Wikipedia, “Boolean Data Type”, https://en.wikipedia.org/wiki/Boolean_data_type

Leave a Reply

Your email address will not be published. Required fields are marked *

*