Alieniloquent


Interesting Times, Indeed

July 15th, 2005

So, a couple weeks ago, my friend Joe got in a car accident. Erica and I went and helped him and his wife out that afternoon. Little did we know that the car accident virus was being passed on to us.

I got rear-ended on the way home from work. I was traveling east on 72nd near Dodge (right by where I live) and the traffic was backed up (which it frequently is there). I came to a stop, and the guy behind me thought I was moving. The result? My bumper was bent so far under my car it rubs up against the rear wheel. Not exactly drivable.

Nobody was hurt. The guy was nice. I’m still waiting to talk to his insurance people, but I’m sure things will work out just fine. Not exactly my idea of fun.

Baby Stepping

July 14th, 2005

The product I work on is big. It has hundreds of thousands of lines of code. There are some objects in that code that are used all over the place. A lot of those objects are actually kept as global instances. This, of course, creates all sorts of problems about data being synchronized and memory being freed. The solution, of course, is to not use global objects.

While not using global objects is the solution to the general problem, it is not easy in the least to make that change. There are hundreds of places where these objects are used and each place is a little different. So, it would be fairly costly to go in and fix them all, and it wouldn’t show any visible business value.

So how does one approach the problem? With baby steps. Each time I am in a piece of code that uses one of these global references, I look at it to see if I could pass in an object as a parameter to the method instead. If I can, then I make that change. I just pass in the global at the call site, so it’s still using the global object. But, now that method has been severed from depending on the global object. If you conscientiously do this as you go through the code, leaving it a little better every time, then eventually those hundreds of references will become a handful. Once you only have a handful of references, you probably don’t need a global any more.

RSS Fixed

July 12th, 2005

My feeds should be back up and running. An upgrade to the install of WordPress on our server tromped on my .htaccess file, and so my rewrite rules got trashed. They are all up and running again, sorry for the time. I think most people will have missed one post unless they come and read my site by hand.

To those on LiveJournal who may very well get a big flood because of this, I’m sorry. Use a better RSS reader. *grin*

Once and only once, really.

July 12th, 2005

The product that my company sells is very data intense. The data is stored in a database. Of course, from time to time we have to make schema changes to that database, so we have a program that does this for us.

In previous versions of the software most of this was done in Delphi code. However, now that we run on a database that has good SQL support, we realized we could just run queries to get 99% of what we wanted done. To take this a step further, we could just write a SQL script that does all the work and not have to recompile any code for the schema updater to do the right thing.

[2.1]
ALTER TABLE …

[2.2]
DROP TABLE …
CREATE TABLE …

[2.7]
INSERT INTO …

You get the idea. The program would then check the database to see if it was on the latest version and it would run any relevant SQL snippets on it in order to bring it up to date. For each section it ran it would increment the version of the data to that version, run the SQL, and move on. Of course, after it runs the last one that brings the data up to the last version. Neato, right? If only it were that simple.

The problem was that our code has a symbolic constant which is [supposed to] always be set to the latest data version. The schema updater assumes that there will always be a section in the SQL script for the latest version and that will match the symbolic constant in the source code. However, if the symbolic constant is incremented but the SQL script is not changed, the data is never brought up to the “latest” version, as the updater only increases the version number for each section in the script.

The “latest” version number is defined in two different places: the script and the constant. The version is set to the value in the script, but validated against the constant. This is the cause for the problem. Now, I am biased toward the script being the One True Source, but in truth it only matters that there is only One True Source.

Either the schema updater should set the database version to the value used by the symbolic constant or it should check it against the last version in the script. That way a single change will drive both pieces of functionality, and they’ll always be in sync.

Up For Air

July 6th, 2005

It’s been over a month since I last posted. There have been a couple of times I’ve considered writing something, but I’ve been to tired or busy to do it. Between work and school I’ve been pretty drained, and what little energy I’ve had left has been directed toward reading and housework.

I just reread all of the Harry Potter books. I, of course, did this in anticipation of the next one which comes out a week from Saturday. It only took me about two weeks to get through all five, and now I’m primed and ready to jump into book six.

The other notable book that I’ve read recently is Ron Jeffries’ book, Extreme Programming Adventures in C#. It is absolutely fantastic. I had glanced over it a number of times at the book store as I don’t normally buy C# books, but when Ron was last out at our shop he offered me a copy from his personal stock, and I couldn’t turn him down (if i’d ever bothered to look close enough at the spine to see he’d written it, I’d've already bought it). I have learned a lot from the book, and so has Joe since I made him read it.

I hope to start writing more frequently, but I’m not going to make any promises. Work has been really intense lately (in a good way), and I haven’t been opening up my powerbook much at all when I get home. I’ve got a few weeks before classes start up again, so hopefully I’ll find some time.

Takin’ Care of Business

May 31st, 2005

So, Erica and I have both been feeling a little constrained in our apartment. It’s a studio apartment, and we have a lot of stuff. Granted, the whole reason we moved into a studio was to force ourselves to get rid of a lot of stuff, and we did. But now we’ve got lots of stuff we want to keep. Not to mention, the apartment is small. So, when our lease is up this fall, we may consider moving.

But, we’ve been renting for five years, and don’t really want to continue. I want a yard that I can grill in without having to drive out to the state park. Erica wants a basement she can setup as a photo studio. And, we’d both like to be secure in the knowledge that we aren’t throwing our money into a black hole every month. So, we are looking into buying a house.

Now, the first step we’re taking in this endeavor is fixing our credit. Or, rather, fixing our credit reports. Our credit isn’t stellar, but at the same time, what the credit bureaus are saying about us isn’t exactly true. As I write this, Erica is making phone calls to creditors that we’ve never heard of before and getting things straightened out.

One thing is for certain, we’re not rushing into this. We’re staying in the apartment until the lease is up, which gives us all summer to shop for houses and financing. I fully intend to look around at least five houses that I won’t buy, if not ten, before I get really serious about buying. With school and all, we’ll have to start looking early.

Stay tuned for more as it comes along.

In The Zone

May 28th, 2005

Tonight was amazing. I was amazing. Well, at least I amazed myself.

Before I tell you what amazed me, let me fill you in on the background. I’ve been stalling on my latest project for a week now because I’ve had a mental roadblock on how to refactor it to a place where I can add the next feature Meg (my Customer) wants. I knew that the code was not in a place to add it, but just could not find the path to salvation.

When I got home from work, I had some time to kill, so I pulled out my powerbook and started refactoring. It was absolutely inspired. I just started extracting little methods. I renamed a class. I renamed some methods on the class. Just a handful of teensy little changes like that and all of the sudden my code made so much more sense. Simply renaming the class and extracting a couple of methods had revealed the design that I’d been looking for.

I went to dinner.

When we got back from dinner I set in to refactor more, and I’ve been refactoring all night. It’s been more of the same: teensy little changes. I’ll rename a method, or move it. I’ve removed three parameters from the constructor of an object that had no real reason to ask for them, and that made my code a lot prettier because I had to fish those parameters down everywhere I constructed the object.

I think that the code is finally in a state that I can add the feature Meg wants, but beyond that, it’s in a much better state than it was this morning.

It’s also worth noting that I’ve been doing this project test first, so I have a safety net under me as I make all these broad changes. I’ve got a good test-bed and that makes all of this possible.

Back at long last

May 23rd, 2005

I’ve been gone for quite some time. Well, not gone, but not blogging. The blog has, in fact, been gone.

In short, Arete was hacked. Tyler and I had to reinstall. That is a blog post all on its own. We finally were back up and running with most things about a week and a half ago. But, for whatever reason, Rouhgcut wouldn’t work.

It seems something changed from Rails 0.10 to 0.12 that broke it. So my blog remained down, as I didn’t want to bother fixing it. I’m now using WordPress, and I think I’ll stay with it. While I don’t like PHP, I do like blog software that Just Works and requires Very Little Effort On My Part. Despite all my posturing, writing code for my blog doesn’t excite me very much, and so what language the blogging tool is written in isn’t nearly as important.

I’ll be importing all of my old entries (well the ones that were in roughcut, at least) very soon.

Layout, design, graphics, photography and text all © 2005-2007 Samuel Tesla unless otherwise noted.

Portions of the site layout use Yahoo! YUI Reset, Fonts & Grids.