Your Abstractions are Leaking!

Every once in a while, I run across a fabulous article that Joel (Spolsky of Joel on Software fame) wrote a while back that I’ve yet to read. This is one of those articles. In this article, Joel reminds us that, sometimes, the complexity beneath our abstractions leaks through and can cause us a world of hurt if we don’t understand those complex things going on underneath.

This has bitten me in the past with Hibernate. Hibernate abstracts the database away from us Java developers. It’s a wonderful tool, and it handles a ton of complexity under the covers, but that level of abstraction can come at a high price when you spend 2 weeks debugging what should be a simple problem. Unfortunately, if you don’t understand all of the things that Hibernate is trying to abstract away, you end up doing stupid things that you never would’ve done had you been using JDBC, for example.

Someone once said, “With great power comes great responsibility.” As software developers, we have a responsibility to at least understand the complexities that our powerful abstractions hide from us, or we are doomed to a life of debugging problems that never should’ve existed. For our first lesson, here’s a link to another Joel article that reminds us that string handling is very hard under the covers (it’s crazy that I can call C programming ‘under the covers’ these days). Aren’t you glad we have ruby, python, java, etc.?

RSS Back!

Ok. It looks like the RSS feed is back. Wanna know what I did?

NOTHING

That’s right. It just magically started working again on its own. As nice as that is, I’d still like to know why it was doing that. Maybe I’ll dig into the Apache logs and see if I can spot anything…NAH, I’ve got better things to do. Welcome back newsreaders!

I love the Unix Command Line! And a tip of the hat to cygwin.

Quick sidenote: I haven’t figured out the RSS issue yet, but I did notice that I was getting picked up in bloglines. Hmmm. Maybe it was an old cached feed from when the feeds worked. I don’t know, and I haven’t had time to dig in and figure it out yet. This is just a default install of WordPress. I haven’t even changed the damn template. Argh!

Anyway, I bet you’re wondering what that subject means at the top of the post. Well, let me set the scene…

At work, we use some stupid Novell system to distribute our licensed apps. One of those apps is WebSphere, which is the app server I have to test my code against. To get WebSphere, I have to install the WebSphere Studio (basically Eclipse 2 with a $5,000 price tag). Fine, I can live with that. Now, I want to run the app server outside of WebSphere Sutdio so I can develop with Eclipse 3.0 (the free one) and deploy with ant. Shouldn’t be too complicated, right? Well, when WebSphere Studio is first installed, a bunch of server startup scripts and xml configuration files are generated for the app server. Now, the supid Novell application distribution thingie mentioned earlier installs it to a different path then I am forced to, and all of the generated batch files have the WRONG hardcoded path in them. The “good” news is it only took me about 1.5 hours to figure that out.

Now to the point of my post. I had to replace their hardcoded path with mine in all of the batch files and xml files. These files are in a myriad of directories under the main WebSphere directory. So to make a way too long story short, I wrote a short 7 line ruby script that takes a filename as an argument on the commandline and interates over each line replacing the bad path with the good one. That took about 5 minutes. I know I could’ve used sed, but I love Ruby, and I like to write Ruby scripts whenever I can. So next, I wrote a long command line to actually call the script on the appropriate files, and BAM, all done. Grand total of about 9 minutes, 4 of which were spent refreshing myself on the awk syntax. Now, how long would that have taken me if I were pointing and clicking? 😉 Anyway, I know that this isn’t anything remarkable, I just get excited when I see great tools do their job well. The whole *nix philosophy of combining simple tools that each do their jobs very well to do complex things is so awsome.

Without further ado, here’s the command:

grep -re '[cC]:[/\]WebSphere[/\]AppServer' . | awk -F":" '{print $1}' | awk '{print "./replace_path.rb "$O}' | bash

And here’s the trivial ruby script:

lines = []
File.open(ARGV[0],"r") do |file|
	file.readlines.each do |line|
		lines << line.gsub(/[cC]:[\/]WebSphere[\/]AppServer/,'C:/Progra~1/IBM/WebSph~1/runtimes/aes_v4')
	end
end
File.open(ARGV[0],"w") { |file| lines.each {|x| file.puts x }}

Have a nice day!

RSS Feed Issues

I am aware of the blank document at my feed url, and I’m looking into it. Thanks to the people who pointed it out. Hopefully, I’ll have it fixed this weekend. Thanks for your patience!

First Day

Well, I’m sitting at my desk on the first day of my new gig. This is definitely the biggest company I’ve ever worked for, and the red tape is everything I expected and more. I’m lucky that I even have web access (I didn’t until about 3:00 when I found out a way around the proxy…thanks Firefox!). I can’t install any dev tools or do any development on my machine either. The IT folks negleted to give me admin access to the Windoze box that I have to use, and I’m currently waiting for that to be resolved.

Don’t get me wrong, it’s not all bad. The good news is, I have a much better idea about what I’m going to be doing, and I think it’s going to be fun. The guys I’m working with are also pretty cool, so that kind of overshadows the big corporation stuff. I’m just anxious to get coding, and the red tape is frustrating. Oh, watching a storm roll in from my downtown window is also pretty cool. You’ll forgive my excitement as I haven’t had a window in my office in quite a while. 🙂

Anyway, more to come about the new job and the new living arrangements later. I’ll also be posting about my experience developing a new Spring web app from scratch (my current personal project). All I’ll say now is that the experience is very rewarding, and the Spring framework positively rocks!

Now That’s Just Pitiful

Well, the one post about the EMF detector is pretty pitiful, so I felt I had to post something else. I’m just getting started with the blog thing (for the 3rd time), so bear with me here. I’m looking at getting my del.icio.us links in the sidebar here becuase I seem to update them more often. Anyway, I’m off to find a birthday present for Christy, God help me. Maybe I’ll bring you along, since I can post pictures and stuff from my Treo now. Word!