The Accidental Rubyist

invalid byte sequence in UTF-8

Thoughts on data models and events

leave a comment »

Should I go towards MVC?

I was completing the editable combo box today. I wanted to fire some events w.r.t data changes in the list. I was directly manipulating the array. No MVC architecture, that is.
Since the list can be manipulated before the listbox has been popped up, and the same events are required in the ListBox that is popped up, I realized I would require a data model to wrap the array. Also, when creating a combobox the user does not have a handle to the popup list which would be created later. So he can’t associate actions with events.

So I created a ListDataModel. This allows the user to associate actions with the datamodel and not have to know about the Listbox internally used. So my first query from people seasoned in GUI’s is: should i start moving to an MVC architecture with ruby curses. Obviously, this complicates usage for a first timer.

Bind an action versus adding listeners

My second query is: currently the program can bind an action to an event. That means only ONE action can be bound to an event for any widget. If multiple widgets wish to be notified on the CHANGE of, say, emailid, I would have to club actions in one bind call.

Java uses the addListener() approach. This adds flexibility, but again increases complexity. Or I could add actions to an array, so that they could be called in a loop. I would like thoughts on this.

Which GUI/widget library to use as a base?

I started using Tk as a base, but ran out of material. Then I began looking at Java Swing. Took a peek at Shoes (very minimal in this respect). Finally, looking at QT and Swing.
Which is the easiest for a programmer, yet hackable/extendable ? Would like thoughts on this.

Anyone interested in guiding me

Third, would someone with good knowledge of GUI’s – preferably who has worked on writing/designing this kind of library be interested in acting as a guide, giving me design directions. Just need to bounce ideas and get direction.

Thanks all.


Written by totalrecall

December 17, 2008 at 10:11 pm

Posted in rbcurse, ruby

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: