I'd advocate STTCPW (Simplest Thing That Could Possibly Work).  If you have a tab navigator with 3 states, then something like the below is going to be more than appropriate, and anything more complex is overkill.
 
If you have 100 states, it'll be cluttered and unmaintainable.
 
Somewhere on the journey from 3 to 5, you'll probably refactor ("Extract Class") and then somewhere from there you'll maybe even build out some infrastructure (such as a State class of sorts).
 
But for now; if you have a tab navigator and you want to manage which state you're in, a handful of constants would work for me, with a single variable that you bind the tab navigator to.
 
Closely related to STTCPW is YAGNI (you ain't gonna need it).  Don't build more than you need, until the point in time you need it.
 
Just my $.02
 
Steven
 
Steven Webster
Practice Director (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6108
m: +44 (0) 7917 428 947 
[EMAIL PROTECTED]

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard
Sent: 17 July 2006 20:28
To: flexcoders@yahoogroups.com
Subject: [flexcoders] State vars: good, bad, ugly?

As I perused the great sample app Jesse put together
(http://www.jessewarden.com/archives/2006/07/flex_2_webservice.html),
I came across his simultaneous implementation and criticism of state
vars inside ModelLocator.

// only do this if you have a 4 hour deadline;
// some people think state vars are good. I think
// they are evil... but man, they sure work in a pinch.
public static const STATE_READY:String = "ready";
public static const STATE_SEARCHING:String = "searching";
public static const STATE_DONE:String = "done";

I need to implement something similar in my app as basically the whole
thing resides inside a TabNavigator. I would like a simple, reliable
way to direct the app to change states/tabs and this seems like a
decent approach. What are people's opinions on this approach? Have a
better alternative? Jesse, can you expound on why you think they're evil?

Thanks,
Ben

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





YAHOO! GROUPS LINKS




__,_._,___

Reply via email to