Saturday, December 24, 1994

Turtle Traffic Jams, OOP, C++, and the Internet

This article appears in slightly different form in the November/December 1994 issue of IEEE Micro © 1994 IEEE.

Decentralization

The concept of decentralization ties together the three seemingly unrelated subjects in this column. The book by Mitchel Resnick talks about a widespread movement toward decentralization and away from the "centralized mindset" in governments, companies, technologies, scientific models, and even in theories of mind and knowledge.

The two examples I picked to explore this idea further are the Internet and object-oriented programming (OOP). I have been inundated by books and software in these two areas, because everyone seems to have decided that they are "hot." To me they seem to provide good examples of the advantages and pitfalls of decentralization.

Turtles, Termites, and Traffic Jams--Explorations in Massively Parallel Microworlds by Mitchel Resnick (MIT, Cambridge, 1994, 163pp, ISBN 0-262-18162-2, (800) 356-0343, $24.95)

This book is deceptively simple. Its ostensible purpose is to describe the author's Logo-inspired tool for investigating massively parallel systems. Resnick's StarLogo replaces Logo's small number of turtles with hordes of ants, termites, birds, automobiles, or whatever you like. He replaces Logo's passive drawing surface with a large grid of environmental patches, capable of interacting with the ants and the chemicals the ants can exude.

Resnick devotes most of this thin book to his implementation of StarLogo and his grade-school subjects' investigations of traffic jams, bird formations, and slime molds.

A few pages of philosophical observations distinguish the book from an ordinary research report. Those observations make the book essential reading for anyone who cares about where we are and where we're going.

Resnick sees a paradigm shift going on all around us. From the fall of the Soviet Union to Dennett's theory of consciousness (Micro Review, April 92), the "centralized mindset" is crumbling. Systems don't need a controlling intelligence to achieve purposeful behavior. No leader directs birds to fly in formation or ants to form trails from their nests to food sources. Instead, large numbers of independent entities, each following simple rules, produce the large scale patterns that we observe.

Resnick calls such systems self organizing. They aren't hard to understand, but you can't do it until you break free of your centralized mindset. The StarLogo language is a tool for studying self-organizing systems and developing an intuitive grasp of the new paradigm. 

OOP and C++

In systems design, decentralization gives rise to object-oriented programming. That methodology calls for simple, self-contained modules that provide services to one another without revealing details of their inner structures or implementations. Like the ideas in Mitchel Resnick's book, the ideas behind OOP are simple, but require you to let go of an ingrained mindset.

In July 94, in conjunction with the Object World conference in San Francisco, the Modus Ensemble presented the play An Object Orientation by Timothy O'Brien. I'm not sure it was great theatre, but it did a good job of personalizing the old and new mindsets. I enjoyed it. It only ran for two weeks, but if it's ever revived at a theatre near you, you might enjoy it too.

C++ is to OOP what the 486 is to personal computers. It may not be the best conceivable tool for the job, but its widespread use and its deliberate compatibility with the C language make it the tool of choice for most new OOP projects.

I've recently received more than 20 books on C++. Several are from Addison-Wesley, which has the best and most authoritative line of C++ books.

The C++ Programming Language, 2nd ed by Bjarne Stroustrup (Addison-Wesley, (800) 238-9682, 1994, 702pp, ISBN 0-201-53992-6)

This is C++ from the horse's mouth. Stroustrup designed C++ and has guided its evolution over the seven years of its general public use. While many books can describe or teach the features of C++, this one is the best source of insight into the thinking behind it.


Effective C++ -- Fifty Specific Ways to Improve Your Programs and Designs by Scott Meyers (Addison-Wesley, (800) 238-9682, 1992, 224pp, ISBN 0-201-56364-9, $25.75)

When I was learning to play chess many years ago, I read a book by Fred Reinfeld called Chess Traps, Pitfalls, and Swindles. I think Meyers should call his book C++ Traps, Pitfalls, and Swindles.

This book arises from Meyers' experience training C++ programmers. Its roots are the problems and the conceptual blocks that real students encounter as they try to use the language. According to Meyers:

"Used without discipline C++ can lead to code that is incomprehensible, unmaintainable, inextensible, inefficient, and just plain wrong. The trick is to discover those aspects of C++ that are likely to trip you up and to learn how to avoid them."

Meyers presents fifty independent essays, averaging about 4 pages long, and grouped into seven broad categories. You can read the book cover to cover in a single sitting or pick it up from time to time and read individual essays in any order. Either way you're guaranteed to find many useful tips.

You can look at this book two ways. From one point of view it is an enormously helpful compendium of practical advice on C++ programming. From another point of view it is point-by-point condemnation of C++ as an unusable, unintuitive programming language. Whichever point of view you prefer, Meyers' book is an essential part of any C++ programmer's library.

The Internet

You can't find a better or more relevant example of a decentralized self-organizing system than the Internet. This loose electronic interconnection of millions of computer users has no central authority or global rules. Its global patterns arise from individual decisions and local rules.

The subject is too vast to cover here. Options for connecting to the internet have proliferated. Ways of navigating around it have become easier. Most important, access from your personal computer has become practical.

Many computer users have no access to the internet through a large company's computer system, and even those who have such access can't spend large amounts of company time exploring everything the internet has to offer. Many people nowadays come home from work, turn on their computers, and hop on the mass transit system of the global village.

Even experienced computer users are bewildered by the multitude of ways they can get to the internet from their personal computers. The simplest are services like CompuServe, Delphi and America Online. The most complicated and expensive is turning your personal computer into an internet site with its own address and a dedicated phone line. In between are dialups to remote computers or service providers, using either ordinary serial communications or more robust methods like the serial line interface protocol (SLIP) or its successor, the point-to-point (PPP) protocol.

You need a guide to all of this, and a large number of guides and kits have appeared. Once you're connected the internet will give you free access to more information and assistance than you'll ever be able to use.