Code the hidden language.., p.3

Code: The Hidden Language of Computer Hardware and Software, 2nd Edition, page 3

 

Code: The Hidden Language of Computer Hardware and Software, 2nd Edition
Select Voice:
Brian (uk)
Emma (uk)  
Amy (uk)
Eric (us)
Ivy (us)
Joey (us)
Salli (us)  
Justin (us)
Jennifer (us)  
Kimberly (us)  
Kendra (us)
Russell (au)
Nicole (au)



Larger Font   Reset Font Size   Smaller Font  
What I’ll do in this chapter is dissect the Braille code and show you how it works. You don’t have to actually learn Braille or memorize anything. The sole purpose of this exercise is to get some additional insight into the nature of codes.

  In Braille, every symbol used in normal written language—specifically, letters, numbers, and punctuation marks—is encoded as one or more raised dots within a two-by-three cell. The dots of the cell are commonly numbered 1 through 6:

  Special typewriters were developed to emboss the Braille dots into the paper, and these days, computer-driven embossers do the job.

  Because embossing in Braille just a couple of pages of this book would be prohibitively expensive, I’ve used a notation common for showing Braille on the printed page. In this notation, all six dots in the cell are shown. Large dots indicate the parts of the cell where the paper is raised. Small dots indicate the parts of the cell that are flat. For example, in the Braille character

  dots 1, 3, and 5 are raised and dots 2, 4, and 6 are not.

  What should be interesting to us at this point is that the dots are binary. A particular dot is either flat or raised. That means we can apply what we’ve learned about Morse code and binary combinations to Braille. We know that there are six dots and that each dot can be either flat or raised, so the total number of combinations of six flat and raised dots is 2 × 2 × 2 × 2 × 2 × 2, or 26, or 64.

  Thus, the system of Braille is capable of representing 64 unique codes. Here they are—all 64 of them:

  It’s not necessary for all 64 codes to be used in Braille, but 64 is definitely the upper limit imposed by the six-dot pattern.

  To begin dissecting the code of Braille, let’s look at the basic lowercase alphabet:

  For example, the phrase “you and me” in Braille looks like this:

  Notice that the cells for each letter within a word are separated by a little bit of space; a larger space (essentially a cell with no raised dots) is used between words.

  This is the basis of Braille as Louis Braille devised it, or at least as it applies to the letters of the Latin alphabet. Louis Braille also devised codes for letters with accent marks, common in French. Notice that there’s no code for w, which isn’t used in classical French. (Don’t worry. The letter will show up eventually.) At this point, only 25 of the 64 possible codes have been accounted for.

  Upon close examination, you’ll discover a pattern in the Braille codes for the 25 lowercase letters. The first row (letters a through j) uses only the top four spots in the cell—dots 1, 2, 4, and 5. The second row (letters k through t) duplicates the first row except that dot 3 is also raised. The third row (u through z) is the same except that dots 3 and 6 are raised.

  Louis Braille originally designed his system to be punched by hand. He knew this would likely not be very precise, so he cleverly defined the 25 lowercase letters in a way that reduces ambiguity. For example, of the 64 possible Braille codes, six have one raised dot. But only one of these is used for lowercase letters, specifically for the letter a. Four of the 64 codes have two adjacent vertical dots, but again only one is used, for the letter b. Three codes have two adjacent horizontal dots, but only one is used, for c.

  What Louis Braille really defined is a collection of unique shapes that could be shifted a little on the page and still mean the same thing. An a is one raised dot, a b is two vertically adjacent dots, a c is two horizontally adjacent dots, and so on.

  Codes are often susceptible to errors. An error that occurs as a code is written (for example, when a student of Braille marks dots in paper) is called an encoding error. An error made reading the code is called a decoding error. In addition, there can also be transmission errors—for example, when a page containing Braille is damaged in some way.

  More sophisticated codes often incorporate various types of built-in error correction. In this sense, Braille as originally defined by Louis Braille is a sophisticated coding system: It uses redundancy to allow a little imprecision in the punching and reading of the dots.

  Since the days of Louis Braille, the Braille code has been expanded in various ways, including systems to notate mathematics and music. Currently the system used most often in published English text is called Grade 2 Braille. Grade 2 Braille uses many contractions in order to use less paper and to speed reading. For example, if letter codes appear by themselves, they stand for common words. The following three rows (including a “completed” third row) show these word codes:

  Thus, the phrase “you and me” can be written in Grade 2 Braille as this:

  So far, I’ve described 31 codes—the no-raised-dots space between words and the three rows of ten codes for letters and words. We’re still not close to the 64 codes that are theoretically available. In Grade 2 Braille, as we shall see, nothing is wasted.

  The codes for letters a through j can be combined with a raised dot 6. These are used mostly for contractions of letters within words and also include w and another word abbreviation:

  For example, the word “about” can be written in Grade 2 Braille this way:

  The next step introduces some potential ambiguity absent in Louis Braille’s original formulation. The codes for letters a through j can also be effectively lowered to use only dots 2, 3, 5, and 6. These codes represent some punctuation marks and contractions, depending on context:

  The first four of these codes are the comma, semicolon, colon, and period. Notice that the same code is used for both left and right parentheses but that two different codes are used for open and closed quotation marks. Because these codes might be mistaken for the letters a through j, they only make sense in a larger context amidst other letters.

  We’re up to 51 codes so far. The following six codes use various unused combinations of dots 3, 4, 5, and 6 to represent contractions and some additional punctuation:

  The code for “ble” is very important because when it’s not part of a word, it means that the codes that follow should be interpreted as numbers. These number codes are the same as those for letters a through j:

  Thus, this sequence of codes

  means the number 256.

  If you’ve been keeping track, we need seven more codes to reach the maximum of 64. Here they are:

  The first (a raised dot 4) is used as an accent indicator. The others are used as prefixes for some contractions and also for some other purposes: When dots 4 and 6 are raised (the fifth code in this row), the code is a numeric decimal point or an emphasis indicator, depending on context. When dots 5 and 6 are raised (the sixth code), it’s a letter indicator that counterbalances a number indicator.

  And finally (if you’ve been wondering how Braille encodes capital letters) we have dot 6—the capital indicator. This indicates that the letter that follows is uppercase. For example, we can write the name of the original creator of this system as

  This sequence begins with a capital indicator, followed by the letter l, the contraction ou, the letters i and s, a space, another capital indicator, and the letters b, r, a, i, l, l, and e. (In actual use, the name might be abbreviated even more by eliminating the last two letters, which aren’t pronounced, or by spelling it “brl.”)

  In summary, we’ve seen how six binary elements (the dots) yield 64 possible codes and no more. It just so happens that many of these 64 codes perform double duty depending on their context. Of particular interest is the number indicator along with the letter indicator that undoes the number indicator. These codes alter the meaning of the codes that follow them—from letters to numbers and from numbers back to letters. Codes such as these are often called precedence, or shift, codes. They alter the meaning of all subsequent codes until the shift is undone.

  A shift code is similar to holding down the Shift key on a computer keyboard, and it’s so named because the equivalent key on old typewriters mechanically shifted the mechanism to type uppercase letters.

  The Braille capital indicator means that the following letter (and only the following letter) should be uppercase rather than lowercase. A code such as this is known as an escape code. Escape codes let you “escape” from the normal interpretation of a code and interpret it differently. Shift codes and escape codes are common when written languages are represented by binary codes, but they can introduce complexities because individual codes can’t be interpreted on their own without knowing what codes came before.

  As early as 1855, some advocates of Braille began expanding the system with another row of two dots. Eight-dot Braille has been used for some special purposes, such as music, stenography, and Japanese kanji characters. Because it increases the number of unique codes to 28, or 256, it’s also been convenient in some computer applications, allowing lowercase and uppercase letters, numbers, and punctuation to all have their own unique codes without the annoyances of shift and escape codes.

  Chapter Four

  Anatomy of a Flashlight

  Flashlights are useful for numerous tasks, of which reading under the covers and sending coded messages are only the two most obvious. The common household flashlight can also take center stage in an educational show-and-tell of the ubiquitous stuff known as electricity.

  Electricity is an amazing phenomenon, managing to be pervasively useful while remaining largely mysterious, even to people who pretend to know how it works. Fortunately, we need to understand only a few basic concepts to comprehend how electricity is used inside computers.

  The flashlight is certainly one of the simpler electrical appliances found in most homes. Disassemble a typical flashlight and you’ll find that it consists of one or more batteries, a lightbulb, a switch, some metal pieces, and a case to hold everything together.

  These days, most flashlights use light-emitting diodes (LEDs), but one advantage of more retro lightbulbs is that you can see inside the glass bulb:

  This is known as an incandescent lightbulb. Most Americans believe that the incandescent lightbulb was invented by Thomas Edison, while the British are quite certain that Joseph Swan was responsible. In truth, many other scientists and inventors made crucial strides before either Edison or Swan got involved.

  Inside the bulb is a filament made of tungsten, which glows when electricity is applied. The bulb is filled with an inert gas to prevent the tungsten from burning up when it gets hot. The two ends of that filament are connected to thin wires that are attached to the tubular base of the lightbulb and to the tip at the bottom.

  You can make your own no-frills flashlight by disposing of everything except the batteries and the lightbulb. You’ll also need some short pieces of insulated wire (with the insulation stripped from the ends) and enough hands to hold everything together:

  Notice the two loose ends of the wires at the right of the diagram. That’s our switch. Assuming that the batteries are good and the bulb isn’t burned out, touching these loose ends together will turn on the light:

  This book uses the color red to indicate that electricity is flowing through the wires and lighting up the lightbulb.

  What we’ve constructed here is a simple electrical circuit, and the first thing to notice is that a circuit is a circle. The lightbulb will light up only if the path from the batteries to the wire to the bulb to the switch and back to the batteries is continuous. Any break in this circuit will cause the bulb to go out. The purpose of the switch is to control this process.

  The circular nature of the electrical circuit suggests that something is moving around the circuit, perhaps like water flowing through pipes. The “water and pipes” analogy is quite common in explanations of how electricity works, but eventually it breaks down, as all analogies must. Electricity is like nothing else in this universe, and we must confront it on its own terms.

  One approach to understanding the workings of electricity is called the electron theory, which explains electricity as the movement of electrons.

  As we know, all matter—the stuff that we can see and feel (usually)—is made up of extremely small things called atoms. Every atom is composed of three types of particles; these are called neutrons, protons, and electrons. Sometimes an atom is depicted as a little solar system, with the neutrons and protons bound into a nucleus and the electrons spinning around the nucleus like planets around a sun, but that’s an obsolete model.

  The number of electrons in an atom is usually the same as the number of protons. But in certain circumstances, electrons can be dislodged from atoms. That’s how electricity happens.

  The words electron and electricity both derive from the ancient Greek word ηλεκτρον (elektron), which oddly is the Greek word for “amber,” the glasslike hardened sap of trees. The reason for this unlikely derivation is that the ancient Greeks experimented with rubbing amber with wool, which produces something we now call static electricity. Rubbing wool on amber causes the wool to pick up electrons from the amber. The wool winds up with more electrons than protons, and the amber ends up with fewer electrons than protons. In more modern experiments, carpeting picks up electrons from the soles of our shoes.

  Protons and electrons have a characteristic called charge. Protons are said to have a positive (+) charge and electrons are said to have a negative (−) charge, but the symbols don’t mean plus and minus in the arithmetical sense, or that protons have something that electrons don’t. The + and − symbols indicate simply that protons and electrons are opposite in some way. This opposite characteristic manifests itself in how protons and electrons relate to each other.

  Protons and electrons are happiest and most stable when they exist together in equal numbers. An imbalance of protons and electrons will attempt to correct itself. When the carpet picks up electrons from your shoes, eventually everything gets evened out when you touch something and feel a spark. That spark of static electricity is the movement of electrons by a rather circuitous route from the carpet through your body and back to your shoes.

  Static electricity isn’t limited to the little sparks produced by fingers touching doorknobs. During storms, the bottoms of clouds accumulate electrons while the tops of clouds lose electrons; eventually, the imbalance is evened out with a bolt of lightning. Lightning is a lot of electrons moving very quickly from one spot to another.

  The electricity in the flashlight circuit is obviously much better mannered than a spark or a lightning bolt. The light burns steadily and continuously because the electrons aren’t just jumping from one place to another. As one atom in the circuit loses an electron to another atom nearby, it grabs another electron from an adjacent atom, which grabs an electron from another adjacent atom, and so on. The electricity in the circuit is the passage of electrons from atom to atom.

  This doesn’t happen all by itself. We can’t just wire up any old bunch of stuff and expect some electricity to happen. We need something to precipitate the movement of electrons around the circuit. Looking back at our diagram of the no-frills flashlight, we can safely assume that the thing that begins the movement of electricity is not the wires and not the lightbulb, so it’s probably the batteries.

  The batteries used in flashlights are usually cylindrical and labeled D, C, A, AA, or AAA depending on the size. The flat end of the battery is labeled with a minus sign (−); the other end has a little protrusion labeled with a plus sign (+).

  Batteries generate electricity through a chemical reaction. The chemicals in batteries are chosen so that the reactions between them generate spare electrons on the side of the battery marked with a minus sign (called the negative terminal, or anode) and demand extra electrons on the other side of the battery (the positive terminal, or cathode). In this way, chemical energy is converted to electrical energy.

  The batteries used in flashlights generate about 1.5 volts of electricity. I’ll discuss what this means shortly.

  The chemical reaction can’t proceed unless there’s some way that the extra electrons can be taken away from the negative terminal of the battery and delivered back to the positive terminal. This occurs with an electrical circuit that connects the two terminals. The electrons travel around this circuit in a counterclockwise direction:

  Electrons from the chemicals in the batteries might not so freely mingle with the electrons in the copper wires if not for a simple fact: All electrons, wherever they’re found, are identical. There’s nothing that distinguishes a copper electron from any other electron.

  Notice that both batteries are facing the same direction. The positive end of the bottom battery takes electrons from the negative end of the top battery. It’s as if the two batteries have been combined into one larger battery with a positive terminal at one end and a negative terminal at the other end. The combined battery is 3 volts rather than 1.5 volts.

  If we turn one of the batteries upside down, the circuit won’t work:

  The two positive ends of the battery need electrons for the chemical reactions, but there’s no way electrons can get to them because they’re attached to each other. If the two positive ends of the battery are connected, the two negative ends should be also:

  This works. The batteries are said to be connected in parallel rather than in series as shown earlier. The combined voltage is 1.5 volts, which is the same as the voltage of each of the batteries. The light will probably still glow, but not as brightly as with two batteries in series. But the batteries will last twice as long.

  We normally like to think of a battery as providing electricity to a circuit. But we’ve seen that we can also think of a circuit as providing a way for a battery’s chemical reactions to take place. The circuit takes electrons away from the negative end of the battery and delivers them to the positive end of the battery. The reactions in the battery proceed until all the chemicals are exhausted, at which time you properly dispose of the battery or recharge it.

  From the negative end of the battery to the positive end of the battery, the electrons flow through the wires and the lightbulb. But why do we need the wires? Can’t the electricity just flow through the air? Well, yes and no. Yes, electricity can flow through air (particularly wet air), or else we wouldn’t see lightning. But electricity doesn’t flow through air very readily.

 

Add Fast Bookmark
Load Fast Bookmark
Turn Navi On
Turn Navi On
Turn Navi On
Scroll Up
Turn Navi On
Scroll
Turn Navi On
183