Minesweeper vs. Notepad

I have been trying to view a 0.5GB text file recently. No, Windows Notepad was clearly not the first choice, because I perfectly knew what would happen. (To my greatest surprise, neither UltraEdit nor Notepad++ could perform this task smoothly.)

And no, I don't want to say anything bad about Microsoft. I grew up on Windows and used to be a certified Win32 API god. All I want to say is that a moderate-size software vendor can afford to make a text editor in 15 years of work on their OS package. "The size of that company is insane. Can you imagine Safeco Field filled to the brim with software developers? And that’s just the Vista Shutdown Menu Team."

The above quote is from Joel. He also writes elsewhere about craftsmanship in software development. In my opinion, this is how notepad should have been implemented:
1. It takes 10 milliseconds to determine the size of a file. For the very least, it could have not tried to open it.
2. The only reason it would need to read more than the first kilobytes when launched is to display scrollbar position. For this it needs to count the number of lines. This task could really be postponed, with a 200-codeline logic, and you don't need any threads for that. The user could really afford to stay without scrollbar for a while.
3. Even that same scrollbar could have been displayed - based on byte position instead of line position, assuming that this is a good first-order approximation. Then during user's idle time it could dive into heuristic estimation of average number of new lines per file size in different areas, scanning randomly only parts of the file. Optimized to harddrive storage units, of course. This way the scrollbar display would be perfect for large files and this can be accomplished relatively fast.
4. I don't even mention how switching to word-wrap mode should be immediate and save the cursor (and not the scrollbar) position.
5. And last but not least, this can be done within 10K executable file, no more than 20K RAM (ok, we let it use 1MB) and no visible CPU overhead.

So, this they couldn't achieve in 15 years (in fact, the only changes in notepad since Windows 3.1 are the status line and UTF-16 support). Nor could they fix the old bug that Windows Explorer hangs during CD acceleration. By no means it's a simple bug - the short acceleration phase does not fit well into the two possible return values of IsDiskInDrive() somewhere, so they are probably left with thinking it's more inside than outside and wait for the hardware interface until it can actually bring data. An API expansion beyond bool would probably require to rewrite tons of code right up to the UI support, and some of it is not actually actually their code, or something like that.

But then again, aren't they being paid for it? Is it really difficult to recognize my need in good working notepad, calc without 3rd-part addons? (The calc, I must admit, knows to compute "0.5!" - GOOD!). Does Steve Ballmer use CDRoms? Recently I've discovered what really kept them busy during all this time - minesweeper. This article explained me all about it, now I can imagine why redesigning a Win2000 start menu into the WinXP one takes 70 programmers. Enjoy.

P.S. Notepad recognized as the best software that came out of Microsoft :)

No comments: