Event delegation through a mediator tool

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
ooper
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 46
Joined: Mon Aug 17, 2009 12:22 am

Event delegation through a mediator tool

Post by ooper » Mon Aug 02, 2010 1:21 am

Would anyone be interested in a plugin that lets you select screen objects for the purpose of linking events to messages from source to multiple destination objects in an abstract fashion?

Example: imagine a Pizza Order card where you get to choose your toppings from a set of checkboxes, a field with a running total, and a checkbox for vegetarians.

The "Mediation" process: from the plugin palette and the Pointer Tool selected, you can click on each «topping» checkbox to assign mouse events for other objects to receive it, letting them respond accordingly. More specifically, one sender can be the Peperoni checkbox and the receiver objects can be 1) the field that manages the running total, 2) a List text field that keeps track of every item selected, and 3) the «Place Order» button that becomes enabled when (at minimum) one checkbox is selected. Similarly, the Peperoni checkbox is a destination of the event sent by the «Vegeterian» checkbox which will uncheck and disable the Meat group. The beauty of this is that the latter event will update the running total and the Place Order button will disable automatically! --unless, of course, a vegetarian item like mushrooms is selected :) This leads to very scalable user interfaces.

Among other things, the benefits include:
  • No hard coding of objects
    Much less code
    Encapsulation of state and state-management
    Transition of workflow is much more easily maintained
    Automatic user interface semantic behavior
    Undo and Redo
    Garbage collection is easily maintained
loose coupling, high cohesion, and much less code --which equals less bugs and faster release cycles!

The plugin: Through a palette, the Mediator plugin lets you click each screen object when the pointer tool is selected and builds a link between source and destination, as well as the dispatching mechanism that lets you then define the semantics of the event, including Undo and Redo. Among other things, the palette lets you prune the objects that get deleted in the development process.

Would you find this useful? Would you pay for such a tool? And if so, how much?

Thanks!
/Carl

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Event delegation through a mediator tool

Post by FourthWorld » Mon Aug 02, 2010 1:04 pm

Would this "Mediator" be equivalent to the "Controller" in an MVC model? If not, what distinguishes it?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ooper
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 46
Joined: Mon Aug 17, 2009 12:22 am

Re: Event delegation through a mediator tool

Post by ooper » Mon Aug 02, 2010 4:56 pm

Hi Richard,

To answer your question, it is similar but not equivalent. The plugin ecompasses several design patterns, including Observer, Mediator, Memento and the MVC.

/carl

Post Reply