Mostrando entradas con la etiqueta Code. Mostrar todas las entradas
Mostrando entradas con la etiqueta Code. Mostrar todas las entradas

lunes, 28 de julio de 2008

From electricity to fiber optics.

Petzold's parting thoughts in Code are well worth noting here:
While much of this book has focused on using electricity to send signals and information through a wire, a more efficient medium is light transmitted through optical fiber —thin tubes made of glass or polymer that guide the light around corners. Light passing through such optical fibers can achieve data transmission rates in the gigahertz region —some billion of its per second.

So it seems that photons, not electrons, will be responsible for delivering much of the information of the future into our homes and offices; they'll be like faster dots and dashes of Morse code and those careful pulses of blinking light we once used to communicate late-night wisdom to our best friend across the way.

(Petzold: p. 382)

Yet, in spite of all these technological developments, the core of his book remains relevant. He tells us about the main concepts in electrical engineering in order to introduce us the key concepts of computer science without which we would miss the foundations of this particular discipline of knowledge. However, the concepts we learn along the way (rudimentary concepts of information, binary and hexadecimal languages, circuits, addressing memory, etc.) are still as valuable today as they were 20 years ago.

This is an excellent book. It's highly recommended to anyone who cares to know about how things work in the world of computing.

The limitations of backward compatibility and open architecture.

Petzold considers the problems of backward compatiblity:
Even before the introduction of the Macintosh, several companies had begun to create a graphical operating system for the IBM PC and compatibles. In one sense, the Apple developers had an easier job because they were designing the hardware and software together. The Macintosh system software had to support only one type of diskette drive, one type of video display, and two printers. Implementing a graphical operating system for the PC, however, required supporting many different pieces of hardware.

Moreover, although the IBM PC had been introduced just a few years earlier (in 1981), many people had grown accustomed to using their favorite MS-DOS applications and weren't ready to give them up. It was considered very important for a graphical operating system for the PC to run MS-DOS applications as well as applications designed expressly for the new operating system. (The Macintosh didn't run Apple II software primarily because it used a different microprocessor.)

(Petzold: pp. 371-372)


We're still dealing with this problem. Notice that both Linux and Windows have to support a vast array of hardware devices, which Apple doesn't have to worry about. When people talk about the smooth Apple experience, they are simply not comparing apples to apples —yeah, I know, bad pun. Additionally, in the case of Windows, the developers had to deal with backward compatibilty for MS-DOS apps until quite recently —was it Windows XP the first release that finally bropke away from it? Sure, that still doesn't change the reality that one product provides a better experience than the other, but it should definitely put things in perspective when what we discuss is the relative merits of the software developers involved in these projects.

VisiCalc: the beginning of a revolution.

A tiny little app made the whole difference in the world:
The first indication that home computers were going to be much different from their larger and more expensive cousins was probably the application VisiCalc. Designed and programmed by Dan Bricklin (born 1951) and Bob Frankston (born 1949) and introduced in 1979 for the Apple II, VisiCalc used the screen to give the user a two-dimensional view of a spreadsheet. Prior to VisiCalc, a spreadsheet (or worksheet) was a piece of paper with rows and columns generally used for doing series of calculations. VisiCalc replaced the paper with the video display, allowing the user to move around the spreadsheet, enter numbers and formulas, and recalculate everything after a change.

(Petzold: p. 366)

Who would have been able to tell at the time? But it tends to happen this way in different fields of life: an event that few people pay attention to at the very beginning is precisely the one that brings about huge changes. The developments that are welcomed as "revolutionary" —the projects that intend to be revolutionary from the get-go— don't always accomplish much. However, what was intended to be a small but innovative idea, something humble, something that didn't necessarily pretend to bring about any huge change is precisely what ends up turning things upside down very often. We have seen it with Linux too. In this case, VisiCalc made it clear that computers could be used by regular folks to perform their routine activities. As a matter of fact, they could help automate some of the more repetitive tasks and, more importantly, speed them up and make them almost totally reliable. That's what the introduction of the personal computer and these little apps changed. Computing was taken out of the university campus and the research centers, to be brought, first, to businesses and, later, to the home.

C as a high-level assembly language of sorts.

So, how come the C programming language is still so popular after all these years? How come there are so many people out there still using it for their projects? Petzold gives us a clue:
I mentioned earlier that most high-level languages don't include bit-shifting operations or Boolean operations on bits, which are features supported by many processors. C is the exception to this rule. In addition, an important feature of C is its support of pointers, which are essentially numeric memory addresses. Because C has operations that parallel many common processors instructions, C is sometimes categorized as a high-level assembly language. More than any ALGOL-like language, C closely mimics common processor instruction sets.

(Petzold: p. 363)

Simply put, it still is the best programming language for systems programming in general. If you need to do something really complex without resorting to assembly language (i.e., an operating system or a heavy application, for instance), C is still a safe bet. Which brings up another issue: what if you are not a programmer? Well, I'd say even if you are not involved in any systems programming at all, you are better off being fluent in C for most of the operating systems out there are written in that language. You will need it, if only to troubleshoot and understand whichever problem you may come across of while running your favorite OS. Let's face it: gaining a decent understanding of how computing works without knowing any C is pretty tough.

UNIX borrowed the hierarchical file system from MS-DOS?

Interesting statement:
The hierarchical file system -and some other features of MS-DOS 2.0- were borrowed from an operating system named UNIX, which was developed in the early 1970s at Bell Telephone Laboratories largely by Ken Thompson (born 1943) and Dennis Ritchie (born 1941). The funny name of the operating system is a play on words: UNIX was originally written as a less hardy version of an earlier operating system named Multics (which stands for Multiplexed Information and Computing Services) that Bell Labs had been codeveloping with MIT and GE.

(Petzold: p. 333)

UNIX borrowed the concept of a hierarchical file system from MS-DOS? Is he sure? As Petzold himself says, UNIX was developed in the early 1970s and MS-DOS didn't see the light until the 1980s. Was UNIX working without any file system until then? If it wasn't a hierarchical file system, what was it then? I find it quite difficult to believe that Petzold's statement is correct, especially since UNIX and a deeply hierarchical file system have come to be almost synonimous over the years, which cannot be said Microsoft's MS-DOS-derived products. When searching around, all I find is references to Apple's HFS —as, for example, in the link above—, but little or nothing about the general notion of a hierarchical file system. Was it then invented by Apple? No idea, but Petzold's statement sounds quite suspicious to me.

Open architecture and open standards.

By now we all know about the importance of open standards in computing and how those companies that bet on it in the early 1980s ended up winning the war over the home computer. However, at the time the wisdom of betting on open standards was far from obvious.
If you were designing a new computer system that included a new type of bus, you could choose whether to publish (or otherwise make available) the specifications of the bus or to keep then secret.

If the specifications of a particular bus are made public, other manufacturers —so-call third party manufacturers— can design and sell expansion boards that work with that bus. The availability of these additional expansion boards makes the computer more useful and hence desirable. More sales of the computer create more of a market for more expansion boards. This phenomenon is the incentive for designers of most small computer systems that adhere to the principle of open architecture, which allows other manufacturers to create peripherals for the computer. Eventually, a bus might be considered an industry-wide standard. Standards have been an important part of the personal computer industry.

The most famous open architecture personal computer was the original IBM PC introduced in the fall of 1981. IBM published a Technical Reference manual for the PC that contained complete circuit diagrams of the entire computer, including all expansion boards that IBM manufactured for it. This manual was an essential tool that enabled many manufacturers to make their own expansion boards for the PC and, in fact, to create entire clones of the PC —computers that were nearly identical to IBM's and ran all the same software.

The descendants of that original IBM PC now account for about 90 percent of the market in the desktop computers. Although IBM itself has only a small share of this market, it could very well be that IBM's share is larger than if the original PC had a closed architecture with a proprietary design. The Apple Macintosh was originally designed with a closed architecture, and despite occasional flirtations with open architecture, that original decision possibly explains why the Macintosh currently accounts for less than 10 percent of the desktop market. (Keep in mind that whether a computer system is designed under the principle of open architecture or closed architecture doesn't affect the ability of other companies to write software that runs on the computer. Only the manufacturers of certain video games have restricted other companies from writing software for their systems.)

(Petzold: pp. 302-303)

Sure, we all know who was right. However, we also know that Apple has come back to life and become, once more, one of the most innovative companies in the business. Not only that, but few people would doubt that the main reason why they could afford this level of creativity is precisely because they control both the software and the hardware. It's part of the Apple experience that guarantees a smooth transition between products and a near-perfect compatibility between two different Apple devices.

Likewise, we also saw at the end of the 1990s the appearance of a new disruptive phenomenon: the open source movement. Where open standards applied mainly to hardware specs in the past —and Microsoft benefitted a lot from it—, Linux and other projects tried to spread the same philosophy now to the software world too. That's precisely why the moaning about the supposedly Communistic threat coming from the open source world that we hear from Microsoft's top execs from time to time is so self-serving. After all, they are the first ones who benefitted from IBM's decision not to play dirty and share the specs.

In any case, few people doubt that without these open standards the Internet wouldn't exist today and there is a good chance technology wouldn't play such a central role in our societies. It's precisely the adoption of open standards and protocols that made it possible for all this software craze to spread throughout the world in the 1990s.

Subtracting without borrowing.

Petzold's book is full of excellent morsels of computer wisdom... as well as useful tips on mathematics. For example, while discussing the complexities of carrying out addition and subtraction operations on a computer, he shares with us a method to perform subtractions without borrowing (pp. 143-145):
  1. Subtract the subtrahend from a number that has as many nines as digits the numbers in the subtraction have (e.g. if the largest number in the operation is 176, you subtract that number from 999; if it is 3456, you subtract that number from 9999). This results in the nines' complement.
  2. Add the result to the original minuend.
  3. Finally, add 1 and subtract 1000.
For example, imagine we have to subtract 129 from 216. First of all, we subtract 129 from 999, which results in 870. Then, we add this result to the original minuend (e.g., 216), which gives us 1086. Finally, we add 1 (resulting in 1087) and subtract 1000, which gives us a total of 87. Now, all this is time consuming for a human being, but easier and faster to perform for a machine, and indeed that is how things work inside some of the machines we often use.

martes, 22 de julio de 2008

Boolean algebra as the language of the brain.

Petzold's book is a true gem. Its aim is to introduce us to all the main theories underlying the discipline of Computer Science, at least in a very basic manner. However, along the way it also displays some magnificent examples of philosophical musings about technology and the world of computing, such as the following comments about Boolean algebra:
The title of Boole's 1854 book [An Investigation on the Laws of Thought, on Which are Founded the Mathematical Theories of Logic and Probabilities] suggests an ambitious motivation: Because the rational human brain uses logic to think, if we were to find a way in which logic can be represented by mathematics, we would also have a mathematical description of how the brain works. Of course, nowadays this view of the mind seems to us quite naive. (Either that or it's way ahead of its time.)

(Petzold: p. 87)

Sure, it sounds like just one more far-fetched attempt to uncover the deep secrets of the human brain —one of many more designed by ambitious thinkers throughout the centuries— but, let's be fair, without people like Boole our world wouldn't be what it is today. The development of our civilization as a whole depends on crazy projects like this.

lunes, 14 de julio de 2008

Code: The Hidden Language of Computer Hardware and Software.

Petzold introduces us to the inner workings of computers (both in regards to hardware and software) without a need to resort to overly complex concepts for the initiated. As a matter of fact, he starts with a brief explanation of what is code and uses both Morse code and Braille to illustrate it.

The author also maintains an errata on his own website.

Technical description:
Title: Code. The Hidden Language of Computer Hardware and Software.
Author: Charles Petzold.
Publisher: Microsoft Press.
Edition: Redmond (USA), 1999.
Pages: 392 pages, including indexes.
ISBN: 0-7356-0505-X