Unnecessary complexity?

So I’m working on a project at work that recieves data in the form of a URL, parses it and saves it to a database.

The previous version of this Python script is very simple, using raw sql to save down the data to the database. My redesign includes SQLAlchemy, a Python ORM/DAL. Many people would say that for such a short script this is overkill. And on the face of it, they would be right.

Lazy Cat

However, as the system evolves over the course of time, the simple SQL approach will be less and less suitable, and the benefits of an ORM framework will be more and more apparent.

A lazy person would not do anything extra, and hack out a quick script that would be very brittle to changes in the database engine, or environment. For example, if we migrated at some point in the future away from our current engine to PostgreSQL (for example), some of the sql syntax may change and break the code, requiring further tweaks and debugging.

A Proactively Lazy person knows that with a little extra effort now (Learning SQLAlchemy’s syntax) many problems can be avoided in the future.

This applies not just to the database framework, of course, but documentation and testing. Both make your job easier in the long run!

Photo courtesy of ~fb~

Advertisements

2 Responses to “Unnecessary complexity?”


  1. 1 Karl 12/05/2010 at 10:12

    A quick hack might seem a good time-saver in the short-term but I’ve often found that it’s the quick hacks that end up being retained for years. When you think to yourself “I’ll just hack something together to do the job this once” then you’re shooting yourself in the foot because, 9 times out of 10, you’ll want to re-use that code at some point.

    Doing things the right way first time, no matter how insignificant the task, always pays back in the long run. I always code as if I’m scared of my future self coming back in time to bitch slap me for being sloppy.

  2. 2 Lewis 12/05/2010 at 12:40

    It can also be noted that with the simplicity of integrating modern, well designed Frameworks, Toolkits and APIs, it seems like a no-brainer.

    I am still surprised by the number of developers who don’t embrace the ORM capabilities of their language to make their lives easier.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Archive

  • 1,475 hits

%d bloggers like this: