Abstracting your database can be a VERY good thing.

We are just about to start building out a new facebook application for the latest version of Hero Brawl…and so I’m thinking a lot about the hows and whats of all of that right now.

One thing that I’m realizing is that it would really have been beneficial if I had abstracted the database out of Hero Brawl from the very start of the project and just made all the DB stuff happen through fairly generic web services.

The reason this would have been a REALLY good idea is that it would make building a facebook version, a myspace version, and any other version fairly trivial. Just build out the proper views, call the appropriate web services, and work in any of the custom things needed for each platform.

So why didn’t I do that from the very start? Well, first, it’s because the system was totally built ad-hoc with no real planning (or documentation) at any point…and second, it was quicker and easier to just build an integrated system than slow down and think about proper design and abstraction.

Basically it was just an early design decision that I now have to rework (ie. fix)…on the plus side though, it’s really not that bad and the pain of going through and fixing it *should* really help me teach myself the lesson going forward!

Overall I guess my point is this:

Taking the time to at least consider abstracting your database access and business classes from the very start should help you to build a better system overall (even if you ultimately decide not to abstract those things out).

Oh and of course another benefit if you do end up abstracting things into web services is that it will be that much easier to offer up an API down the road (if you so choose).

Anyway guess I better stop rambling and get cracking on abstracting all that stuff out now!

This post has received 46 loves.


This is the personal blog of Kevin Marshall (a.k.a Falicon) where he often digs into side projects he's working on for digdownlabs.com and other random thoughts he's got on his mind.

Kevin has a day job as CTO of Veritonic and is spending nights & weekends hacking on Share Game Tape. You can also check out some of his open source code on GitHub or connect with him on Twitter @falicon or via email at kevin at falicon.com.

If you have comments, thoughts, or want to respond to something you see here I would encourage you to respond via a post on your own blog (and then let me know about the link via one of the routes mentioned above).