> So if there's an organizational shuffle of roles, I'd have to rewrite
> my XML schema? Because that sort of thing happens all the time, and a
> rigid hierarchy simply won't be able to match that without frequent
> changes.

Precisely.

My solution uses design patterns, encapsulation and DRY. It makes for very lean code and is completely flexible and scalable.

Also, organizations of people are made up of people, not units. If Steve Ballmer leaves and somebody else is President, then the name changes, but not the role/title.

I don't see how writing tons of custom Actionscript to parse custom nodes in XML is a workable solution. It's not scalable, it's not flexible. If you add a new role at your company, you have to write new code to support the parsing of that node name and a new class to handle drawing it, as well. The Strategy pattern (which is present in my example) was made to solve this issue elegantly.

Let's take it out of XML altogether.  Would you write a bunch of classes like 
this?

public class Director
{
    public var title:String;
    public var name:String;
    public var somethingDirectorsAndAboveHave:String;
    public var somethingManagersAndAboveHave:String;
}
public class Manager
{
    public var title:String;
    public var name:String;
    public var somethingManagersAndAboveHave:String;
}
public class Person
{
    public var title:String;
    public var name:String;
}

Or this...

public class Person
{
    public var title:String;
    public var name:String;
}
public class Manager extends Person
{
    public var somethingManagersAndAboveHave:String;
}
public class Director extends Manager
{
    public var somethingDirectorsAndAboveHave:String;
}

If that's even necessary, which I'm not sure it is in the data. It seems like the role of the person only defines how they're rendered in the view and potentially what events they fire off to the controller (if you're using RobotLegs, you can pair with a Mediator). Leave rendering instructions out of the data and put it in the view where it belongs.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to