Tuesday, October 23, 2012

Alister Christie's Delphi TV blog.

Alister Christie's delphi blog is one of the best out there for New Delphi Developers.

Now, I am not Alister's target audience, but I appreciate immensely what he's doing. You see, I've been in the position many times of trying to hire someone who knows Delphi already, and I've found it's one of the problems of not being the #1 most-popular technology out there; There are not enough delphi developers.  It's not a matter of it being impossible. It's just not as easy as it is to learn C#, with courseware, and bookshelves full of big fat books at your local bookstore (if you still even have one near you, that is)... There just aren't enough resources out there to help with learning Delphi. And unlike those of us who just complain about it (that would be my job, really), Alister is actually doing something about it.  So bravo Alister, good on 'ye, and keep up the good work!

Recent posts include new features in XE3, Firemonkey, and "Levels of OOP abstraction". That last topic leads me to a miniature set of topics which I think I will blog about:

The S.O.L.I.D. principles of Object Oriented Programming,  and some particular applications of these principles, using Delphi.

That will be my contribution to general education for the Delphi community for now.  Because if each of us could contribute a little bit of knowledge, and help everybody out, the effects would be magnificent.

Saturday, October 13, 2012

Backup in Windows 8.

Today I thought Microsoft had actually removed the very-useful Backup program from Windows 8.  I found articles on the web that said "less than 5% of users were backing up their computers".  So Microsoft's brilliant idea? Hide and rename the backup utility, and introduce the confusingly named "File History" feature. This feature can back up any file in the Libraries folder. And that's it. There's no option to back up your files and data that are anywhere other than in the Libraries folder.  Doesn't anyone remember that Microsoft did this in Windows Vista, and the Vista backup program was terrible? Then they improved it for Windows 8. So this time around, it was time to make it worse.

Making it worse: Like that's going to make more people back up their stuff. When you search for "Backup" in the start menu in Windows 8, you get NOTHING.  When you search for "Backup" in the windows store, you get zero hits from Microsoft.  I'm a highly experienced windows user, and I had to spend 5 minutes doing high level google-fu,  in order to find out how to backup my whole computer in windows 8.

If you open control panel, and search for backup, you'll find the new File History feature if you type the search term "Backup".  Then you can back up your My Documents folder, and your My Pictures folders, and that's about it.   There's an advanced button in one place, and in another place, there's something called "Windows 7 File Recovery". If you click those, you'll find that the old Backup program isn't gone, it's just renamed.  So, now it's called "Windows 7 File Recovery".   I can imagine how the process that leads to this went at Microsoft.....


Scene 1 - Day 1 of Windows 8 Development

   Fred  : Technologically Illiterate High Level Manager A with Epic Ladder Climbing Skills who claims to be a Close Personal Friend of Steve Ballmer.
   Steve (not Ballmer) : Semi-Tech-Literate Mid-Level Manager B (Slightly below Fred) with semi-Epic Political Skills
   George : Smart Guy with Stupid Non-Dev Title C
                "Windows Shell User Experience Analysis Interaction Expert, Level VIII"

Fred to Steve, in the hallway: "What are we doing about creating shareholder value for Microsoft in the system Backup space in Windows 8?"

Steve:  "Great Question Fred. I was just talking to our Statistical Feature Analysis people, and they've got some surprising results. Less than 5% of people are using Windows backup. I'll send you what I've got when I get back to my office, I think you'll be really happy with our plan to get users backing up their data, and saving them from losing their stuff."

Fred: "Sounds great, Steve, can't wait to hear what you've got planned".

Steve: To himself:  "$%^&!. $%^&!. $%^&!. We have no plan. We just know nobody uses what we have. $%^&!. $%^&!."

Steve pings George, via Lync. Lync is like skype, but nobody uses it, even inside Microsoft. Other than Fred,  and Steve, and people like them, who  were told to use it at least several times daily, on pain of death. Dogfooding, natch.  

[Steve's preamble to George omitted.]

George :   "Well, maybe you should be popping up a dialog box and telling users to back up their stuff."

Steve:  "Okay, sounds reasonable. People hate popups though.  At least this time, we won't be putting any animated animal characters or punctuation on it, right? Hey, it looks like you're going to lose all your data!"

George :  "We'll add some notifications to the Action Center, which is our central space where we organize all the things that the user has to do to keep her system running in optimal condition."

Steve: "Fred's looking for some serious innovation in backup. One more alert in the Action Center  isn't enough. What else can you suggest?"

George: "We should make it really really easy to back up their data.  So, part of the plan in the Office team is to get people not to put their documents onto their PCs at all, and the benefit that the Office365 team sees to defaulting to the cloud is that office documents won't ever get lost.  They'll also be instantly present for you on any Windows 8 computer when you log in with your microsoft account.  For the rest of the stuff in users document folders, err, Libraries, we'll make it a one click option to set up backup. We'll make it simpler and easier to do backup."

Steve: "That sounds good. Can you draw up some concept art and get it to me quick,  Freddy the FUD-meister wants to see this right away."

George: "No problem"


[The Microsoft Machine churns for 90 days]

Scene 2 - Day 90 of Windows 8 Development

  •    Andrew : Smart Guy with Stupid Non-Dev Title D 

               "Windows Shell User-Value Correlation and Causation Entity
                 Framework and Localization Specialist Level VI"

  •    Dave : Smart Developer E.

Andrew:  "I have this request in the bug tracker to rename the windows backup program to Windows 7 File Recovery. Any idea why?"

Dave: "No idea. Ask Steve. Oh wait. I remember now.   Steve was blathering on about how nobody used windows backup, so they had this plan to renovate the backup feature."

Andrew: "So hiding it completely is what they're doing? When you change this name, you won't be able to search for the Windows Backup program and find it any more."

Dave: "Bingo. They don't want people to find it. They want them to find something called 'Save backup copies of your files with File History'. Having two programs that back up your computer was too confusing, the usability testing people  didn't like it."

Andrew:  "But unlike the real backup feature, this one doesn't back up your whole computer, only stuff in the Libraries folders."

Dave: "You got it, Pontiac. This one's going to go over like a lead balloon, but does anybody listen to us?" 

Andrew: "They didn't listen to me about renaming Add/Remove Programs, either."

Dave: "We're taking the whole D($*% start button away too.  This is the least of our concerns."

Andrew: "Big fun. See you at 5 for beers."

Dave: "You're on."

And that my friends, is probably how it happens.



Saturday, August 25, 2012

Rad Studio XE3 video posted on Embarcadero's site.

This blog post is based on published information from Embarcadero only.

First, the "debut" video from their site:

My two top favorite things mentioned from this video:

1. Rad Studio XE3 supports the latest mac OS X (Mountain Lion) in Firemonkey 2 (FM2)

2. Rad Studio XE3 FM2 supports non-client area (fancy title bars) theming just like VCL Styles did for XE2.  A nice parity-feature for Firemonkey, and something that was actually making me not want to use firemonkey. Nice!

Exciting stuff, but perhaps less here than some people were hoping for. Stay tuned for more updates. I know that JT blogged at Embarcadero's blog site, about how some mobile features will be released after XE3 releases, perhaps as a separate product.  

There's also been a lot of hand-wringing about WinRT.  Personally I am about as interested in WinRT as I am in .Net, Silverlight, and WPF, which is zero.   They're about as interesting to me as the JVM, which is, "yeah, that works, fine, but it's boring".  The world I like is the native code world.  It's fast, and it doesn't depend on gargantuan binary frameworks.   If you're following the Java world these days, you'll see that this is what is "the worst problem right now, in Java land";  Project Jigsaw is the plan to move forward, but that's going to be a long time yet until it's ready.   Framework hell.  

WinRT is about as ready for primetime as .Net was when it hit 1.0. Which is not very ready.  While I'm upset that Microsoft has denied non-WinRT apps the "right to run a live tile within the new start menu, that's just one more reason for me to completely ignore the Win8 "WinRT" world, and live purely in Win32 land.   There's a simple way to force microsoft's hand here.   Let's just wait until Win8 releases to retail, and then let's watch as someone makes a million bucks with some replacement start menu that works just like the one we know, and probably love, from Windows 95 until now.  Frankly, I've played with the RTM and the various previous milestone releases, and I'm unimpressed with the UI-formerly-known-as-Metro, and with WinRT in general.  I am much more impressed with the latest Office365/Office2012 release.

But since XE3 will ship with less functionality than XE2 in the box, I expect to hear lots of whinging from various "nattering nabobs of negativity" out there, but as for me, I'm still amazed that we have a multi-platform Delphi.  Everybody who buys XE3 gets all the XE2 level features for free anyways, since XE2 is included for free for everyone who buys XE2, as per JT's blog.

Yeah, so if it takes longer to build than people wanted it to take for the next level of Mobile app building technology, and you want to learn Cocoa and XCode, and build completely separate apps (Java for Android, C# for Windows Phone and Windows, Objective C for Mac) and share zero code between those systems, then you're more than welcome to do so.   I'm not taking a "holy war" approach to mobile development. I'm learning lots of things, and doing whatever works.  I am quite excited about Delphi-on-mobile-platforms, as a future for Delphi development.

It's a great time to be a big fat Delphi fan. Go team. Go Delphi. Go Embarcadero!

Why yes, I AM a fan boi.   Fine.

Friday, August 24, 2012

I used to be a C/C++ programmer.

Certain not-very-much-like-C things in Delphi still trip me up. Like this code which I wrote today, expecting it to zero pad my integer values:
     result := Format('%02d%02d',[hour,min]); 
     // expected '2400', got '24 0'

After a bit of googling, I found that you need this syntax, which seems very unorthodox to me:

   result := Format('%.2d%.2d',[hour,min]); 

As weird as that use of a decimal place in a Format statement involving only two WORD or Integer type variables (hour/min) looks to me, it works just like a %02d format specifier would in C, Java, C#, Python, Perl, Ruby, and Everywhere Else in the Known Universe, other than in Delphi and TurboPascal.

Thursday, August 16, 2012

Clean code, greenfield development, and the Developer Ache

Much has been written lately about "writing clean code".  Whether it's the "Uncle" Bob Martin books, or other similar books, there has been a lot said about writing code which is a joy to work in.

The alternative word to "clean", is "legacy", which means "a pile of crap that I hate working on".

I'd like to suggest that in fact, 99.99% of all the code that runs everything, including Windows, your bank machine, and the rest of your bank, the entire world banking system, the fuel injection computer in your car, the firmware for every system in every airplane currently in the air, and just about every piece of PC Windows, Linux, Mac, and  embedded system software in the world is "Legacy" software.

I'd like to suggest that clean code is an asymptotic desire of an insane mind. That programmers can become obsessed with code cleanliness to the point that they can place some aspects of clean code above the other more important aspects of clean code.  Of course the "clean code" people advise correctness, completeness, usefulness to the customer and the world, but I haven't seen them advance any ideas on how these ideals can be pursued in a manner that is sustainable, and which can balance pragmatism against idealism, such that the survival of the businesses and knowledge-based economies that live thanks to these systems is assured.

Sometimes we create amounts of technical debt which require not only technical solutions, they require mental conditioning to withstand working in the code. Sometimes a kind of zen quietness is needed more than a kind of ninja coding style.

Imagine, if you will, deep in the bowels of the Microsoft campus, lives a senior software developer who is responsible for the Windows Explorer Shell APIs and codebase.  Imagine it's 5 million lines of insane code.  He can't change any of it without breaking a million plugins or extensions, and he's still getting heat from managers who can't code, for the 57 serious bugs that shipped in Explorer.exe in the Vista RTM.  He dreams of a clean codebase, but he knows it can never happen.

There are just too many constraints on real useful software, to ever allow complete rewrites.

Now let's switch to Delphi programming.   What if 99% of the Delphi code out there is a Big Ball of Mud.   No encapsulation.  No abstraction.  No cohesion.  Plenty of bad stuff; Coupling ties everything to everything.   You can't bring one unit in from a project without pulling in 4.5 million lines of code via the snarled mess of uses-clauses that tie the whole unit to everything else in it.  Nothing is unit testable.  You can't rewrite it without killing your company and your main product.   Everyone wants an incremental addition here and there, but nobody has the patience to wait while you clean it up.

What do you do?   I would argue that everything that the clean-coding crew says you need is still true. But you need to turn down the volume dial on your own internal anxieties.  You need to give yourself the time, the imagination, and the freedom (internally) to imagine that these problems really can be solved, but that the solutions won't come in a complete form, but rather, incrementally, slowly, and that after a sustained effort, you might get cleaner code.  Never ever will you have clean code.

But maybe just maybe, you can make things better.  Just not perfect.   And that's the difference between insane, and sane.    Maybe some coders have undiagnosed Obsessive Compulsive Disorders.  So become more self aware, and become a better coder.

Tuesday, June 26, 2012

Celebrating Twenty Years of Failure in the Mobile Space

There's interesting reading, great 1990s nostalgia, and some pictures of long forgotten devices at this IT World article:

Flops and Vapor: 10 ways Microsoft tried and failed to rule the Mobile device world

It's an amazing list of Microsoft-sponsored mobile software failures.  It shows us how compelling the "tiny pocket computer" idea has been in all our collective imaginations, and how elusive success has been in that space.

Even those technologies that have succeeded have not had a long or stable shelf life.  Mobile technology is more uncertain, and the market is far less stable than the PC market.

It might give you pause, if you were a major vendor of software for the Pocket PC, in 2001, or a Palm Pilot software vendor, in 1999, that your market might not exist in 10 years.  Could the same thing happen again, to Apple-device software ISVs?  It would be a historical anomaly if the market didn't at least cool off a little bit.

Anyways, nobody has tried (and failed) more often in the mobile-device space, than Microsoft.

Click the link, and read, and weep.  And ask yourself, how many of those gadgets are in my gadget junk drawer.   I personally bought (or wanted to buy) at least a dozen such devices, including Microsoft-based offerings running Windows CE, and some others, including various models of the Palm Pilot PDA.

But while Palm is dead, and its most notable successes lead to nothing but failure, Microsoft has survived its failures, making it perhaps the most unique company in the technology business.  Its sheer financial health, lead by the Windows and Office division's billions of dollars in profits, lets it lose billions on mobile devices, XBox game systems R&D, and other things, without substantially affecting the bottom line.   

So, the ability to not only survive, but continue to thrive, while throwing away more billions on wasted R&D than any other company in history, is in fact, something to celebrate.  I'm actually serious here.  People owe Microsoft some respect for that.  And I do respect Microsoft, even though they do things that make me mad.  Give me back the Office 2003 User Interface, and get rid of that useless ribbon.  But hey.... Windows 7 is nice.  Try not to screw up Windows 8 too badly, okay?

Thursday, June 14, 2012

Indentation Holy Wars.

One thing that surprises me to no end is the number developers I meet who are willing to take up arms and fight to the death over the indentation and whitespace style of their code. And capitalization. And other things that the compiler ignores.

This wikipedia article, which is C/C++ centric, shows the main variations popular in C/C++ programming, and in related languages that use curly-braces, including C#, Javascript, and others.

Here's my personal indentation and whitespace style:

// Warren Style (The One True Way)
procedure MyProcedure( Arg1, Arg2 : Integer; Arg3 : string );
  i: Integer;
  if arg1 > 10 then begin
      for i := 0 to 10 do begin
  end else begin 

By my count, there a great many ways that people could rewrite, or nitpick about the above very simple code. Here are but a few of the myriad whitespace options Delphi people argue over:

1.  begin starts a new line, always? (Yes/No)
2.  Do we put a begin..end around a single statement or do we leave off Begin/End where possible?
3.  Indentation levels (2,3, or 4 spaces).
4.  Initial indentation level different than sub-levels (commonly 2 character indentation after var keyword, more than 2 character indentation inside begin/end blocks.
5   Location of begin and end : Pick a style from the wikipedia list.  Allman, Banner, K&R, and others.
6.  How do you police the width of your files and formatting of large argument lists to procedures?
     One parameter per line? As many as will fit in 80 columns?

If I multiply the options above, I get somewhere between 40 and 100 different options, depending on how many choices I can manufacture at the stages 1 through 5 above.

We all know holy wars are not objective matters.  But why do holy wars break out, and why do developers have a hard time dealing with variance from their chosen style?

I would like to propose that developers do not read their code. They see shapes, and where necessary they read their code. When code is not formatted the way they like it, they find that the level of effort that they must expend is increased.  So, in the end, it is a selfish sort of argument, as all holy war topics are.    My own preferences run towards the sample above, but any of the following are acceptable to me:

// 2 & 4 space Jedi Style
procedure MyProcedure(Arg1, Arg2 : Integer; Arg3 : string);
  i: Integer;
  if arg1 > 10 then 
      for i := 0 to 10 do 

// Save The Chars Style
procedure MyProcedure(Arg1,Arg2:Integer;Arg3:string);
  if arg1 > 10 then
      for i := 0 to 10 do      

// consistently 2-spaced Jedi Style
procedure MyProcedure(Arg1, Arg2 : Integer; Arg3 : string);
  i: Integer;
  if arg1 > 10 then 
    for i := 0 to 10 do 

The one style I encountered firmly entrenched at a big Delphi shop, that I could not live with is this style:

// Pascal+Banner Style

procedure MyProcedure(Arg1, Arg2:Integer; Arg3: string );
  if arg1 > 10 then 
      for i := 0 to 10 do 

Did you see what happened there? The second (green) end keyword looks to me like it goes with the for-loop's begin (blue), but it actually goes with the if statement's begin statement.  Now not only does the visual "it scans easier" argument that the fans of the banner style prefer not make any sense to me, in the example above,  begin..end blocks inside a procedure have one set of rules (the banner style) but the outermost begin and end above, the ones I have marked in bright pink above, still line up with each other.  The mental anguish that the above style caused me, during my 9 months of employment at the company where the senior developer preferred that style probably caused me more anxiety and grief than any programmer in the world could imagine whitespace causing, until you end up on the losing side of a holy war on a topic you can't win.

You see, when an application's already built, and formatted a certain way, you have, as a single guy working at a company, a bit of a professional obligation to do what you can to work with that style. I tried, and I tried to learn to read the code style above. I found I could not. I gave up on formatting my code like I was told to format it. I just couldn't do it, my brain, and 30 years of habit were rebelling against me. I asked other delphi developers and they said they couldn't live with that style either.  But neither could the company or its longest standing Delphi guys countenance any change.  

In the end, there was only one way out.  I am no longer working at that company, and I'm glad to be gone.  Indentation and whitespace weren't the only ways we were not a good fit.  But it was a bit of a case in point.  Could you rewire your brain, to accept a style that later, after you're gone from a company, you still regard as a form of brain damage?  I couldn't.  

In the end, the rule is the rule;  Companies set up shop and run for 30 years, and you, the developer need to learn to work within their rules, and if you can't, then get out, or be fired.  Fair enough.  But it still amazes me that something as insignificant (to the compiler) as whitespace, can be a make or break criteria for you keeping your job, or perhaps even, whitespace might kill you.  Stress, and anxiety over a long period of time kills and sickens human beings every day.  Even if all the stress and fighting is only over something as insignificant as whitespace.

Addendum:  The multi-assignment alignment Sub-Holy-War.

Have you ever written code like this:
        A.Size       := GetAreaSize(Arg1, Arg2);
        A.Width      := GetAreaWidth(Arg3, Arg4)
        A.PanelColor := GetThemeColor(Arg5);

When I do, I like to have the equal signs line up if all the assignments are in a group. I prefer the above style to using with.  Other people hate it when you put an extra space after A.Size.   

Saturday, June 9, 2012

The Delphi 1.0 Installer was Awesome

This is the delphi 1.0 installer running. It's the dashboard of a sports-car, probably a Porsche.  The speedometer shows the progress from 0 to 100% of installed.

Bring Cool back to software installation, Embarcadero. Installers should be fun.  Oh, and free support for installation with a phone number to call, right there, on a little "note" on the windshield of your new "Porsche"; Priceless.

Friday, June 8, 2012

Why I still hate, and yet grudgingly respect, C++

There are lots of great "Programmer to Programmer" questions on the sister-site to StackOverflow, called programmers.stackexchange.com, where a lot of the general non-programming related questions that are somewhat software development related, but not exact technical questions with exact technical answers. Here's one I came across today:

  Why do so many people dislike C++?

The answers there are very good, but my favorite one is the answer that brings up a podcast conversation between Jeff Atwood and Joel Spolsky, two of the guys behind the whole "StackOverflow" empire, among other things.

 The gist of that answer is that you have to read a book about the "gotchas" in order to avoid writing really bad C++ code. A well-intentioned person who doesn't understand the difference between lvalue and rvalue references, copy constructor semantics, the intricacies of casting, const and non-const and when to use each, and the problems of writing exception safe code, concurrency and threading, and on and on...

 Well, I've always hated, but grudgingly respected C++, as a Delphi guy. I am in the C++ guy camp with the desire to have a binary that is standalone with no runtime at all, but yet, I see, that most of the Windows Visual C++ people seem to accept redistributing MS VC Runtime dlls along with their apps. Say it ain't so, m my C++ brothers.... DLLs that you ship should be your dlls only. Being forced to ship a DLL that contains some bits of your standard library is just so wrong on so many levels.

 Since the question on Programmers.SE covers enough of the reasons why you might hate C++ I'll just tell a story about why I hate C++. In 1995 I was working for a small software company making OS/2 software in C++. It was the last professional C++ job I ever held. I was using IBM VisualAge C++ for OS/2. In those days, writing code in C++ was rough. IBM actually had a nicer class library than most people, and their documentation was almost always right.  But it was shockingly difficult to write a database application in C++.

My main gripe was the lack of decent string handling libraries and capabilities in C++.
I counted at least four ways of writing string-processing code in our codebase:

 1. You could use IBM's non-standard-C++-library strings.   These had capabilities that the standard C++ library string types lacked, but the reverse was also true.

 2. You could use the standard-C++-library string types.   The most fun thing about using these was the absurd things that they did include, and the obvious things that they didn't include a way to do, requiring you to hand-code a tonne of string functionality yourself, over and over and over.

 3. You could use regular C char buffers and C pointer to char strings.  And you could then enjoy buffer overflows, and access violations, if you made mistakes.

 4. You could use your own class that basically used operator overloading, or whatever style you wanted to use, to try to provide the semantics that you wanted, as if you were programming in Visual Basic.  Most people started out using #1,#2,#3 and when they hurt themselves badly enough, they would start a side project writing their own C++ String Type. One String to Rule Them All.  Of course, they would then get lost in evil C++ side-effects involving casting, type coercion, lvalue and rvalue semantics, and so on. Oh, and string heap memory management.

 I saw all four of the above in use, and on three different occasions started writing my own C++ string classes, and it sickened me. I wanted one string to rule them all.  I wanted a string type built into the compiler that everyone would just use.

I had loved using Turbo Pascal in DOS, and in 1995 when Delphi came out, I saw that it had one, and only one string type. Sadly, it was the Pascal 255-character string type.  But when Delphi 2.0 came out, it was love at first sight. A proper String type built in.     Ironically, delphi now has a whole pile of string types, and the meaning of String has now changed three times (ShortString -> AnsiString ->UnicodeString)  and yet, we've survived it.

Back to C++ for a moment. You see, the codebases we used were so full of different string classes that I spent a lot of time converting string data from a standard library string to a character buffer or pointer to characters (PChar in delphi terminology).  The UI layer used the IBM string class.  The stored procedure layer used Char buffers and Char pointers with dynamic memory allocation (malloc).  In between, chaos reigned.

Now the above criticism isn't just about strings. It's that C++ is a giant playing field where millions of very talented developers have built giant monster piles of code. Half the world runs on the stuff they have built.

 And now I will switch from griping to respect mode.

 1. Microsoft Office is built in C++.

2. Almost every major Game studio writes in 100% C++.

3. No other language can do everything C++ can do, and yet compile to native code. Never has this been more true than since the advent of the new C++ 2011 standard. Check it out it's pretty neat.

 4. Finally, because of the tools, libraries and the rest of the C++ ecosystem, C++ is the most powerful cross-platform binary compiled language on the planet.

While I'm glad that I don't have to learn all the intricacies and accidental-complexity of C++, I do want to be able to link in C++ code into my Delphi apps sometimes, and for that reason, I'm quite excited at Embarcadero's future directions with LLVM/CLANG and C++Builder. In the microsoft camp, I'm truly impressed with their C++ 11 support in Visual Studio 2012. In the library and tools world, I'm deeply impressed by wxWidgets, BOOST, and the entire commercial ecosystem of C++ game development tools. Almost every major-studio game produced these days is 100% built in C++. So, let's give C++ a round of applause. And be glad if you've got a job doing Delphi and you don't need to understand copy constructors and type coercion, or discussing  some obscure massively-multiple-inheritance scenario you've devised.

Friday, May 25, 2012

Bob Martin: NO DB. Me: Any Sane DB.

The venerable OOP guru Bob Martin has weighed in on SQL, and NoSQL. He admits candidly to disliking SQL databases, and the way they just jumped in and dislodged non-database centric developer's lives. Their ubiquity, at one point, and the belief that any kind of persistence layer other than an SQL database persistence layer was somehow "not good enough" lasted nearly 25 years in our industry. I started out, and remained until recently, an SQL-database hater, conditioned to hate SQL by the bitter experience of many projects where it seems that SQL and the concerns around it, destroyed the project, and the company. I especially learned to loathe IBM DB2, on OS/2, and a series of misbegotten attempts at multi-tier database application architectures. I learned quite recently that SQL is actually not too bad. I don't love it. But I don't hate it either. I have however, learned that proprietary data-stores that are home-brewed can have quite a lot of glitches, and are generally not to be trusted. If there's two things I hate more than SQL databases they are:
  • Private binary-repository stores used as the primary repository for critical customer data.
  • Any persistence system that is not trustworthy.

    A trustworthy system must have at least three of these four characteristics:
  • Be fully unit tested. (SQLite=Yes)
  • Be widely used by respected/large products (SQLite=Yes)
  • Not have lots of people ranting about why it sucks (MongoDB,CouchDB, etc).
  • Open source to prevent vendor lockin.

    I have one non-negotiable, too:
  • Not have misfeatures, that cause data loss, that make me hate it. (Remember subversion's early BSDDB back end? I still haven't forgiven BSDDB or Subversion for that.)

    Having said that, my current job, and my previous job have involved working with Microsoft SQL Server, and as commercial databases go, it's actually pretty nice. And if your database is small, it's free, with the "Express" edition. Nevertheless, it's hardly painless. It seems very easy to make mistakes that you will only realize are mistakes after years of work. That's why the "DBA" and the "Database developer" roles were born; Because doing SQL databases is hard work, and screwing them up is easy.

    Lately, I have become very interested PostgreSQL, which is a hybrid database, offering classic SQL features, and a lot of great stuff that the NoSQL crowd has come to offer as well. I also have a lot of respect for SQLite, and for desktop-only zero-configuration cases, I have come to prefer it. However that stance is new for me. I actually had a very loud argument, where I was completely (irrationally, and wrongly) against ever using SQLite in any Delphi application written by any team involving me. Hey Steve, if you're reading me; I was wrong. SQLite is actually kind of awesome.

    I realize that the DB world and the persistence-layer of programming, are hotbeds of opinions. ORMs are great. ORMs suck. Automatic OOP persistence layers are a current area where debate is raging loudly. The classic "SQL for everything" people tend to value hand-crafted SQL and queries, and so any layer that tries to map (via an ORM) objects to SQL is going to suck, in some cases. However, if you want a non-relational persistence model (which is actually ideal for many classes of problems), you're always going to be wondering if you went the wrong way, when you get yourself into the sorts of troubles that SQL-based solutions don't suffer from. How about the debate between the "Scalability Über-Alles" crew and the "Data Integrity Über-Alles" crew. It's a holy war, and it's on.

    There are no silver-bullets. But there are some lead-balloons out there.
  • Thursday, May 24, 2012

    MadExcept 4.0 is here!

    MadExcept 4 is out! It's my favorite exception-catching email-sending bug-squashing tool for Delphi. Now with the following new features:

  • 64 bit Windows support for Delphi XE2
  • Full unicode support
  • SSL and TLS SMTP client mailing
  • SSL HTTP uploads
  • Bug Tracker integration: added FogBugz, BugZilla and Mantis reporting
  • option to conform to Windows Logo requirements
  • extensive memory and resource leak reporting
  • added debug memory manager
  • added support for nested exceptions
  • added new "madExceptViewer" tool
  • lots of smaller improvements

    In my opinion, this is the biggest single release in MadExcept history! Basically everything I've ever wanted added to MadExcept, is now in MadExcept. Go check it out here, download "madCollection" to install. Don't forget to click the "MadExcept 4" button when installing, or you won't actually get MadExcept installed.
  • Sunday, May 20, 2012

    Hotfix for for Firemonkey in Delphi/C++Builder/RAD update4

    Embarcadero CodeCentral has now made available the awaited hotfix for Update#4, which solves the "blurry font" issue in Firemonkey, and other issues.

    It's available here: CodeCentral 28881

    A side note is that you have to scroll past 150 lines of "Products" that you must own one of, in order to read what is in it. You thought there were a lot of Editions of Windows 7? That's nothing, I believe that Delphi/RAD/C++Builder has them beat. I've done a quick breakdown and here are the numbers:

  • There are 8 editions of AllAccess that contain RAD/Delphi/C++, which is Embarcadero's way of bundling both Database and Developer applications. So your license-key would be an all-access license key, of a particular level (named by metals like silver, gold, etc)
  • There are 5 SKU levels of the primary products, and two products (Delphi and C++ Builder) and then a third product name (RAD Studio) that indicates the bundle of Delphi plus C++ Builder, and when you expand these out, you end up with 142 different "products" that you could have purchased. Some are multi-license packs, some are upgrade editions, and some are special pricing levels like Academic pricing. At some point, if it was my job, I'd keep that list to myself (150 editions in total), and simply replace all the editions in CodeCentral's "customer-facing" document to "You must own an edition of Delphi, or C++ Builder XE2 to download this file". I thought about this, as I scrolled down through three-screens full of editions of RAD Studio. It would amuse me if some of those editions represent combinations that zero customers have actually purchased (The 5 pack of Academic upgrades from Professional to Ultimate, for instance.) Just because I'm in the mood, I'm posting the full list here:
    All-Access Bronze
    All-Access Gold
    All-Access Platinum
    All-Access Silver
    All-Access XE Bronze
    All-Access XE Gold
    All-Access XE Platinum
    All-Access XE Silver
    C++Builder XE2 Architect
    C++Builder XE2 Architect - Network License
    C++Builder XE2 Architect 10 pack
    C++Builder XE2 Architect 10 pack Upgrade
    C++Builder XE2 Architect 5 pack
    C++Builder XE2 Architect 5 pack Upgrade
    C++Builder XE2 Architect Academic
    C++Builder XE2 Architect Academic - Network License
    C++Builder XE2 Architect DevRel
    C++Builder XE2 Architect Upgrade
    C++Builder XE2 Architect Upgrade - Network License
    C++Builder XE2 Architect Upgrade from Starter
    C++Builder XE2 Enterprise
    C++Builder XE2 Enterprise - Network License
    C++Builder XE2 Enterprise 10 pack
    C++Builder XE2 Enterprise 10 pack Upgrade
    C++Builder XE2 Enterprise 5 pack
    C++Builder XE2 Enterprise 5 pack Upgrade
    C++Builder XE2 Enterprise Academic
    C++Builder XE2 Enterprise Academic - Network License
    C++Builder XE2 Enterprise Upgrade
    C++Builder XE2 Enterprise Upgrade - Network License
    C++Builder XE2 Enterprise Upgrade from Starter
    C++Builder XE2 Professional
    C++Builder XE2 Professional - Network License
    C++Builder XE2 Professional 10 pack
    C++Builder XE2 Professional 10 pack Upgrade
    C++Builder XE2 Professional 5 pack
    C++Builder XE2 Professional 5 pack Upgrade
    C++Builder XE2 Professional Academic
    C++Builder XE2 Professional Academic - Network License
    C++Builder XE2 Professional Upgrade
    C++Builder XE2 Professional Upgrade - Network License
    C++Builder XE2 Professional Upgrade from Starter
    C++Builder XE2 Starter
    C++Builder XE2 Starter DevRel Edition
    C++Builder XE2 Starter Upgrade
    C++Builder XE2 Ultimate
    C++Builder XE2 Ultimate - Network License
    C++Builder XE2 Ultimate 10 pack
    C++Builder XE2 Ultimate 10 pack Upgrade
    C++Builder XE2 Ultimate 5 pack
    C++Builder XE2 Ultimate 5 pack Upgrade
    C++Builder XE2 Ultimate Upgrade
    C++Builder XE2 Ultimate Upgrade - Network License
    C++Builder XE2 Ultimate Upgrade from Starter
    Delphi XE2 Architect
    Delphi XE2 Architect - Network License
    Delphi XE2 Architect 10 pack
    Delphi XE2 Architect 10 pack Upgrade
    Delphi XE2 Architect 5 pack
    Delphi XE2 Architect 5 pack Upgrade
    Delphi XE2 Architect Academic
    Delphi XE2 Architect Academic - Network License
    Delphi XE2 Architect DevRel
    Delphi XE2 Architect Upgrade
    Delphi XE2 Architect Upgrade - Network License
    Delphi XE2 Architect Upgrade from Starter
    Delphi XE2 Enterprise
    Delphi XE2 Enterprise - Network License
    Delphi XE2 Enterprise 10 pack
    Delphi XE2 Enterprise 10 pack Upgrade
    Delphi XE2 Enterprise 5 pack
    Delphi XE2 Enterprise 5 pack Upgrade
    Delphi XE2 Enterprise Academic
    Delphi XE2 Enterprise Academic - Network License
    Delphi XE2 Enterprise Upgrade
    Delphi XE2 Enterprise Upgrade - Network License
    Delphi XE2 Enterprise Upgrade from Starter
    Delphi XE2 Professional
    Delphi XE2 Professional - Network License
    Delphi XE2 Professional 10 pack
    Delphi XE2 Professional 10 pack Upgrade
    Delphi XE2 Professional 5 pack
    Delphi XE2 Professional 5 pack Upgrade
    Delphi XE2 Professional Academic
    Delphi XE2 Professional Academic - Network License
    Delphi XE2 Professional Upgrade
    Delphi XE2 Professional Upgrade - Network License
    Delphi XE2 Professional Upgrade from Starter
    Delphi XE2 Starter
    Delphi XE2 Starter DevRel Edition
    Delphi XE2 Starter Upgrade
    Delphi XE2 Ultimate
    Delphi XE2 Ultimate - Network License
    Delphi XE2 Ultimate 10 pack
    Delphi XE2 Ultimate 10 pack Upgrade
    Delphi XE2 Ultimate 5 pack
    Delphi XE2 Ultimate 5 pack Upgrade
    Delphi XE2 Ultimate Upgrade
    Delphi XE2 Ultimate Upgrade - Network License
    Delphi XE2 Ultimate Upgrade from Starter
    Embarcadero RAD Studio Architect for ToolCloud
    Embarcadero RAD Studio Enterprise for ToolCloud
    Embarcadero RAD Studio Professional for ToolCloud
    RAD Studio XE2 Architect
    RAD Studio XE2 Architect - Network License
    RAD Studio XE2 Architect 10 pack
    RAD Studio XE2 Architect 10 pack Upgrade
    RAD Studio XE2 Architect 5 pack
    RAD Studio XE2 Architect 5 pack Upgrade
    RAD Studio XE2 Architect Academic
    RAD Studio XE2 Architect Academic - Network License
    RAD Studio XE2 Architect DevRel
    RAD Studio XE2 Architect Upgrade
    RAD Studio XE2 Architect Upgrade - Network License
    RAD Studio XE2 Architect Upgrade from Delphi/C++Builder XE2 Arch
    RAD Studio XE2 Architect Upgrade from Starters or RadPHP
    RAD Studio XE2 Enterprise
    RAD Studio XE2 Enterprise - Network License
    RAD Studio XE2 Enterprise 10 pack
    RAD Studio XE2 Enterprise 10 pack Upgrade
    RAD Studio XE2 Enterprise 5 pack
    RAD Studio XE2 Enterprise 5 pack Upgrade
    RAD Studio XE2 Enterprise Academic
    RAD Studio XE2 Enterprise Academic - Network License
    RAD Studio XE2 Enterprise Upgrade
    RAD Studio XE2 Enterprise Upgrade - Network License
    RAD Studio XE2 Enterprise Upgrade from Delphi/C++Builder XE2 Ent
    RAD Studio XE2 Enterprise Upgrade from Starters or RadPHP
    RAD Studio XE2 Professional
    RAD Studio XE2 Professional - Network License
    RAD Studio XE2 Professional 10 pack
    RAD Studio XE2 Professional 10 pack Upgrade
    RAD Studio XE2 Professional 5 pack
    RAD Studio XE2 Professional 5 pack Upgrade
    RAD Studio XE2 Professional Academic
    RAD Studio XE2 Professional Academic - Network License
    RAD Studio XE2 Professional Named User Upgrade from Delphi/C++Builder XE2 Pro
    RAD Studio XE2 Professional Upgrade
    RAD Studio XE2 Professional Upgrade - Network License
    RAD Studio XE2 Professional Upgrade from Starters or RadPHP
    RAD Studio XE2 Ultimate
    RAD Studio XE2 Ultimate - Network License
    RAD Studio XE2 Ultimate 10 pack
    RAD Studio XE2 Ultimate 10 pack Upgrade
    RAD Studio XE2 Ultimate 5 pack
    RAD Studio XE2 Ultimate 5 pack Upgrade
    RAD Studio XE2 Ultimate Upgrade
    RAD Studio XE2 Ultimate Upgrade - Network License
    RAD Studio XE2 Ultimate Upgrade from Delphi/C++Builder XE2 Ult
    RAD Studio XE2 Ultimate Upgrade from Starters or RadPHP
  • Friday, May 11, 2012

    Metro UI in Visual Studio 2011

    A recent blog post on MS's blogs, here shows the differences between the beta and release candidate gui:
    I was looking at their UI and thinking about it, and you know what it reminds me of? This:
    That's GEOS on a Commodore 64, in about 1988. So, Metro is GEOS 2012. What do you guys think? Is it time to go back to monochrome? Sick of high color photo-quality icons and long for monochrome high-contrast user interfaces? Not me. But it seems all the cool UI designers are doing it. Mac OS X 10.7 LION is the least colorful version of Mac OS X yet, and it all seems to be fading into gray on silver on carbon, whether its the removal of color from the icons in the finder's quick-icon bar, or the complete disappearance of the scrollbar, the themes for this year's cool UI designers are "chromeless", "monochrome" and "minimalist". Color me unimpressed.

    Thursday, May 10, 2012

    The world needs more Debug Tools

    The world needs more debug tools. Well, Developers in this world do, anyways. Lately I've been learning Cocoa and ObjectiveC -- still the best way to write native iOS applications, if you don't mind the learning curve, and a lot more mature than Firemonkey is, yet -- and besides the beauty of the Cocoa frameworks and CocoaTouch (the iOS version of desktop Cocoa), one of the other things that is impressing me, is the tools that come with XCode, including "Instruments".
    For a quick tour, read this link for an example of some of the things that you can do with it. Since reference counting is used everywhere in ObjectiveC, you need to know about things like retain cycles, for instance. Memory leaks in Delphi applications are more often because the "owner" didn't free an object when the owner was destroyed or no longer needed the object, although of course, reference counting does happen wherever you've got Interfaced objects. AQTime is the closest tool to Instruments, if you want to compare. But most Delphi developers don't own the full AQTime product, and Instruments comes with XCode. In fact, perhaps the most amazing thing about XCode is that it's free. Why is it free? Because Apple wants people to make iOS apps and Mac apps, and because until they took over making their own SDK, one of the big barriers to development on Apple devices, a long long time ago, was buying MetroWerks CodeWarrior, which was the Apple C/C++ IDE back in the bad-old-days prior to Mac OS X, and the iPhone, and every other cool thing.
    Even though I have AQTime "Embarcadero Edition" that comes with XE2, and even though I've had AQTime Professional at various places where I've worked, I still feel that I don't have enough tools to find the difficult bugs.
    I want a tool that will:
  • Help me step back in time to what happened right before the mess I'm in right now.
  • Slow down time but not stop it, giving me a way to run my code at not-exactly-full-speed, but at a usable enough speed, that I can operate the application, while seeing the mechanics of the app run, or fly by me on the screen.
  • Show a call stack, like a debugger, but also a call history, that goes back in time, until the beginning of each thread or a certain limit (say, 10000 entries per thread) is reached. Obviously the art here is knowing how much to hide and how much to show, and not only deleting the oldest entries, but also providing ways to creatively "fold" the history so that repetitive details that you don't care about could be ignored.
  • Log things without writing logging code. The current debugger can do this if you don't mind spending a lot of time doing the creation of breakpoints that don't break, but just log stuff. I also like to write logging via code, for production use, and I'm a big fan of CodeSite, or of just roll-your-own trace logging. But I want to profile code and trace its running,way beyond even what AQTime's function tracing can do. I think that AQTime is amazing, but I am sure more can be done. For example, I typed in FRED into an input box. I want to see the parts of the call tree, that have to do with the button I clicked, and the Edit box I typed fred into. I want to follow Fred, through my program. I want mouse clicks to initiate tracing just until I get back into the TApplication process-message-loop.
    Like many things, I know I'll have to write it myself if I want it done right. The thing I don't know is how to start it. If I had the starter-codebase for a simple Application Profiler written in Delphi, I am sure I could extend it and try some of my ideas. Anybody know how to write a profiler for Delphi?

    Update: Visual Studio people have something called Debugger Canvas. If you have Visual Studio 2010 ULTIMATE edition, check this free add-on out. And even if you don't do Visual Studio you should watch this video.
  • Tuesday, April 17, 2012

    Software Development Culture: Art and Science

    I have now been a professional software developer for 25 years. My first software development job was only part-time software development. I wrote and improved an application written using dBase III for DOS, at a surplus-electronics and surplus-military-gear (think parachutes, and backpacks, and camping gear, not weapons) store in my hometown. As an aside, it was the coolest job I've ever had, in addition to being the most poorly paid.
    As a software job it lacked most of what professionals would consider "minimum standards" these days; The product had to be functional at all times, and there was no such thing as "release management". We were working on a live production system, at all times. The version control system was called "making a backup", and involved keeping around enough backup copies of the database image, on floppy disk, which included both the data and the code. There were no code reviews, there were no unit tests, there was no bug tracking database, and there were no development team meetings. For simpler single developer projects in a small non-networked application for DOS, it worked fine. But what happened between 1984 and 1994 is that the software development world fell apart, over and over again, and each time, something new was supposed to save it. Object oriented programming will save us. Blobbygrams (OOA/OOD) will save us. Metaprogramming will save us. Patterns will save us. Formal methodologies will save us. Each of these software tools has its place, or had a place at some time, but nothing has ever been a panacea.
    Figure 1: dBase for DOS: Documentation and installation floppy disks

    Why do we have so much procedure and process now, and so many tools that we never needed or didn't know we needed, back in the 1980s? Because we can't just fly by the seat of our pants. At a certain level of complexity, ad hoc approaches stop working at all, and lead to almost certain project failure.

    Software projects often fail, even when there is a formal process, and the reason we most often pinpoint is that projects are "out of control", and that even though many or most people on the project know that the process is out of control, they can't agree on how to bring it back under control.

    I love version control systems, because they are time-machines for code. And they are a part of keeping a software process under control, and knowing what code went to what customer, in what version of your project. And they're great. You should never work without one. One of the other things that version control was supposed to do was prevent things from changing that we want to keep frozen. Some version control systems even require you to "check out files" before you can work on them, and that "check out" action changes the files from "read only" to editable. (Visual Source Safe, and Perforce, are the two most commonly encountered version control systems that require you to first get a read only copy of the whole file set, then execute a "check out" command to make the individual source files writable before you can edit a file.) Part of the reason for that "read only" flag was that in the early days version control systems lacked real merge capabilities, or that merging was difficult, perhaps considered "risky" or "scary". Most projects that I have worked on, try to achieve such a "frozen" state or 'stable branch' for all major projects. Stability is part of a project being under control.

    The other half of a project being under control, paradoxically, seems to be that everybody wants to keep cramming features into the product. This schizophrenia (stable, yet with new features) seems to be the proximal cause of projects going out of control, in my experience. Rapid uncontrolled progress on a project leads to one kind of diagnosis of project failure (it's unstable, and unusable) and yet, that rarely happens anymore at most places, projects are seen to be out of control for the reverse reason; Nobody can explain or justify how slow the progress on new features is going.

    The most successful software projects I have ever worked on, and all of my favorite jobs, have had one thing in common; the projects that I worked on were "under control", that is, bad stuff was minimized, but also, expectations of developer productivity were reasonably in sync with what was realistically possible.

    My best-ever bosses have all been people who knew what a PID loop was, and most of them could even tune one if they were asked to. A PID loop has at least one sensor-input that reads something from the real world, like temperature, or RPM, or air pressure, or perhaps a virtual input such as a price of a stock on the NYSE. It then has an output, which is something which can hopefully be used to affect the thing we're trying to control. If the input was a temperature sensor, measuring the temperature of a liquid, the output might be a relay on/off control attached to a heater, or it might be a variable output controlling a valve, which can change the pressure or flow of a gas or liquid, or perhaps the output might be the commands to a stock-market-buying-and-selling system. What a PID loop does is take three coefficient terms in an equation, a Proportional term, an Integral Term, and a Derivative term, and use those coefficients to do realtime control of a process. When a process is "under control" it behaves in a predictable way, even when it's disturbed. If the sun came in the window, and heated up the liquid that we're trying to control, a PID controller would handle that disturbance, if tuned properly and the process would not be out of control.

    Software processes are not as simple to control as "one single input", but they do respond to logical analysis, and this logical analysis is conducted at a glacial pace. Once or twice within 20 years, someone comes up with something like the "SDLC" or "Waterfall" or "Scrum" or "Agile" approach to software development. These are promoted as a software panacea. Inevitably, certifications and formal processes take over informal insights into project management, and turn whatever good ideas were at the core of these software development "control" practices, and take all the effectiveness, and certainly, all of the fun, out of being a software professional. It's particularly sad to see "Agile" and "Scrum" get twisted, since the original ideal behind "Scrum" was exactly the insight that software processes are not universally equal and that practices that work in one context might not be workable in other contexts. So, while "Scrum" should have been resistant to such perverse misuse, It has been widely noted that what killed Waterfall could kill Agile, and scrum.

    So given all that, you'd think that I would argue that developer should just be left alone to do what they do, and take as long as they're going to take, and all that. That would be a spoiled, unreasonable, and ultimately self-destructive viewpoint. The best projects I have worked with, and the best managers I have ever worked for, did not give developers enough autonomy that they could derail a business plan, and imperil a company's future. That would have been rediculous. But what they did do, was figure out what sorts of controls, and measurements of the software process were effective, and apply at least those methods and measurements that could be shown to be useful. They were agile without using the word agile. They didn't have code reviews. They didn't have scrums. But they had something which is perhaps the foundational principle behind Scrum:

    Managers, stakeholders, and developers, co-operated, and worked together. Developers were respected, but not allowed to run the show. Managers were technically competent, and understood business requirements, and could ascertain whether or not developers were effective, and were making sufficient headway. Nobody got together for daily standup meetings and said "I'm blocked" or "No blockers", as if that would help. But when a developer needed a tool, he would go to his boss, and he'd get questions, intelligent ones about whether it was needed or not, and if the need seemed real, he would get his tool bought. When a developer was not making good progress, the approach was to see what could be done, pragmatically, to get something done, at a reasonable time, even if it wasn't the full spec that everybody would have dreamed off. That kind of rational change of scope, and attempt to protect project milestones, was as effective (whether we call it timeboxing, or sprints, or milestones) as it could have been, given that what really often held us back, and delayed projects, was the same thing that always delays projects; Inexact, incomplete, incoherent, mutually contradictory or vague requirements, due to a lack of real understanding of the underlying business requirements, or a misunderstanding about the real useful nature of the software product.

    Pragmatism should be the primary value in every development organization,and on every project. Pragmatism stays focused on business. The business of writing software. It doesn't go down blind alleys, it doesn't play blame games, and it doesn't wonder about water that's gone under the bridge, but it sticks to the question; What do we do now, what do we do next, and how do we prevent issues that have affected our ability to do great work from hurting us all again? Pragmatism takes collective responsibility for success, and doesn't blame individuals. It doesn't play political games, and it doesn't stab people in the back. Pragmatic professional software development is not a buzzword, or an approach that replaces human judgement. In fact it relies on human judgement, and only works when you're sane, sensible, and centered in reality. It's just recognizing that there's a lot of superstition and magical thinking out there in the software development world, that needs to be replaced with careful, rational, friendly, collegial, scientific realism.

    Tuesday, April 10, 2012

    Jack Tramiel

    Jack Tramiel, died this past Sunday. A Jewish man of Polish descent, survived the Nazi-holocaust including being imprisoned in a concentration camp, and went on to become one of the most important figures in the microcomputer revolution that is still changing the world. After the war, he lived in the US, and briefly in Canada. He started Commodore in Toronto, Canada (where I live right now) in 1955. Commodore Business Machines made calculators, typewriters, filing cabinets, and other office equipment, until the day they purchased MOS, a semiconductor company that made the 8-bit 6502 processor. Commodore/MOS's first microcomputer product was not even a "complete computer system". The KIM-1 was a single-board that needed a power supply, and some additional circuitry added, not to mention a case, and some kind of display or terminal. Then, Jack brought us the Commodore PET, which was a ground-breaking computer. Early Commodore PET hobbyists were among the first in the home computer craze. The Commodore PET had a black-and-white display, and depending on the model, either a 40 column screen or an 80 column text screen. The PET did not have any kind of "bit map" graphics capability, unless you count the creative use of character shapes in the "PETSCII" custom ASCII-like character set. The Vic-20 was the first computer to sell in mass-market quantities, that could be attached to a color TV set. With only 22 columns across on the screen, I didn't really much like the Vic-20. Here's a screen-shot of a BASIC program on a Vic-20 emulator that gives you an idea of how limited a 22 column screen might feel:
    The next computer was the Commodore 64, the most important computer in the 1980s, in my opinion, because it was the first computer I ever owned. Okay, it's still the best selling computer of all time. I had played around with Atari 400/800 XL computers, the Vic-20 and the PET, the TRS-80, and the Apple II. But no other machine in 1982 could touch the Commodore 64. It had amazing sound capabilities, graphic capabilities including bitmapped graphics and sprites much more advanced than early IBM PC XT and IBM PC AT computers. It could be used with a TV, but a lot of people bought the Commodore 1702 monitor. Very few people ever purchased hard drives for their Commodore 64s, but almost all US/Canadian owners of Commodore 64 bought the 1541 Disk Drive, which stored 170K on a 5.25" floppy disk. I wish I had a picture of me on my commodore 64, but here is a picture of a system much like the one I spent thousands of hours learning to program, playing games, and using Bulletin Board Systems, which we did a lot of the same things with that you might use the Internet to do today:
    Jack Tramiel, and his employees, at Commodore brought a computer to the masses. After leaving Commodore, Jack purchased the personal-systems division of Atari, and masterminded the Atari ST, another amazing computer that was years ahead of its time, and which had a loyal following of its own. My uncle had an Atari ST, and it was a beautiful machine. But no computer has ever been as amazing to me as the Commodore 64. My first "geek love". Thank you Jack. You changed my life. You changed the world. Writing programs on my commodore 64, I felt like I was doing magic. I still feel the same way about coding. When you build something on a computer, you're not just creating a work of art, you're making a little virtual machine, that can seem to have a life of its own. It could be something beautiful and elegant as a wristwatch, a space shuttle, an autonomous robot, or a jetfighter, that lives in a little virtual world called 'your computer'. Even leaving aside the early attempts at "Artificial intelligence" in the 1980s, like "Eliza", writing games was like being the creator of your own tiny universe. You wrote the rules. Watching all the rules turn into a working game felt like you were in control of a tiny universe.

    Sunday, April 8, 2012

    Delphi and OS/2

    The year that Delphi 1.0 was released, my main desktop computer at home, and my computer at work, were both running IBM OS/2 Warp, an operating system that is now 25 years old. I was employed in 1995 to write software for a large insurance company that had invested heavily in IBM OS/2 Warp, using Visual Age C++, a now dead compiler, IDE and tool set. We wrote scripts and tools in a language called Rexx. Rexx was a language that was intended to become what Python, Perl, and Ruby later became; Very expressive, dynamic high level languages, but Rexx was not concerned with doing so in any kind of object-oriented way. OS/2 had a lot of interesting aspects. The desktop environment had a system-level object model much like the Microsoft COM (OLE Automation) model, and it was called the System Object Model (SOM). The desktop was entirely composed of persistent objects which made them much more interesting than the desktop-icon-shortcuts on your windows desktop. Microsoft is often accused of merely buying technology rather than building it from scratch, since DOS, their first big product other than the ROM-basic that came in early 8-bit computers, was actually acquired from a company called Seattle Computer Products. OS/2 on the other hand, was mostly a home-grown project, jointly developed in its earliest days, by both Microsoft and IBM. An early disagreement about the graphical user interface (presentation manager, written by IBM, versus the Windows codebase and APIs, written of course by Microsoft) lead to a "divorce" between Microsoft and IBM, and IBM took over OS/2 development, and marketing, and subsequently (and rather famously) killed it completely. Around the same time, IBM did a lot of other creative things, or rather, bought them from other people, and renamed them, and then failed to market them, and killed them completely. One of those clever things was Visual Age SMALLTALK, which is still alive as "VA Smalltalk" sold by Instantiations, Inc. Some of the original IBM smalltalk people (who came to IBM along with visual age itself) are still working on the product, which is an obscure but beautiful little thing. I played around with Smalltalk, but instead of using their lean fast "Rapid application development" I was building using the IBM VA C++ class libraries, which were (like many IBM products) good in theory, and rubbish in real world use. They had adapted a visual-programming system that actually involved "wiring up integrated-circuit-like components", in some really interesting precursor to "dependency injection" and modern OOP. The problem was, that the system was useless in practice. You couldn't use it to build anything more complicated than a HelloWorld demo without it turning into crap. The company I was working for folded up shop. The insurance company client kept its IBM OS/400 based solutions around for a few more years, until they were eventually scrapped, and they moved to a Windows based desktop like everybody else. At one point, the PC world was IBMs to lose, and now that they're insignificant players in the software market, and have exited the PC hardware market completely, I'm almost sad for them. Almost. Because they were so brilliant in some ways, and so inept in other ways. OS/2 was brilliant except when it made me want to tear my hair out, scream, rant, swear, and fuss. I was an OS/2 fan, except when I was an OS/2 hater. It was a pre-emptively multitasking protected mode operating system, and I ran a bulletin board system on it for years. It was a thing of beauty, in its time. A year ago I decided to get a VirtualBox VM working with OS/2 on it. Fun stuff. But I was reminded how very long ago it was. 16 color VGA at 640x480 was the default desktop screen resolution. No PPP or TCP/IP+DHCP out of the box in OS/2 Warp until 4.0. Not much support for any hardware not manufactured by IBM, any date after 1997. Sad really. Once I learned to use Linux/Unix, and the BSDs, even OS/2's better-than-windows environment doesn't seem that useful or interesting to me. The architecture of a Linux system is far nicer to use, and so flexible and easily tailored, even without looking at any source code. And even the worst GCC and gnu stdlibc releases in all of history, were better and easier to use than the crap that came out of IBM. So I'm nostalgic, but not really. It was good, but bits of it were rubbish. I enjoyed Rexx programming quite a bit, too, but Python is just so nice that I can't imagine writing scripts in anything like that ever again. Delphi is still the one and only Visual RAD tool that I have ever found that was any good at all, and worth using. IBM Visual Age C++ and Visual Age Smalltalk are both dead and consigned to the scrap-heap of history, but they had this fascinating "building from parts" and "wiring up components" ideas that nothing, not even Delphi, has been able to equal for sheer coolness. Sad that coolness and proof-of-concepts were all it was really good for.

    Wednesday, March 28, 2012

    The return of the WebService Demos for Delphi XE (SOAP)

    Delphi SOAP programming was a hot-topic in 2002. And Delphi 7, the current release at the time, was shipping with a series of webservice demos. These were still part of the product until Delphi 2007, and Delphi 2010. These days REST+JSON is a bigger deal than SOAP,but SOAP is still an incredibly important part of the "business integration" layer of the internet. My employer's products give me a first-hand view of the importance of SOAP. It will remain an important part of internet-based B2B connectivity, for the future. Yes, JSON+REST will also be used, but Delphi developers these days need to know both, because eventually someone will need a SOAP server or client interface to your big in-house or vertical market Delphi application. SOAP based services are incredibly important.

    However, a strange thing happened; The Web App Debugger (WAD) which was always the weirdest part of the WebServices architecture in Delphi, went away. That left you with WAD-based demos that didn't work any more, and CGI based demos that required either Apache or IIS with CGI support, to run Delphi apps through an external web server. Hardly an easy way to develop, prototype, or demo web-services. Then Delphi 2010 introduced (and XE and XE2 continue to have) the ability to have the SOAP Web Services new-application wizard make an INDY VCL server. That made the server application into a tiny normal VCL application. While that's still not the best way to deploy a large-scale production environment, it's pretty useful for debugging, and can also be a reasonable way to deploy certain very-lightweight (internal LAN, not internet-facing) SOAP server systems, for 1 to 100 concurrent connections, or so.

    Anyways, the demos were just plain not anywhere to be found in Delphi XE, and are still gone from XE2. When I needed to make a SOAP server and client and make them talk, there wasn't a demo anywhere to be found that ran in Delphi XE. Now XE2 is the current version and the mess continues. I asked a question almost a year ago (June 2011) on stackoverflow, that got a lot of not-quite answers, and a few links to tutorials, but no code, and no demos.

    So I fixed the demos, and I've posted them on CodeCentral. They're here (item 28789) on CodeCentral. I have tested all of them on Delphi XE, and tested most of them on XE2, and they all build on both, and run perfectly well on XE. If anybody finds any bugs in them, please email me (my email address is in the readme).

    I intend to update that code-central article with new versions when needed, if new Delphi language changes make it possible. My next SOAP demo will be VisualStudio/WCF/C# interop demo between Delphi and C#/WCF. I would like to add a Java interop demo too. I'm awaiting word from Embarcadero if they'll allow me to turn this set of demos into an open-source project so that we can get Delphi+SOAP demo contributions from all over the place.

    I hope you find them useful if you are interested in SOAP programming with Delphi XE, and are wondering where all the demos for SOAP applications programming went.

    Wednesday, February 8, 2012

    Feb 14: Happy Birthday Delphi

    Embarcadero are having a Birthday Party celebration for Delphi's birthday on February 14th. Sign up here.

    Friday, February 3, 2012

    The Keyboard Cult (Delphi Code Monkey Edition)

    Programmers use keyboards all day long, and so we tend to get exercised about our favorite, and least favorite keyboards. I have been on a bit of a "keyboard" jag lately, as I have been through a series of keyboard disappointments, and I'm confident that keyboards, if done better, might do more to help programmers than any other innovation in computing. This is big.

    Jeff Atwood rather famously blogged some time ago about the Keyboard Cult in programming. His article mentions the various types of key technologies available (dome versus keyswitch), layouts (curved ergonomic, standard, and oddball ergonomic units), and various things. I'd like to talk about how important keyboards are to doing our job, as programmers, no matter what language we use. My history, as a Borland Barbarian and Turbo Pascal geek from the late 80s and early 90s factors in here, and so I'll call this the "Delphi code monkey" edition of the Keyboard Cult discussion. I am a programmer of a certain age, I've been writing code for more than 27 years, and I've been getting paid to write code for the last 24 of those.

    I'd like to go back through the keyboards that mattered most to me, in the years I have been a software developer, and point out what made each one great, or not so great.

    Pre-Computer Era: The IBM Selectric Typewriter

    I learned to touch type in Grade 9, on an IBM Selectric II electric typewriter. My typing teacher taught us the classic typing techniques, that were taught to her, back when she started on a manual typewriter. Starting with home keys (F and J), we did simple "move away from home row and back" exercises. The first day started with "F-R-F" and "J-U-J" repetition exercises. This helped us acquire muscle-memory knowledge of the QWERTY layout, and after the basic layout is comitted to muscle memory, we would do drills to increase speed, all the while "not looking at the keyboard". If the keyboard had in fact been blank, with some color codes we probably would have learned more quickly,once the initial fear of looking away from the keys had been overcome. By the end of grade 9 I could touch type at 60 WPM. I am currently around 120 WPM, while writing code, and up to 150 WPM while composing English sentences in a word processor. I do not think at all about what I'm doing while I'm typing, any more than a pianist has to think about where the black key for C#/D-flat that is two octaves above middle-C is. I bet that if you put all the names of the notes on a piano it would only slow down a beginning pianist, and that the best approach would be to put dots where your home left and home right hand position are, and to let your brain learn by muscle memory and repetition where everything is.

    The letter keys, and most of the punctuation keys on the computer keyboard in front of you right now are mostly the same as this IBM Selectric, that is, if you live in the USA or Canada. The only punctuation move that I can see is that the shifted 1 key is an Exclamation point on PC keyboards, but it's a plus-minus (±) sign on this IBM Selectric layout. There are no cursor keys. There is no escape key, and the only modifier key (Ctrl,Alt,Meta,Command) is the Shift key.

    The first time I used a computer keyboard, I had to learn about even more additional keys that only appear on a computer. When I was in grade 8, a classmate brought in a "TRS-80" microcomputer. Everybody thought that the red key labelled "Break" was hilarious. "Look at me, I'm BREAKing your computer" the kids yelled at Steve, as they pressed the Break key. We didn't know what it did.

    8-bit Microcomputer Era: The Commodore 64

    I learned to code on a Commodore 64, in BASIC and Assembler, using a keyboard, without a mouse.

    Basic programming was done using line oriented program entry without a text editor, IDE, or anything other than the 4K ROM BASIC that shipped hard-wired into the computer, and which came up automatically when you turned it on.

    The version control system we used was called "save early, and save often, and don't re-use the same file-name twice", and in practice, it looked like this:
    SAVE "PROG032",08 

    I still long for a return to a simpler keyboard. If you do too, you might be interested in the spiritual successor of the Early Hacker Keyboards. One of the best is called the Happy Hacking Keyboard, and if you yearn for simpler days, this might be keyboard nirvana for you. There are also a whole raft of "tenkeyless" keyboards, including the venerable IBM Model M Compact.

    If you are in fact still a Commodore 64 hacker at heart, then what you really want is the all new Commodore 64 X, from the reborn "Commodore USA". This isn't just a keyboard that looks like a Commodore 64, it's an actual modern PC capable of running Windows 7 or Linux, shoved inside the loaf-of-bread size plastic box.

    88 and 101 Key PC Keyboards (1987-1994)

    Like most people who had 8 bit computers, I bought my first PC clone in the late 1980s. I never owned an IBM-branded computer, I used a series of clones, and their clone keyboards, and I adjusted each time to slight differences in the keyboard layout. At some point after the introduction of the IBM PC AT, powered by an Intel 80286, the backslash key moved to the position above the enter key, and stayed there, and a lot of programmers like me got used to that position, because the backslash is the path separator in DOS, and the special-character-in-a-string-literal code in the C family of programming languages. I did not love, and did not hate any of these keyboards. When Windows 3.1 came out, I did not immediately add "using a mouse" to my programming techniques. I used DOS-based IDEs to write software, and became proficient in the use of hundreds of keyboard shortcuts. `Shift+F8` meant "Run until return" in Turbo Pascal, and is still the default shortcut for that feature in Delphi today.

    Certain elements of this keyboard layout are no longer optional, but are essential to my ability to write code now. A standard IBM PC AT cursor key arrangement (the inverted-T format), the location and size of the insert/delete/home/end/pageup/pagedn keys above the cursor keys, the location of delete, backspace, Escape, enter, backslash, ctrl, alt, shift, and almost every other key, must not change, I will become quickly frustrated. My brain is no longer capable of adjusting to changes in keyboard layouts, just as my eyes have a harder time adjusting to different focal lengths.

    Ergo Keyboards Era(1994-2012)

    When the original Microsoft Natural Keyboard came out, I became a devoted owner and user of the keyboard. I owned several, and they lasted me almost ten years. In the end, Microsoft makes the best curved-top ergonomic keyboards out there, and my favorite keyboard, which is no longer available, is the original 1.0 version of the Microsoft Natural Keyboard. The current "Model 4000" has normal PC cursor keys. These are the most acceptable keyboards that I have found that accomplish several objectives for me:

    1. Help me type quickly and accurately.
    2. Help me work all day without getting uncomfortable, or getting RSI, or carpal tunnel syndrome.

    The Ugly Truth

    I wish there was something out there that was better, but for the life of me, I can't find it. I am unwilling to learn a completely new way of inputting data (such as DataHand) or radically altered ergonomic keyboards like Kinesis.

    Mechanical keyboards help me with problem #1 above (speed,accuracy) because the click sound is a form of positive feedback. However, they do not help me with the RSI/soreness problems that conventional keyboards have. What I wish I could find is something that combines the mechanical feel of a good clicky Cherry MX keyswitch, with an ergonomic layout.

    Think Different?

    The other alternative I'm considering is using an Apple aluminum keyboard. The thing about them, is that the small tenkeyless (No numeric keypad) ones are almost as small as my much beloved Commodore 64, or the happy hacking keyboard, and the low-travel design of the low profile keyboard, might just be less stressful on my hands then even the ergonomic keyboards from Microsoft. Right now I'm typing on my macbook pro, and I notice that my hand position is nearly as relaxed and open as the position I can maintain on my computer at work, where I've got a Microsoft Natural Keyboard Pro that is about 10 years old.

    What do you think?

    I'd like to hear from you, what you like and what you expect from a keyboard you use all day to code.