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.