Friday, August 26, 2005

Multiple Inheritance And The "This"-Pointer

Excellent article on why using C++'s <dynamic_cast> is a good idea when casting multiple-inheritance instance pointers (this is true even if you derive from only one concrete class plus one or more pure virtual classes (=interfaces)). <dynamic_cast> is aware of the different vtable- and memberdata-offsets (due to runtime type information), and will move the casted pointer accordingly.

Some C++ developers tend to keep their C-style casting habits, which will introduce fatal flaws into their code. My recommendation: If you haven't done yet, get to know about the four C++ casting operators, and apply them accordingly. Developers should understand the memory layout of their data types. And what a vtable is. And what a compiler can do, and what not.

If still in doubt, use <dynamic_cast> - it's slower, but safe. Don't forget to check whether the cast was successful, though.

Thursday, August 18, 2005

How Bill Gates Outmaneuvered Gary Kildall

The History Of Computing Project provides plenty of information on companies and individuals who helped to shape today's computer industry. It includes historical anecdotes and timelines, e.g. a summary of Microsoft's history. What's missing in the 1980/1981 entries (dawn of the IBM PC and DOS) is the story how Bill Gates outmaneuvered Digital Research and Gary Kildall, then leading 8-bit OS vendor with their CP/M system. So here is a summary of what happened. I must have heard / read dozens of slightly different variations on this story over the years, so this outline of events should be pretty accurate:

Bill Gates
Gary Kildall



Back at that time, Microsoft provided programming languages (Basic, Fortran, Cobol and the like) for 8-bit machines, while the most-widespread operating system CP/M came from Digital Research. The two companies had an unspoken agreement on not raiding the other one's market. But Microsoft had licensed CP/M for a very successful hardware product at that time - the so called SoftCard for the Apple II. SoftCard contained a Zilog Z80 processor, and allowed Apple II owners to run CP/M and CP/M applications.

IBM - awakened by Apple's microcomputer success with the Apple II - approached Microsoft in search of an operating system and programming languages for their "Project Chess" = "Acorn" = "IBM PC" machine, which was to be a microcomputer based on open standards and off-the-self parts. Those off-the-self parts included Intel's 8088 CPU, a downsized 8086. One exception was the BIOS chip, which was reverse-engineered later by Compaq and others.

The legend goes that IBM's decision makers mistakenly thought CP/M originated from Microsoft, but that sounds doubtful. Anyway, Bill Gates told IBM they would have to talk to Digital Research, and even organized an appointment with Digital Research CEO Gary Kildall.

Kildall was a brilliant computer scientist, but probably missing the business instinct and restless ambition of Bill Gates. Some people say Gates didn't inform Kildall about who the prospective customer was, but only noted that "those guys are important", which might be plausible, as IBM was paranoid about anyone getting to know what they were doing. On the other hand, Gates himself once mentioned in an interview that Kildall knew it was IBM who was coming.

Digital Research's former headquarters, Pacific Grove, California
So the next day some IBM representatives, including IBM veteran Jack Sams, flew from Microsoft's office in Seattle to Pacific Grove, California, where Digital Research was located. When they arrived, Kildall was not there. While Gates later commented that "Gary went flying" (Kildall was a hobbyist pilot), truth is that Kildall had already another meeting scheduled and was visiting important customers, and flew his own plane to get there. Kildall's wife Dorothy McEwen and her lawyer fatally misjudged the situation in the meantime and declined to sign IBM's nondisclosure-agreement, so IBM left with empty hands. It should be noted that Gates had no problem signing a NDA.

Again, different versions exist about that part of the story - one of them goes that Kildall actually appeared in the afternoon, but no agreement was reached either. Another problem at that time was that Digital Research had not even finished CP/M's 16bit 8086-version.

When IBM returned to Microsoft still looking for an operating system, Gates would not neglect that opportunity. Microsoft co-founder Paul Allen knew of a 16-bit CP/M clone named "Quick and Dirty Operating System" (QDOS), written by Tim Paterson of nearby "Seattle Computer Products". Paterson had grown tired of waiting for CP/M-8086, so he had decided to build one on his own. In a matchless deal, Microsoft purchased QDOS for a mere USD 50,000, and transformed it into PC DOS 1.0. IBM had unexclusively licensed DOS, which opened doors for Microsoft to sell MS DOS (back then slightly varying versions) to every PC clonemaker that would come along.

At the same time, Digital Research finally finished their 16-bit CP/M, which was even offered by IBM as an alternative to DOS, but never took off mainly because of pricing reasons (USD 240 for CP/M in comparison to USD 40 for DOS). Thanks to the similarities between DOS and CP/M, CP/M applications were easily ported to DOS as well - sometimes it was enough to change a single byte value in the program's header section.

Back then IBM still believed that even on the microcomputer market, profits would stem from hardware sales, not from software sales (remember they gave operating system and standard applications away for free in order to sell mainframes - software was a by-product). Their next mistake was to open doors to clonemakers thanks to their open-standards approach and their licensing agreement with Microsoft. IBM also paid a high price later during their OS/2 cooperation with then-strengthened Microsoft, when Microsoft suddenly dropped OS/2 in favor of Windows.

Myths entwine around the real events, and a lot of wrong or over-simplified versions are circulating. People tend to forget that Microsoft was quite successful long before the days of DOS, selling their Basic version, which ran on more or less every 8-bit microcomputer. They actually began in 1975 on the famous Altair. And no, Gates and Allen did not start their company in a garage (those were Steve Jobs and Steve Wozniak with Apple), they established Microsoft in Albuquerque, New Mexico - because that was where Altair producer MITS had its headquarters. Some years later they moved back to their hometown Seattle.

One of my college teachers once told us that "IBM came to Seattle to talk to an OS vendor, but those guys were out of town, so they went to Microsoft instead". Isn't the real story so much more amazing than that oversimplified one?

Update 2016: I found this Tom Rolander interview, who actually "went flying with Gary" that fateful day (at 17min 7sec):



In 2015 I held this presentation on the "History of the PC" at Techplauscherl in Linz:

Sunday, August 14, 2005

The Good, The Bad, The Ugly Ticketmachine User Interface

When visiting my wife in hospital last week, I received an impression of several inner city parking garages. One of them drew my attention thanks to its quite unique ticket issuing machine:



An unused display, several ugly stickers, partly crossed out, redundant labels and arrows, so that even after passing the garage entrance several times I still could not find the ticket button immediately. Regarding the emergency button (="Notruf" in German), I wonder which kind of emergency one might be facing at this point anyway (but maybe a nervous visual overload attack).

Why on earth, if all of that could be so easy:



BTW, this garage has additional bad user experience to offer (hint: calculator-like elevator button panel, so what about pressing "-" and "1" when going to the basement?) - more on that in one of my next postings.

.NET 2.0: Nullable ValueTypes

Finally they are here: .NET 2.0 introduces Nullable ValueTypes (and a lot more than that - e.g. Generics). What a relief - it was kind of tedious having to implement our own nullable DateTime- or GUID-wrappers, just because those attributes happened to be nullable on the database as well, or because you wanted to pass null-values in case of strongly typed method parameters.

Friday, August 05, 2005

Agile Programming

"Are you doing XP-style unit testing throughout your project? You know, we even write the test code prior to the functional code on each and every method.", the recent hire (fresh from polytechnic school) insisted. "Leave me in peace", I said to myself, "I have real work to do". Two years later I asked him how he was doing. "You know we gave up on the eXtreme Programming approach. It just was frustrating. Oh, and our project was cancelled"

Please don't get me wrong, XP brought some exciting new ideas, and I really admire Kent Beck for the groundwork he has laid in this area. XP also shares several ideas with the proposal I will discuss in a moment. I just don't understand people who immediately jump on the bandwagon of the latest software methodology hype, each time something new comes along. Those folks don't act deliberately, they don't consider whether certain measures make or do not make sense in a specific project scenario, they don't challenge new approaches, they just blindly follow them. Why? I am not sure, but my theory goes that forcing their favorite methodology on other people within their tiny software development microcosm creates a boost on their low self-esteem.

So I am not going to force my favorite methodology on you. But maybe you are also tired of overly bureaucratic software engineering (you know, no line of code will be written until hundreds of pages of detailed specs have been approved by several committees), and eXtreme programming is just too, well, extreme for your taste. The proposal that comes closest to what I think software development should be all about is Agile Programming (you might want to have a look at Martin Fowler's excellent introductionary article). In essence, Agile Programming is people-oriented (requires creative and talented people), acknowledges that there is just not a lot of predictability in the process of creating software, and puts emphasis on iterative development and communication with the customer.

Here, your design document IS in your sourcecode. Software development is not like the building industry, that's why you cannot just draw a construction plan and hand it over to the workers (=programmers) for execution. Agile Programming embraces change (e.g. changing requirements - face it, this will always happen), and helps to react accordingly, thus avoiding the rude awakening after months of denial that you project is off track - the kind of awakenings that might happen as long as you can hide behind stacks of UML diagrams and project plans, but do not have to deliver a new software release each week.

There is not "One-Size-Fits-All", and I probably wouldn't use Agile Programming when building navigation software for the NASA. But many of the agile principles just make sense within the projects I work on (and I try to apply those principles selectively).

I also don't completely agree to the Agile Manifesto's statement #1 "We have come to value individuals and interactions over processes and tools". If they would just have left away the part about tools, it would have been fine. I know what they meant, though, but let me be picky this time. Tools are important. Thing is, smart individuals tend to use or create good tools, so it all comes together again at the end. The manifesto also continues "That is, while there is value in the items on the right [referring to processes and tools], we value the items on the left [referring to individuals and interactions] more". Unfortunately people often forget about the footnotes, and might interpretate this more in a sense of "it doesn't matter I use Edlin for programming, as long as I write clever code".

Changing topic, did you know that Microsoft Project was tailored for building industry projects, NOT for software projects? Think about it for a moment.

Tuesday, August 02, 2005

Marcin Wichary's User Interface Gallery

One of the most complete user interface collections I have ever seen: Marcin Wichary's GUIdebook. Great stuff, e.g. Windows 1.0 screenshots or the complete Macintosh Introduction Advertising Campaign. By the way, Marcin is looking for a new ISP, I am sure there is someone out there willing to support this great project.

DOS Ain't Done 'Til Lotus Won't Run?

Time to straighten out another Microsoft myth: "DOS Ain't Done 'Til Lotus Won't Run" refers to the legend that Microsoft intentionally had manipulated new versions of DOS in order not to be compatible with then leading spreadsheet application Lotus 1-2-3. Just like the old "640k should be enough for everyone"-story, this one also turned out to be another canard.