Friday, August 1, 2014

Link Data

The columns are done.  The UI doesn't really look any different than it did in the last screenshot, but all of the textboxes, buttons, etc. actually work now.

So here I am, ready to start writing the link data.  However, I'm not ready.  I'm ready because I've tested and debugged everything up to this point and I can't progress any further until the link data code is written.  But I'm not ready because I'm not entirely sure yet how I want to do it.

If you don't know what I'm talking about, I'll get you up to speed.  When ideas are connected, I want to allow the user to attach some data to each connection.  For example, when a scene is connected to multiple characters, the user might want to attach a small caption to each connection to explain the role of each character in the scene.

And so that you understand what I'm about to discuss, I'm going to explain a bit of the internal structure.  If you don't know anything about relational databases, you may as well skip this post.  Anyway, each idea type is a table in the database.  When the idea type allows only one connection, there is a column in the database that links to the other idea type.  However, when an idea type allows multiple connections, there is a separate table, each record representing a connection.

It's obvious how to do it when a field allows more than one connection.  In that case, I could just add the fields to the separate table.  However, when only one connection is allowed, I could possibly add the link data columns to the idea type's table as well, but that could get messy.

My initial thinking was that if they only allowed one connection, they wouldn't need separate data for that connection.  If they wanted data attached to it, they could just add more fields to the idea type.  After all, the link data is there only to distinguish the connections from each other.  When there's only one connection, there's no need to distinguish anything.

However, say the user initially allowed multiple connections, but wanted to switch it to only allow one.  What would I do with the existing link data?  Throw it out?  Merge the fields into the idea type itself?  Hmm...that's actually a decent idea.  Anyway, see what I mean?  It's a dilemma.

Real quick, I want to continue the thought from the previous paragraph about merging the link data fields into the idea type.  On the flipside, if the user wanted to change the column from allowing only one connection to allowing multiple, I could allow them to choose certain columns from the idea type to merge into the connection data.  I think I like it.

However, I'm going to mull this over in my brain for a bit before I make any brash decisions.  I'm going on vacation for the next week or so.  I'll have plenty of time to think about it while I'm gone.  Hopefully by the time I get back, I'll have something solid in mind.

I hope this blog is at least somewhat interesting.  Once I get past this internal stuff and move on to the UI, it should get a bit more exciting.  I really can't wait until then.  If you have any comments or suggestions, please send them my way.

Thanks for reading!
clevceo

No comments: