You're getting into religious war territory there my friend! One that's been doing the blogs recently too...
The OP wanted a way of generating getters / setters automatically... If we are running a master class here... I would suggest that you only ever generate getters for your model, and encapsulate the behaviour of the model in functions that relate to your use cases. Using public variables in the place of getters and setters reduces the level of thought required to code, but not necessarily in a good way as it then becomes much easier to break encapsulation. But as I said, religious war territory (and didn't we go through this recently on this list?) Gk. Gregor Kiddie Senior Developer INPS Tel: 01382 564343 Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ Registered Number: 1788577 Registered in the UK Visit our Internet Web site at www.inps.co.uk <blocked::http://www.inps.co.uk/> The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact [EMAIL PROTECTED] ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of twcrone70 Sent: 20 June 2008 15:34 To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: A great feature for Flex Builder would be getter and setter automation. Please remember that if all you need is default behavior as the script you provided does, that is implicitly provided by creating your var public in AS3. Yes, it feels funny having a public member variable coming from Java since it is bad to expose your objects state. But, if you need to "intercept" the set or get then you can provide the get and/or set method and your other code need not change. You only need getters and setters in Java from the start because there is not implicit mechanism for them. Having getters and setters that are unnecessary and do nothing special just bloats your code. So for that, I see getter and setter generation for Flex/AS3 as unnecessary. One last thing that will surely make eyes roll but...you should be careful when arbitrarily generating getters and setters without considering if that is what you REALLY should do. In the Java world, we too often simply create some fields, generate getters and setters, use the default constructor only. We then use the "class" like a C-style struct with essentially public fields anyway. Keep your mind engaged when developing classes. If you are generating lots of code that you never refactor to something more pertinent to your domain, you have a very 'dead' model. - Todd