Wednesday, June 27, 2007

Who Writes the Program Here, Anyway?

 The diagram to the left represents a very simple quote.  Each quote contains multiple lines of business, lines of imagebusiness contain products.  Easy enough.  If the quote header is in a state which renders it read-only, however, none of its children should be editable either.

Faced with the challenge of making this work yesterday, I am ashamed to say I almost gave up.  This object model is easy to understand and manipulate, but when mapping to a database the object model begins to crumble.  This was exacerbated by some very early design decisions in our back-end library.  Our design revolved heavily around run-time modifications.  If a vested party asked for a new field on a screen, we wanted the ability to add the field at run-time.  We used business objects to implement business rules.  These objects represent tables and inherit from a single source.  At runtime we can change the BO for a selected table using reflection.

This approach uses the tenets of object oriented programming in working with and representing tables of information.  It does not allow for modeling of objects as represented in the figure above.  Everything was peachy until I got stuck between large releases.  The release version of the configuration file would continue to get out of sync with the development version.  I switched the model a bit, and now runtime changes can be saved...but they must be compiled into the main executable.  I lost my ability for runtime modification, but I still didn't have to design 80+ individual screens at design time.  I can drag fields around at runtime and save my changes.

Back to my problem from yesterday.  In order to determine the state of a quote header at the product level, I would have to find two queries in the configuration file, execute them, and then use the results to determine if the quote was editable.  What a pain.  Worse, if someone unwittingly changed the configuration, this subtle piece of code would stop working. I almost threw my hands up in desperation.  Perhaps I would make it impossible to drill into a quote that was read-only.

Then I started to realize some things.  I'm the coder, not the library of functions.  Runtime design is high maintenance for the reasons I just mentioned-there are very few compile time sanity checks.  Why not use application resources to associate business functions with stored procedure names and descriptions, and then create a stored procedure executor?  Then I could have the compile time checking I need, and the flexibility I crave!  I did it, it works, and it works well.  More importantly though...I realized that version three of our library needs to be designed around a real object mode, not a "sort of" object model.  The very reason I didn't like my own library is the very reason I don't like other libraries: lack of flexibility.  Finally, in order to make my new vision work...I'm going to need to change my coding habits.  I've been breaking the rule of designing to interfaces instead of classes.  Now I've got a bunch of display classes that only work with SetTableBO instead of something more flexible like iSetBindable.

Monday, June 25, 2007

Perspective

During our routines, it is so easy to act in a way that ignores the feelings of the people around us.  This is a crime with which I am intimately familiar.  In order to remind myself that I am not, in fact, the center of the universe I printed out the definition of compassion and tacked it over my desk.  From Princeton:

compassion: a deep awareness of and sympathy for another's suffering

Something happened today that really bothered me.  I rode my bicycle home from the office, and it was hot.  There were three cars on the side of the highway on the way.  The first was helped off the road by another motorist.  As he drove away, she was dictating directions into her phone.  No worries there.  The third car was on the opposite side of the divided highway, and was being helped by three other cars.  The second was on my side though, and I stopped to see if I could help.

At first I thought the car had a flat tire, but it soon became clear that there was something else wrong.  The driver was probably about 65.  He wore a ball cap, used a hearing aid, and had a complete set of tools in his car.  In fact, he had on leather work gloves.  As I inquired about the state of his vehicle, he explained that it had started shaking violently as he drove down the highway.  He was trying to determine why.

The gentleman was very proud of his car-an old Ford Escort (or similar car) with a diesel engine that he claimed got 50 miles per gallon.  He went on to explain that it had 1/4 of a million miles on it.  I believe him.  Unfortunately I couldn't help.  This was more than a tire change, he already had a phone, and since I was on my bicycle I could hardly give him a ride.

When I asked if he had a phone, he said he did and he could call 911 if he had an emergency.  His intention was to try to return to Lansing to further diagnose his car.  I wished him luck and took my leave.

Riding away I realized something shameful.  There was not much I could do to help him, but I didn't even get his name.  Is it possible to have a deep awareness of, and sympathy for another person if you do not even take the time to get their name?  It was then that I realized how out of touch my perspective is.

My wife and I have our own "tribulations", but they are completely different than the trials of this man.  We have a supportive marriage, a wonderful daughter, and everything else we need to maintain our relatively modest lifestyle.  We drive two cars, we both go to school, and only one of us works.  We cannot imagine being unable to call a tow truck for a short tow.  We do not know what it is like to drive a car 250,000 miles.  Any time we have a problem we can find someone to help.  911 is the last number we would ever call.  Given the above information I have come to a sad conclusion.

I am incapable of feeling compassion for this man.  Not because I do not want to, but because I cannot have a sympathy for his suffering because I am so far removed from it.  My perspective is so different that I am unable to fathom his situation.  And I couldn't even show the curtsey of asking his name.

Friday, June 22, 2007

Good Riddance to the Airlines

An article in the Lansing State Journal today proclaimed that air passengers should be on their best behavior to "avoid hassles".  That is precisely the reason that the airlines should be allowed to go out of business.  No more help from the federal government.  Any business that routinely treats their customers like trash deserves to fail miserably.  How about this approach: maybe the airlines should go on good behavior for a refreshing change!  Nothing irritates me more than paying a small fortune to a company so that they can abuse me for a day.  Does that really make sense to anyone?

Since the airline industry has demonstrated a continual contempt for passengers, I can only look forward to a day when I can declare "Good riddance, airlines."

Those Crazy Law Students

First, I'd like to apologize for note getting a picture to demonstrate what I'm talking about.  This afternoon as I was returning from an errand, I walk past our local law school.  In passing, I observed a scooter chained to one of the bike racks.

Gas Scooter (United Kingdom)Now, this thing is pretty large.  It caught my eye.  Without really considering what I had seen, I kept on walking.  At the end of the block I came upon another building from the same law school, and another scooter chained to a bicycle rack.  My first thought was "What kind of cheapskate buys one of these things in order to scam free parking at the bike rack?!  A moment of reflection reminded me that I was standing outside a law school.  Then I realized, these are perfect for law students.

They don't cost much to run.  Parking is free.  If you get hit by another motorist, you can sue them and get credit for an independent study project!

Thursday, June 21, 2007

Now we'll try posting!

I wrote this post just to test out Windows Live Writer.  Really cool stuff.  It can't post images, even though one appears below.

s41170ca105356_5_0 How did I work around this limitation?  You can actually configure an FTP server, and Live Writer will post the images on your FTP server and link into the blog.  Problem solved!  Otherwise, a very promising piece of software.

Sunday, June 17, 2007

The Pancake Nazi

Aimee has been telling me for quite a while how wonderful Saugatuck is. We had never gone there together, so we decided to spend a night there as part of our anniversary tradition. It is a pretty neat place, especially the state park.

While were were searching for a place to have breakfast, we wandered past Ida Red's. The line was out the door and down the block, though, so we didn't stop. On our way back through we were ready for lunch, and they were able to seat us immediately.

The patio was fantastic, with all kinds of foliage visible out the back of the restaurant. As we perused the menu, we saw an item that made us think of my brother. My brother is the world's greatest connoisseur of pancakes. In fact, finding a place he might like the pancakes is a huge achievement.

Yep. Alan might like those. What you can't see on this blurb of menu is their description of the ingredients. They claim to use only fresh fruit and real butter. We were just about to call and tell my brother that he should come try these out, when we saw the show-stopper\deal-breaker on the back:

Hmm. Have I ever seen him order off a menu without tweaking it first? Maybe he wouldn't like this place so much after all....

Wednesday, June 13, 2007

4 Years!

Thank you Aimee, for the best seven years of my life. Our four years of marriage have been wonderful, and I'm looking forward to many more!
Happy Anniversary!