Friday, July 4, 2014

Inheritance

Lately, I've been implementing all the database interaction.  Using a database is really an ideal way for Idea to work.  However, there are a few things that databases don't necessarily do well that are important to Idea.  The most prominent is inheritance, which I talked about in my last post.

Inheritance is an important concept in object-oriented programming, but it's non-existent in relational databases.  Therefore, I had to come up with a way to imitate it in a database.  I can tell you, it wasn't easy.

Sometimes things just click and I gain momentum, and I never seem to hit any ruts.  Well, I was that way in my first few iterations of Idea, but I'm not that way now.  It's mostly because my current version requires alot of work on the foundation before I can ever even test the thing. So far, I've had to hold everything in my head, and I'm doing something that hasn't really been done before, so I don't really have any precedents.  The best way to do things isn't very obvious.

Before, I just jury-rigged everything, but now I'm focused on quality and performance.  This time, it's not just a fun experiment.  This time, I really want to take it somewhere.

Thus, I was determined to find the best way to implement inheritance.  I'll be honest, the first way I thought up seemed really nice at first, but then I realized that it opened a huge can of worms when changing existing idea types' settings.  Then I came up with my current method, which at times seems a little tedious, but it utilizes the nifty perks of relational databases better, which actually make things sooo much easier in the end.  For example, if you were to change an existing idea type's inherited type, the old way would have been ridiculously hard and impractical.  The new way, while still difficult, makes it infinitely easier.

I'm actually a bit proud of my inheritance code.  However, it's probably riddled with bugs.  I haven't tested anything yet.  I'm excited to get to that point.  However, I know I'll spend a couple days just ironing out bugs.  But that's fine with me.

Thanks for reading!

clevceo

No comments: