Saturday, May 05, 2007

Delphi 2007 and Binary Compatibility

A really cool feature of Delphi 2007 is it is binary compatible with Delphi 2006 (on the Win32 side). What this means is that unlike every previous Delphi and Turbo Pascal release (as far as I know) you can keep all your compiled DCU files. That means you don't have to wait / hope / pray for your 3rd party component provider to release an updated release for Delphi 2007, most of your Delphi 2006 components for Win32 will work just fine.

Typically what makes a DCU stay compatible is if the interface section of the unit remains unchanged. The really cool thing about Delphi 2007 is they added a new property to TForm for support of Vista Aero, but they still remained backwards compatible.

Allen Bauer broke the news about how this was pulled off. Steve Trefethen has some more behind the scenes details. And as usual, Hallvard Vassbotn has a great technical write-up on all the details.

One really cool think, is I think it was Nick Hodges that said they might actually go to a release cycle that only every other release of Delphi was a breaking release. That would certainly be cool, but their component partners might not like that so much.

Technorati Tags: [] [] [] []

Free Turbo Delphi, C++ or C#

Just in case you some how missed it, you can get a free Turbo product from Borland / CodeGear. You your choice of Delphi for .NET, Delphi for Win32, C# Builder or C++ Builder, but you can only have one installed at a time. They are based on Delphi 2006. The catch for the free version (called Explorer) is you cannot install components, add-ins, etc. and can only have one version installed at a time. You can buy the Pro version for just a little bit more and lift those restrictions.

[TurboExplorer.com]

Future version will be based on the newer Delphi IDE's. I suspect that after they come out with Delphi Studio 2007 (guessing on the name) with support for .NET, Delphi, C# and C++ then they will have an updated Turbo release. They hinted they may change the restrictions some then too.

Technorati Tags: [] [] [] [] [] [] [] [] [] []

Friday, May 04, 2007

Delphi 2007 IDE Multi-Monitor Support

Last night Steve asked if you could change the docked and embedded Delphi 2007 IDE to look like Delphi 7 and earlier where everything is undocked and the designer is not embedded in the same window as the code. This is especially nice if you have multiple monitors! I couldn't remember how to do this at the time. Nick Hodges, the Delphi Product Manager at CodeGear, just made a great video showing how to undock and unembed the IDE so it looks more like Delphi 7 and earlier.

The video only takes about 2 minutes and is part of his 2 minute tutorial series.

[Watch]

For the record, you CANNOT have a docked IDE with an unembedded form designer. If you skip the step he includes of switching to undocked, and just uncheck the Embedded Form designer option it switches you to undocked automatically.

Here is what to do, if you don't want to watch the video:

In the Delphi 2007 IDE go to Tools / Options, which brings up the Options dialog. From there go to Environment Options / VCL Designer in the tree on the left. Then in the Options box on the right uncheck the Embedded designer check box. Restart the IDE and you are reliving the good old days!

Lets see you do that in Visual Studio! Multi-monitors is a huge performance improvement, so anything that takes better advantage of that is a great thing.

Technorati Tags: [] [] [] [] [] []

Wednesday, May 02, 2007

8 defensive programming best practices

This article is written for PHP, but at the high level these 8 practices apply everywhere. Here they are (with comments by me). The original article has more comments and PHP specific resources.

  1. Handle unexpected conditions - of course you cannot expect every unexpected condition, but you can write code to handle things when they don't happen as expected. Even if the code just raises an error.
  2. Process external systems data properly - Instead of just assuming all input and output is correct, validate it. Be sure you are getting what you are expecting, and that what your program produces is correct. This is especially an issue with SQL and HTML injection!
  3. Test your code - Hello McFly, anyone home? You need unit tests, regression tests, UI tests, user tests, etc. Then look at what you are not testing and test that. Especially if you are releasing to the public.
  4. Monitor your site errors and act upon them - Whatever kind of development you are doing, you need to log all errors (serious and minor) and if possible centralize them. Then analyze your error logs and do something about it. When you start seeing those exceptions you put in for #1 show up, that means the unexpected happened. Now that you know what it is, you can expect it and act on it.
  5. Do not disclose errors to the users -This is huge for websites. I don't know how many times I have been using a website and it breaks and I am presented with a beautiful debug screen with all sorts of juicy details that if I were a hacker I could make use of. This is the worst with ASP/ASP.NET sites. Remove debug messages when you release - same goes for non-web development.
  6. Damage control - Make sure your program fails gracefully. Save the users data often.
  7. Backup - This is another really obvious one. First of all, use a GOOD source control system so you are backed-up during the development process. Remember to backup your database and other non-source code bits too. Then backup your users data for them. Even if you can't force them to backup their data, at least make it easy.
  8. Do what you can as you can never get defensive enough - This is like Lather, Rinse, Repeat. Once you have done all the above, refactor your code, and go through the steps again. Just be aware that things break. This goes back to #6. What can you do to make sure they don't break to bad? That is a good start.

One other point it makes is "If anything can go wrong, it will." I would not say that every worst case scenario will play out. I will however say that the more possibility for malfunction you leave, the greater the chance. Also, the more users you have, and the more time the users spend using your application, the greater the odds of any errors showing up.

What are your defensive programming best practices?

Technorati Tags: [] [] [] [] []

Monday, April 30, 2007

Microsoft Announces IronPython and IronRuby

The big Microsoft announcement is out at MIX. Microsoft has formally announced support for IronPython and IronRuby, as well as more goodies for SilverLight.

Also, SilverLight is now in GoLive licensing -- meaning we can officially release software for it. (if you happen to have some laying around right now)

You can read the details at Soma's blog.

Technorati Tags: [][][][]

Saturday, April 28, 2007

Robocode Java Programming Challenge

According to Chris Brandsma, it appears David Starr has thrown down the gauntlet and challenged the rest of us to a Robocode Java Programming Challenge. In Robocode you use Java to program a little 2D robot to maneuver in the virtual arena and do battle with the other robots.

I always thought this was a great type of game. I built a fairly good robot for the 3D D-Robots from PlasmaCode (link no longer available, but I will find it if you are interested). The D in D-Robots is for Delphi, which is actually Delphi Web Script, a 3rd party, open source, Delphi syntax compatible scripting language. Just in case you didn't know, Delphi 2007 for Win32 is out (and ROCKS!) and there is also free Turbo releases of Delphi.

I figure this is a great way to brush up on my Java, and also have some fun doing virtual battle! One major advantage Robocode has over D-Robots (beyond still being available) is that Robocode is open source (as is Java now), so you know it will stick around as long as people are interested. Anyone else interested in a competition?

Technorati Tags: [] [] [] [] [] [] []

Thursday, April 26, 2007

Basics of Compiler Design

Torben Mogensen from DIKU as the University of Copenhagen is offering the text book he has written on Basics of Compiler Design for free use.

I have taught an undergraduate compilers course for over a decade. In the last several years, I have used my own textbook "Basics of Compiler Design". I have now decided to make this available online.

Permission to copy and print for personal use is granted. If you, as a lecturer, want to print the book and sell it to your students, you can do so if you only charge the printing cost.

Technorati Tags: [] [] [] []

Thursday, April 19, 2007

Ubuntu 7.04 Feisty Fawn Released

The new version 7.04 of Ubuntu Linux is available for download in both Server and Desktop editions. Check out the release notes and find a mirror and download it.

The desktop edition comes in a combination LiveCD (that runs from the CD) and installer, while the server version includes no GUI and is ready to create the perfect server for you with everything installed, and no ports open. The installation is really quick and straightforward.

Technorati Tags: [] []

Visual Studio "Orcas" and .NET FX 3.5 Beta1 shipped!

Visual Studio "Orcas" and .NET FX 3.5 Beta1 shipped!

You can read about it on Soma's blog. Or go right to the MSDN page.

Technorati Tags: [] [] []

Monday, April 16, 2007

WPF/E = Silverlight

OK, this is a first. Microsoft takes a crummy, unmemorable name like WPF/E and turns it into something interesting, like Silverlight.

Granted, some people still aren't going to like the new name, you can't please everyone, but I like the direction. Read more about Silverlight here: http://www.microsoft.com/silverlight Or on Soma's blog.

Technorati Tags: []|[]