Syntaxus Dogmata

An Insane Developer's Journal

More about VertX Hierarchy Classes

Okay, I know this is a lot of Syndog Noise™ for one week, but there’s just so much to consider with this Frame refactor that I’m getting a bit overwhelmed.  And since writing it all out helps me organize my thoughts…

All this talk about encapsulating the instantiation of Screen objects in my last post has me second-guessing how this is currently achieved for all hierarchy classes in VertX.  When I first started piecing this beast together, I had a chicken-and-egg issue when it comes to hierarchy class composition of their parent and child objects.  After all, hierarchical classes would be impossible to instantiate if their constructors demanded a parent object and child objects as parameters.  By definition, no hierarchical class object could exist without a full set of preexisting hierarchical class objects to pass.

Catch-22 FTB.

To address this problem, I made it so parent and child objects could be added through accessor methods after construction completed, but before the SetUp() method was called by the engine.  If they hadn’t been added yet, then SetUp() would throw an exception and say it’s Miller time.

I never really liked this solution, to be honest.  It made me squirm in much the way Hanes Her Way do on Hulk Hogan.  Mired as I was in a conundrum of a hundred other dilemmas at the time, however, it was the only way I could see out of that particular issue.

Now I’m considering revising it so a parent object is required in every hierarchy class’s constructor, leaving the instantiation of any child objects to be encapsulated within the class itself, or by descendant classes if it’s abstract.  This is exactly the same as with the Screen class I mentioned in my last post, except this will be true for all classes at every level of the hierarchy.  From where I’m sitting right now, this comes off as a very clean and elegant solution that makes class hierarchy instantiation a breeze outside the API.

Time will tell.

So, before I introduce the Frame class, I’m going to give this solution a whirl.  For those of you who made it this far and managed to follow what I was gibbering about the entire time, I’ll let you know how it works out.  For those of you who didn’t, I’ll still let you know how it works out.  I’m flexible that way.  No need to thank me — your look of bemusement mixed with sheer horror is thanks enough.


Apr 13, 2010 - Posted by | VertX™, Video Games

No comments yet.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: