Delphi Programming

and software in general.

Saturday, August 28, 2010

How time flies...

It is amazing how time flies when you get engaged to the woman of your dreams, and move to another city! In the midst of moving all the furniture, refurbishing and selling the old apartment, getting to know my new bonus kids, and walking the dog - I also changed jobs :) I am no longer an Oslo citizen, but mainly work from home, about 180km further south on the sunny coastline from Oslo. So... what happened on the Delphi level of things?

Status: D5 -> D2009 port: It never completed. The dependencies between the old TopView grid and the database ORM were too large, and the TopView component turned to be for all practical purposes - non-portable. Not only because of the Unicode change, but also due to the fact that they changed the database TBookmark definition. At that point, it became clear that there was not enough resources/time to complete the work needed to complete port within reasonable cost.

I did plan on writing further posts on the migration process, but the main points about the Unicode change have already been covered elsewhere. All in all, it is quite remarkable how smooth that transition seem to have gone.

In January 2010, I began in a new position at Tine SA. No more porting projects, but writing and maintaining data warehouse, production and logistics related code for the dairy product manufacturing at Tine, using Delphi 2010, and integrating with Lawson's MOVEX M3 AS/400 ERP systems, as well as various robotic systems, using MSSQL Server 2008 as the backend.

The Tine team is a distributed team, working from many different geographical locations, that meet up at the same place physically just a few days every month. I am pleasantly surprised of how enjoyable and effective this way of working is! Naturally, it requires a bit more planning and coordination, but with good project management and regular meetings - it works better than I could have hoped for. The only drawback is that when I am mentally engaged in solving a new software challenge, my lady will complain that I spend too much time by the computer :)

Generics: We recently started refactoring the class hierarchies using Generics, and that has shaved about 7% off the number of lines of code in the projects so far. Hopefully, when we are done - the codebase will be 10-15% smaller than what we started with, and a lot simpler to maintain.

Generics is fun. Generics is also somewhat painful, as there are a lot of flaws in D2010. I can't wait to see which 87 generics issues that have been fixed in Delphi XE!

During the fall, I plan resuming the work on the FDCLib, and focus on getting the most out of Generics, Attributes, and Anonymous Methods. Stay tuned.

2 comments:

  1. I'm confused:

    "Status: D5 -> D2009 port: It never completed. ... Not only because of the Unicode change ..."

    "it is quite remarkable how smooth that transition seem to have gone."


    A transition may be smooth, but if it never completes, is it really a transition? A smooth ride down a blind alley still surely leads nowhere?

    ReplyDelete
  2. Jolyon,

    My apologies for confusing you :) I guess I didn't express clearly enough that I was reviewing the Unicode transition in general, and not only for the failed port in specific, with that statement.

    For most of my old code, it has been only the char in set and a few size/length checks that needed tweaking. Also, when writing new code, I rarely have to think about treating Unicode strings in any other way than I used to treat the old strings. That is the part I was thinking of when calling it a smooth transition.

    The Unicode part of the incomplete migration was fairly straightforward. Mostly a few suspicious buffer casts and size/length checks had to be redone, in addition to the char in set operations. There also were a few places (typically data import/export) where the character set encoding of content going in and out had to be defined, effectively tossing out some code that "manually" translated characters on a char by char basis.

    The challenge was the changes to TBookmark (pchar to TBytes). I have to place most of the blame on TopGrid here, as it used the bookmarks quite heavily, and put pointers to internal structures within the bookmarks (using pchar buffer offsets and pointer casts - dirty, but efficient). The problem with TBytes is that is a managed type. Hence, unless you declare and allocate a variable or property for your bookmark, it will be dereferenced and destroyed when it goes out of scope. With the new TBytes based bookmark, it becomes more of a transient type of reference, than the semi-persistant reference TopGrid treated it like.

    The referencing challenge, the use of internal structures coupled with the bookmarks in TopGrid's datagrids, and the very tight bonding with TopGrid in the inhouse ORM - made the work required to fix the bookmarks, or replace the grid - a major task. That was what really sunk the migration project.

    Other comments on the TBookmark change can be found here: http://sourcecodeadventures.wordpress.com/2009/08/24/delphis-broken-bookmarks/

    ReplyDelete