Coding Horror

programming and human factors

Why Anyone Can Succeed

In who needs talent when you have intensity, I proposed that success has very little to do with talent. This blog entry by Brad Wardell offers even more proof:

In 1992, OS/2 came out and I felt I could get a competitive advantage by pre-loading OS/2 onto the computers I sold. I became quite familiar with OS/2. In early 1993, I thought there would be demand for an OS/2 video game. The only problem was that I didn't know how to program. So I bought a book called "Teach yourself C in 21 days" and a book called "OS/2 Presentation Manager Programming". With those two books I programmed Galactic Civilizations. Anyone who ever played the game and also knows programming can verify that only the techniques in OS/2 PM programming are in that game. What that meant is that all the "graphics" were merely iconic windows, not real images because OS/2 PM programming didn't include chapters on how to do graphics programming and I couldn't afford any more books.

Even still, my plan once I graduated was to go work at some cool company. I sent my resume to Texas Instruments and tons of other big companies. No response. I later learned from a friend who worked at Ratheon at the time that these big companies won't look at resumes from minor colleges like WMU. He got in because he went to (wait for it) University of Michigan, the school I was accepted at but couldn't afford (my friend's parents paid his way through and drove a firebird).

So while failing to get a job, the little game I made did really well. Except that I didn't get paid any royalties. Our publisher ripped us off and because I was poor and couldn't afford a lawyer, I was screwed. If you bought a copy of Galactic Civilizations, that's cool but I never got a penny of it. But the game was such a success that I was able to use the good publicity to build Stardock up with other products while I waited to see if I could get a job anywhere.

Because I worked 3 jobs during college my gradepoint was only 2.6 so I was at a competitive disadavantage. But that time allowed me to keep working on Stardock stuff which led to Star Emperor (a GalCiv derivative I wrote for IBM) and Object Desktop for OS/2 which I teamed up with a fellow OS/2 fanatic Kurt Westerfeld to bring to market.

And the rest is history. By 24 I was a millionaire. And during the stock bubble, my company's valuation was ridiculously high (wish I could just stick with that number ) which fortunately coincided with my 10 year class reunion! So what's the excuse of able bodied people who are poor? I'm not particularly intelligent. I don't enjoy working any more than anyone else (just ask my mom). But I did what I had to do. And now I pay 6 figures in income taxes of which a large percentage of it goes to other people. If I can make it, why can't others? If you are able bodied, what's stopping you?

Even if you've never heard of Galactic Civilizations, you may know one of Brad's other products. The most notable are WindowBlinds and Political Machine.

Discussion

The Pontiac Aztek and the Perils of Design by Committee

In a recent interview, Don Norman warns of the perils of design by committee:

You don't do good software design by committee. You do it best by having a dictator. From the user's point of view, you must have a coherent design philosophy, and I don't see how that could come about from open source software. The person who's done it best is Steve Jobs, and he's well-known for being a tyrant.

Nowhere are those perils illustrated better than in this cautionary tale from General Motors:

In the mid-1990s, then-General Motors Corp. Chairman John G. Smale decided to bring the world's biggest automaker a dose of the give-the-people-what-they-want ethic that had animated Smale's old company, Procter & Gamble Co. And what the people wanted was sexy, edgy and a bit off-key; in short, a head-turner. General Motors' culture took over from there. Design would be by committee, the focus groups extensive. And production would have to stick to a tight budget, with all that sex appeal packed onto an existing minivan platform. The result rolled off the assembly line in 2000: the Pontiac Aztek, considered by many to be one of the ugliest cars produced in decades and a flop from Day One.

The Pontiac Aztek automobile

What's worse, the Aztek was actually a good idea at the right time. It was killed by poor execution:

The Aztek represented all that is wrong with GM's design process, that official said. The concept car actually did something few GM designs do: arrive before a trend -- this time, the crossover SUV that combines the attributes of a truck and a passenger car. And GM had high hopes to sell 50,000 to 70,000 Azteks a year, establishing Pontiac on the cutting edge.

Then came production, the executive said. The penny-pinchers demanded that costs be kept low by putting the concept car on an existing minivan platform. That destroyed the original proportions and produced the vehicle's bizarre, pushed-up back end. But the designers kept telling themselves it was good enough. "By the time it was done, it came out as this horrible, least-common-denominator vehicle where everyone said, 'How could you put that on the road?'" the official said.

Sales never reached the 30,000 level needed to make money on the Aztek, so it abruptly went out of production last year. The tongue-in-cheek hosts of National Public Radio's "Car Talk" named it the ugliest car of 2005. "It looks the way Montezuma's revenge feels," one listener quipped.

The Pontiac Aztek is such an egregious case of compromised design that it is referenced multiple times in Steve McConnell's Code Complete 2:

Maybe you think the Pontiac Aztek was the greatest car ever made, belong to the Flat Earth Society, and make a pilgrimage to the alien landing site at Roswell, New Mexico, every four years. If you do, go ahead and believe that requirements won't change on your projects. (p.40)

If we didn't know about geometric shapes like circles, squares, and triangles, for example, we might come up with more unusual shapes like squash shape, rutabaga shape, and Pontiac Aztek shape. (p.152)

This technique is useful about as often as you find someone who would rather have a used Pontiac Aztek than a new Corvette. (p. 365)

I was intrigued by the number of times the Aztek was referenced in the book-- three times is not a coincidence. And at least one international reader was a little miffed since he had no idea what the Pontiac Aztek was:

Another thing I didn't appreciate is the use of a few American comparisons and references. I presume the book is written for an international audience, in which case such culture-specific idioms should be avoided. The Pontiac Aztek is featured quite prominently (never having seen one, nor being aware of its reputation, I have no idea whether the choice for that particular car has any meaning, be it positive or negative). I also remember at least one reference to some sports terminology which is obsure to most non-Americans, probably baseball-related. [..] Only four stars due to the superficial discussion of some interesting topics and the Pontiac Aztek references.

The Aztek is uniquely American. And too often, so is the least common denominator result of design by committee.

Discussion

Where Are The .NET Blogging Solutions?

Owen Winkler put together an overview of all self-installable blogging software, circa mid-2004. After surveying his options, he notes one clear trend:

Even more disheartening… .Text is the only blogware that anyone suggested for the Windows platform. I asked and asked about it because I wanted to give Windows a fair shake. Well, it seems that the only thing that .net developers care about is .net. That is, who cares about the applications you can create with it as long as you have this wonderful language to create them with. I wish them well in ever getting anyone off the ground with .Text, since I couldn't even figure out how to get a copy. Yeah, it was that user-unfriendly.

To be fair, the comparison is a year old, and it doesn't include DasBlog, which is unfortunate. But even after accounting for those factors, the question remains-- why are there so many PHP/MySql solutions for self-install blogging software, and only two for .NET? He makes an interesting observation in a followup post:

I want to like .Text because I'm running on a Windows server. But the fact of the matter is that (as the anonymous commenter above makes an excellent example) the only thing that the .net developers seem to care about is pretty code/pretty language. They don't care if the software works. They don't care if the software is easily installed. They don't care what the software depends on in order to run.

.Text is too complicated for the average user to use. There seem to be different versions of the software depending on what you want. And anyone who is not a developer will have a devil of a time trying to work the gotdotnet workspace. Ick.

The code in WordPress is admittedly a bit messy. But any coder worth his salt (and I'll make this hasty generalization in a heartbeat - not the myriad of erudite but inexperienced VB devs) can easily figure it out.

This leads me to my final conclusion that .net developers (especially those coding blog software) just don't "get it". I'm sure in a few years after everyone is done cooing over .net itself, .net developers will start to focus back on the user instead of how nice their new toy is.

.Text is now Community Server, but I've installed Community Server and I feel this is a valid criticism.

Of course, I'm one to talk, since I am running a WIMP (Windows - IIS - MySql - Perl) blog solution myself. Doh!

Discussion

Formatting HTML code snippets with Ten Ton Wrecking Balls

If you've ever tried to cut and paste code from the VS.NET IDE, you may have noticed that the code generally comes across looking like crap. The root of this problem is that VS.NET copies code into your clipboard in the accursed Rich Text Format. If you were expecting something like standard HTML, think again, bucko!

Brad Abrams posted a quick and dirty workaround to convert the clipboard to HTML using Word. Cory Smith took that workaround and turned it into a VS.NET Macro. It works fairly well, but...

  • Using Word automation to color-code a code snippet in your clipboard is... not exactly lightweight. But my motto is, why use a hammer when you can use a frickin' ten ton wrecking ball?!
  • Word doesn't seem to pick up background colors, only foreground colors. That's kind of a bummer.
  • The resulting HTML is kinda nasty, even though we are specifically asking for Word's simplified "filtered" HTML. But it does work in Firefox and IE just fine.

I experimented with Cory's macro, simplifying it slightly, and forcing a standard font. (I normally use a custom font for programming, but not everyone will have that font installed.)

I knew Word's HTML wasn't going to be optimal, but after taking a closer look at it, I was profoundly unhappy with it. The fact that copying and pasting it back into VS.NET resulted in extra line breaks was kind of a showstopper, too. Here's a little taste:

<P class=MsoNormal style="MARGIN: 0in 0in 0pt">
<SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New';
mso-bidi-font-size: 12.0pt"> <o:p></o:p>

If this is Word's idea of "filtered" HTML, I'd hate to see the unfiltered version. And what's up with those empty <o:p> tags all over the place? After I figured out the threading issue preventing me from accessing the clipboard in a macro, I added some code to postfix Word's crazy HTML into something resembling standard, basic HTML. This worked OK.

But then I wondered-- why not convert the native RTF on the clipboard to HTML myself and cut out the middleman? I'm all for using ten ton wrecking balls, but not when they er.. wreck stuff! Fortunately, I've written RTF to HTML converters before, and even more fortunately, VS.NET only uses a tiny subset of RTF to place colored code on the clipboard. Here's the main conversion function:

Private Function RtfToHtml(ByVal rtf As String) As String
Const tabSpaces As String = "&nbsp;&nbsp;&nbsp;&nbsp;"
'-- remove line breaks
rtf = Regex.Replace(rtf, "[nrf]", "")
'-- parse RTF color table
Dim colorTable As New Collections.Hashtable
Dim i As Integer = 1
For Each m As Match In Regex.Matches(rtf, _
"red(?<red>d+)green(?<green>d+)blue(?<blue>d+);")
colorTable.Add(i, HtmlColor(m))
i += 1
Next
'-- remove header and footer RTF tags
rtf = Regex.Replace(rtf, "{rtf1[^s]+s", "")
rtf = Regex.Replace(rtf, "}$", "")
rtf = Regex.Replace(rtf, "deff0{fonttbl{fd+[^}]+}}", "")
rtf = Regex.Replace(rtf, "{colortbl;(redd+greend+blued+;)+}", "")
'-- fix escaped C# brackets
rtf = Regex.Replace(rtf, "{", "{")
rtf = Regex.Replace(rtf, "}", "}")
'-- replace any HTML-specific characters
rtf = Web.HttpUtility.HtmlEncode(rtf)
'-- convert RTF tags to HTML tags
rtf = Regex.Replace(rtf, "tabs", tabSpaces)
rtf = Regex.Replace(rtf, "pars", "<br/>" & Environment.NewLine)
'-- remove unmapped RTF tags
rtf = Regex.Replace(rtf, "fs(?<size>d+)s", "")
rtf = Regex.Replace(rtf, "cbd+highlightd+s", "")
'-- map foreground color RTF tags using <font> tag
rtf = Regex.Replace(rtf, "cf0s", "</span><span style='color:black'>")
For Each m As Match In Regex.Matches(rtf, "cf(?<num>d+)s")
i = Convert.ToInt32(m.Groups("num").Value)
rtf = Regex.Replace(rtf, "cf" & i & "s", _
"</span><span style='color:" & colorTable.Item(i) & "'>")
Next
'-- fix up orphaned spans at start and end
rtf = Regex.Replace(rtf, "(^.*?)</span>", "$1")
rtf = rtf & "</span>"
'-- convert remaining spaces to HTML spaces
rtf = Regex.Replace(rtf, "  ", "&nbsp;&nbsp;")
'-- add wrapping div
rtf = "<div style='font-family:" & CodeFontName & _
"; font-size: " & CodeFontSize & "pt;'>" & _
rtf & "</div>"
Return rtf
End Function

All this RTF spelunking revealed an interesting fact. I've always been disappointed that none of the copied code had background color highlighting. Well, that's because the RTF on the clipboard doesn't contain any of the background colors! The actual background formatting codes are there, but there are absolutely no entries in the RTF color table for them. Weird.

Update 4/2006: I have a much improved RTF conversion macro. This macro is only interesting for historical reasons, or if you need the Word interop conversion.

Anyway, here's the full FormatToHtml macro (zip). It contains the direct RTF clipboard to HTML conversion, as well as the RTF clipboard to Word clipboard to HTML conversion. To get started:

  1. go to Tools - Macros - IDE
  2. create a new Module named "FormatToHtml" under "MyMacros"
  3. paste the downloaded code into the module
  4. add references to System.Drawing, System.Web, and System.Windows.Forms via the Add Reference menu
  5. save and close the macro IDE window
  6. go to Tools - Macros - Macro Explorer
  7. two new macros named "UsingWord" and "UsingRtfConversion" will be under "FormatToHtml":

    macro_explorer_formattohtml.gif

    Double-click to run the macro, then paste away..

Discussion

Phantom DOS files in my root

Maybe it's just my OCD kicking in again, but it's incredibly annoying how these phantom, zero-byte IO.SYS and MSDOS.SYS files keep showing up in the root of my c: drive on every computer I own.

Phantom DOS boot files in the root

It's a gentle reminder of the Bad Old Days. The last time I checked, I wasn't running DOS 6.22, Win95, Win98SE, or even WinME. No matter how many times I delete these spurious DOS-related files, the next time I look-- they're back. What's next? AUTOEXEC.BAT and CONFIG.SYS? HIMEM.SYS and optimizing my high memory area? Argh.

Discussion