> 1. Why is it completely unnecessary to use underscore? 

I don’t see the need for using it - I’m no expert on underscore but looking 
through the API again there’s nothing in there that I miss.  If you want to 
load another library that’s up to you.  

> 2. Why is it not good to enable loose coupling using the message system
> instead of manually attaching event handlers?

You’re using a long winded way of achieving something simple that is already 
done by the framework; this code:

 item.addListener('focusout', () => {
   console.log('change', item);
   var msg = new qx.event.message.Message();
   msg.setName('formItemChange');
   msg.setSender(item);
   qx.event.message.Bus.dispatch(msg);
 });
});

fires a change event every time the user leaves the field regardless of whether 
it has changed or not (so I’d suggest that’s a bug), and implies that a global 
message type of “formItemChange” is enough to be unique within the application 
for all subscribers to listen to.  I would have thought that if you have more 
than just a few fields in your application this could become difficult to 
manage.

Anyway, the message you are passing refers to the UI widget and not the model 
object which means that your event handler is pretty close coupled to the exact 
UI implementation - you can’t change the widgets without impacting your event 
handler logic, and you can’t have multiple UIs refer to the same model object 
(e.g. a wizard or detail view as well as a summary view).

IMHO it is generally more useful to have events on a particular model object 
(ie not a global broadcast), in which case this code is more useful:
formModel.addListener(“changeText”, function(evt) {
  console.log(“formModel.text changed to “ + evt.getData());
});

You’re right that if you need to broadcast a global change where the 
subscription is not to any specific object then using qx.event.message.Bus is a 
valid pattern, although that didn’t appear to be what you were trying to 
achieve.  

> /Two things that might help in the future are to provide examples in the
> playground (see the above link) and to write in Javascript, not
> typescript/coffeescript/etc - it’s much easier to understand and help
> feedback examples if it can just be copy & pasted into the playground as a
> working example/
> 
> I think coffeescript is more readable, but that of course is quite personal.
> I will (and have) use the javascript versions in the future.

The playground does not support coffeescript, and while people on the list use 
coffeescript/typescript (and presumably others) the main language is native 
javascript and you’re more likely to get help on specific examples if you stick 
to it because the playground makes it much easier to exchange ideas.  
Personally I find it off putting because it’s an unfamiliar syntax but that 
doesn’t mean you shouldn’t use it.

John


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to