Slashdot reviews my book: “Aimed at programmers who don't know much about user interface design and think it is something to fear, Joel Spolsky provides a great primer, with some entertaining and informative examples of good and bad design implementations, including some of the thought process behind the decisions. Spolsky feels that programmers fear design because they consider it a creative process rather than a logical one; he shows that the basic principles of good user interface design are logical and not based on some mysterious, indefinable magic.”
So I have an announcement to make: if you are a programmer working in 2003 and you don't know the basics of characters, character sets, encodings, and Unicode, and I catch you, I'm going to punish you by making you peel onions for 6 months in a submarine. I swear I will.The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
People have asked why I don't like programming with exceptions. In both Java and C++, my policy is:
The reasoning is that I consider exceptions to be no better than "goto's", considered harmful since the 1960s, in that they create an abrupt jump from one point of code to another. In fact they are significantly worse than goto's:
A better alternative is to have your functions return error values when things go wrong, and to deal with these explicitly, no matter how verbose it might be. It is true that what should be a simple 3 line program often blossoms to 48 lines when you put in good error checking, but that's life, and papering it over with exceptions does not make your program more robust. I think the reason programmers in C/C++/Java style languages have been attracted to exceptions is simply because the syntax does not have a concise way to call a function that returns multiple values, so it's hard to write a function that either produces a return value or returns an error. (The only languages I have used extensively that do let you return multiple values nicely are ML and Haskell.) In C/C++/Java style languages one way you can handle errors is to use the real return value for a result status, and if you have anything you want to return, use an OUT parameter to do that. This has the unforunate side effect of making it impossible to nest function calls, so result = f(g(x)) must become:
if (ERROR == g(x, tmp))
if (ERROR == f(tmp, result))
This is ugly and annoying but it's better than getting magic unexpected gotos sprinkled throughout your code at unpredictable places.
If someone wants to write up a nice article about how to develop multilingual, Unicode applications with PHP or point me to an existing article on the subject I will link to it here. Right now both the PHP documentation and a google search for "PHP Unicode" make it look like you're pretty screwed if you really want to do Unicode in PHP. There is some existing documention of mb_ functions that people have pointed me to, which is badly written and confusing, and appears to only support a handful of encodings, not Unicode in general. It also seems to be an extension that you have to turn on, which means, I think, that the average PHP installation does not support this out of the box.
PHP and Unicode
Scott Reynen shows how to use integer arrays in PHP to handle Unicode manually.
There are also functions available called the Multi-Byte String Functions which handle many encodings. Please ignore the part in the documentation that says that this is "developed to handle Japanese characters." It actually appears to handle lots of encodings including the Unicode ones. However it is turned off by default so you must recompile PHP to enable it.
Ned Batchelder has written a spirited defense of exceptions.
With status returns:STATUS DoSomething(int a, int b)
st = DoThing1(a);
if (st != SGOOD) return st;
st = DoThing2(b);
if (st != SGOOD) return st;
And then with exceptions:void DoSomething(int a, int b)
Ned, for the sake of argument, could you do me a huge favor, let's use a real example. Change the name of DoSomething() to InstallSoftware(), rename DoThing1() to CopyFiles() and DoThing2() to MakeRegistryEntries().
OK - Cancel
Kevin Cheng: “There are four major classes of problematic programmers that I have worked with...”
And Back To Exceptions
There's no perfect way to write code to handle errors. Arguments about whether exception handling is "good" or "bad" quickly devolve into disjointed pros and cons which never balance each other out, the hallmark of a religious debate. There are lots of good reasons to use exceptions, and lots of good reasons not to. All design is about tradeoffs. There is no perfect design and there is certainly never any perfect code.
Announcing the Joel on Software Book Club
The imperfection of design is the theme of October's Book of the Month. Did you ever think about why calculators have 1, 2, and 3 on the bottom row while phones put those keys on the top row? Why did the high beam headlight switch migrate from a floorboard pedal to a toggle on the steering shaft? Whatever you're designing, from the error handling facilities of your software to the fat handle of a toothbrush which is highly ergonomic but can't fit in anyone's toothbrush holder, you have to trade off things that can't really be balanced against each other. And no matter what you do, you'll be subject to criticism, much of it valid.
Henry Petroski, who can write a 448 page book about the common pencil and make it fascinating, has done it again, this time with an excellent book about why there is no perfect design. All design is about tradeoffs, and if you don't believe me, this book offers dozens of examples from everyday life. It even offers a candidate for the best designed object on the planet (the three-legged plastic nubbin that keeps your pizza box lid from sticking to the cheese) and shows why even that is imperfect. Small Things Considered: Why There Is No Perfect Design is another great read and it's the first Joel on Software book of the month.
Developers Developers Developers Developers
Ok, the video of Microsoft CEO Steve Ballmer in the advanced stages of ecstatic frenzy chanting the "Developers" mantra was funny, but his company took it seriously, and Microsoft really does a better job than any other platform vendor encouraging small companies to write software that runs on the Windows platform. If you're a software company willing to commit to developing software for any variant of Windows, you can join the Empower Program for ISVs, which entitles you a huge pile of software at the ridiculously low price of $750. You get 5 copies of MSDN Universal (normally $2600 each) ... this is the package that includes top-of-the-line versions of every single Microsoft development tool and compiler, and Office, and Visio, and developer copies of every server product, and the MSDN library, and copies of every operating system ever shipped (Greek Windows 98SE? You got it!). Empower also includes 5 copies each of Windows XP, Office XP, and a bunch of servers with 5 client licenses... basically everything you need to develop software for Windows with a team of five programmers for $750.
There was one catch, which is why I refrained from signing up for Empower in the past: you had to go through a fairly annoying sign up process which included lots of non-optional questions about things like your annual revenues and how many employees you have... information points that I didn't really feel like Microsoft needed to have in their big fat Potential Competitors database, for when Bill Gates woke up one morning and decided to do a SQL query to find all the software companies that were ripe for a little friendly competition from Redmond.
One day Paul Gomes, a developer evangelist working out of Microsoft's New York office, called me up, as he does quite frequently, to complain about the fact that we were recommending our customers use Windows Server 2000 instead of 2003 for hosting FogBUGZ due to some incompatibilities in the threading model of IIS 6 (which we have since resolved, by the way). "Why didn't you sign up for Empower?" he asked.
I told him how I thought it was offensive that Microsoft wanted data on my sales and number of employees. "You're a platform vendor, but also a potential competitor, so I'm sensitive about that stuff," I said.
"I hear you," he said, and proceeded to call up the ISV relations group back at Redmond. They called me back and walked through the signup procedure, and I told them which questions I thought were inappropriate. Then they did something which surprised me: they made every one of those questions optional. Not just for me, for everyone.
So I signed up, and got a great big box in the mail with piles and piles of DVDs.
(Now if I could just figure out how to convince them to include Flight Simulator in MSDN Universal...)
Exceptions in the Rainforest
Ned: “The debate over exceptions and status returns is not about whether error handling is hard to do well. We all agree on that. It's not about whether exceptions make it magically better. They don't, and if someone says they do, they haven't written large systems in the real world. The debate is about how errors should be communicated through the code.”
And Now For Something Completely Different
Did you see the mention of the new Fog Creek Office in the Wall Street Journal?
AutomatedQA's TestComplete is such a slick product and seems to be just as capable as the market leader, Mercury Interactive WinRunner, at less than one tenth the price. Why does anybody pay $6000 a seat for WinRunner?
Going to the PDC?
Anyone going to the Microsoft Professional Developer Conference in Los Angeles? Let's meet at the ASP Today/Apress booth (booth 533). I'll be hanging out, signing books, and passing out free copies of FogBUGZ.
Monday 10/27 - 12:30 - 1:30
Tuesday 10/28 - 11:00 - 12:00
Wednesday 10/29 - 1:00 - 2:00
Terror Profiles Don't Work
Bruce Schneier: “I think we need to put all U.S. ex-servicemen on a special watch list, because they obviously could be terrorists. I think we should flag them for ‘special screening’ when they fly and think twice before allowing them to take scuba-diving lessons. What do you think of my idea? I hope you're appalled, incensed and angry...”
Amazon now searches the full text of books.
It's hard to believe that here it is, what, 2002? No, I think it's 2003, and when you want to send a really big file or a folder full of little files to someone, you generally wind up messing around with ftp servers and whatnot.
Well, no longer. “A token is like a shortcut or alias that you can send via e-mail or instant message. With just one click you can create a token, and no matter how large the files you want to send are, the token representing them will be very small—just a few KB. Anyone you send a token to can then download the free Creo Token Redeemer software, and with one click redeem the token and download the files. It works for anything—a single file, an entire folder, a huge movie.”
It's quite cool. When you send a token via email your computer becomes a server, holding the files until the recipient redeems the tokens to get the file. The UI is really really simple, and you don't have to worry about whether the recipient already knows about tokens (if not, they'll get a link to download the free redeemer) or if there are firewalls in the way (if there are, the file transfer will automatically bounce off of Creo's giant-reflector-in-the-sky). This is a great implementation of a simple idea that brilliantly solves the nagging problem that it's just not easy enough to transfer large files down the hall, let alone halfway around the world, and it's going to take off like wildfire.
I'm off to LA. If you're at the PDC remember to ride your Segway into the ASP Today/Apress booth, say hi, meet other Joel on Software people, and get a free copy of FogBUGZ.
Monday 12:30 - 1:30
Tuesday 11:00 - 12:00
Wednesday 1:00 - 2:00
URLs are clickable in the forums, again. We turned it off temporarily because of a new technique called blog comment spam ... basically, robots which post URLs to blog comments in order to improve that URL's page rank with Google, which is determined, among other things, by the number, PageRank, and diversity of incoming links.
We've reengineered it so that URLs become links to a redirect server hosted by Fog Creek which, we hope, means that posting a URL in our discussion group will not boost its PageRank.
The Microsoft PDC is over. I loved having an opportunity to talk to so many of you in person at the Apress booth.
The PDC consisted mostly of what used to be called vaporware: preannouncements of cool products that are years and years away. But cool products they are, indeed. XAML is lightyears ahead of the old GDI/USER style of programming the user interface. WinFS, the new filesystem, means you never have to decide whether to use a relational database or a big-mess-of-files. In WinFS a file is a database row, with arbitrary fields, and you can run efficient SELECT statements on files. No, none of this is brand new. XAML's vector oriented display model reminds me of an XML version of NeWS (15 years old). BeOS apparently used to have the ability to add attributes to files which were indexed and queryable.
And, no, none of this works today. There's a prerelease version of Longhorn available, but many aspects of the design are sure to change before the beta, currently scheduled for "about a year from now," with the final operating system shipping "about two years from now," which means nobody will actually have Longhorn for about three years, if Microsoft keeps their schedule, which they won't.
1111 posts over 13 years. Everything I’ve ever published is right here.
There’s a software company in New York City dedicated to doing things the right way and proving that it can be done profitably and successfully.