Aaron Feng

Monday, January 23, 2006

Database Migration with Ruby on Rails

Our application will eventually have to support multiple databases like many other applications. Managing schema for multiple databases can be really tricky. One simple solution is to write DDL for all the supported databases. This is a very time consuming solution if you are supporting 2 or more databases. On top of that, how do you keep track of the version of the DDL for each client (some of our clients require custom schema) once the software is deployed?

Ruby on Rails
has a clever way of handling database migration. But wait! We are building a Smart Client application, not a Web application. ROR database migration is useful even if you are not doing a Web application. If you have no idea what ROR migration is about, you should watch this video. Right out of the box, it didn't do exactly want we wanted, so we had to tweek it by adding some code. Thank God for Open Source projects.

By default, ROR migration doesn't handle Stored Procedures because ROR projects use the built in O/R mapper. That's no big deal to us because we are using Wilson O/R maper, so we don't mess with Stored Procedures anyways.

Steve has a great artcle on ROR migration. He does a much better job explaining it.

Tuesday, January 17, 2006

Philadelphia Agile Users Group

Today I finally made it to my first Philadelphia Agile Users Group with my coworker. We got there a little bit late, so we didn't get a chance to talk to everyone before the meeting. We did a "Fishbowl", and the concept is very interesting to me because I have never seen it done before.

For those of you who don't know what a Fishbowl is, I'll try to describe it as best as I can. Basically, you setup four seats while everyone gathers around the seats. Whoever sits down first gets to start the topic, and whoever wants to join the conversation must sit down in the empty seats. When all the seats are occupied one person must get up and stop participating in the conversation. So basically the conversation carries on even when one person leaves. This is interesting because it gives anyone who wants to participate a chance to talk. I think overall it was an good experience, but it could have been better if we could have made it earlier. Maybe next month we can go earlier, so we can get a chance to talk to everyone before the meeting starts.

Monday, January 16, 2006

DataGridView Adventure

DataGridView is a new feature in .NET 2.0, it is supposed to replace DataGrid one day. Recently I have been playing around with DataGridView a lot to extend some specialized features for work. However, I ran into a road block when I tried to retrieve the area of a displaying row.

I tried to use GetRowDisplayRectangle(int rowIndex, bool cutOverFlow) to get the current Rectangle of a row. For some unknown reason it never returned the correct size no matter how many columns I have in the DataGridView.

If you are new to DataGridView but not new to DataGrid, here is a document that does the comparision and explains some of the new features.

Tuesday, January 10, 2006

SharpDevelop

SharpDevelop is an open source IDE for .NET. It is a great tool to use if you don't have Visual Studio on hand. Maybe it will be as good as VS one day. I downloaded SharpDevelop2, which is compatible to .NET 1.1 and 2.0. I was very impressed on how far this open source project has come along since I looked at it last year.

SharpDevelop2 has many features similar to VS 2005, but not all. It is worth taking a look at, if you haven't already. I really love the NUnit integration found in SharpDevelop2. It would be great if VS 2005 had the same integration.

I didn't really play around with it very long because it crashed shortly after I tried to open a VS 2005 solution from work. I'm sure not all the features of VS 2005 have been implemented. That is probably the reason for the crash.

I'm sure in a few months all the features of VS 2005 will be implemented. I hope so.

Monday, January 09, 2006

ANTLR

ANTLR, developed by Terrence Parr, is a great tool to generate Lexical and Syntactical analysers. It is useful if you want to build some kind of translator or compiler. It will generate all the code for you in various languages, (Java, C#, C++, and Python) if you can provide the EBNF grammar.

I haven't had a chance to build something useful with it yet, but hopefully I can in the very near future.

Ashley J.S Mills has a great ANTLR tutorial that can be found here.

Sunday, January 08, 2006

IL Merge

Today I saw a neat tool called IL Merge. It merges multiple assemblies into one single assembly. This might be pretty useful for deployment when you have a lot of assemblies.

Saturday, January 07, 2006

Don't Have Time for more Information?

I am a pretty lazy reader, so I found ITConversations an easy way to get more information, just drop it into my iPod and listen. Here are some of my favorite conversations:

Paul Graham - Great Hackers
Alistair Cockburn - Agile Software Development
Kent Beck - Developer Testing
Joel Spolsky - Joel on Software
Steve Wozniak Part 1
Steve Wozniak Part 2

Thursday, January 05, 2006

DateTime Trick

Rencently, one of my co-work showed me a pretty cool DateTime trick. I needed to retrieve data for a given day from the database.

DateTime startDateTime = DateTime.Now.Date;
DateTime endDateTime = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);

Pretty cool, huh? Well, I like it =)

Wednesday, January 04, 2006

ClickThrough

What attracted me to use WiX project in the first place? Well, I need a simple way to create MSI package for work and writing XML file is definately simple. On top of that, WiX is free and Opensource, what more can you ask for?

Last night I checked source forge, and to my surprise, there's a new tool called ClickThrough included in the WiX tool kit. I know ClickThrough is still in the beta stage, but I decided to give it a test drive.


It used to take me a good 30 minutes to create a very basic MSI package by writing raw WiX files. Using ClickThrough, it took me 30 seconds and I can update the deployed software via RSS feed. I can't wait to see what features are coming next when it's offically released.

You can find out more about ClickThrough on Rob Mensching's blog.

Tuesday, January 03, 2006

Automated Daily Builds

Our build server slowly died during the end of an iteration, and it stayed dead for the next iteration. The reason it was down so long is because we had to wait for our IT group to re-image the machine. I hate how we don't have full control over our build server, but that's another story.

For a WHOLE iteration, we were unable to do daily builds. I wasn't too worried about it because I know the build server will be restored sooner or later.

During our next iteration planning meeting, we did a recap with the business people by demonstrating the software. Since we didn't have automated daily builds, no one outside of development had access to the latest code.

Too make a long story short, there were a lot of surprised and puzzled faces for people outside of development. We spent the whole morning explaining why certain things are done. I'm sure this wouldn't have happened if everyone could see the software on the regular basis.

Monday, January 02, 2006

Want to be a Highly Effective Programmer?

The president of Technicat, Phil Chu, gives us some hints here.

Sunday, January 01, 2006

Null Object?

Last week I was browsing though Martin Fowler's Refactoring book at the airport, in hopes of finding a solution to a recent problem at work. I found myself reading on Null Object......

To make a long story short, I had to add a conditional branch block to each method in a class to avoid the code from doing improper calculations. If some condition is true, then return zero; otherwise, continue doing the normal calculation. The code started to smell and turned ugly fast.

By using Null Object I can hide a lot of the ugly conditional branches. I'm also a big fan of Fail Fast by James Shore. Null Object will make the code appear to be cleaner, but the code will be harder to debug if there's a logic error.

I'm not sure what path I should take right now, maybe Null Object is not what I'm looking for.