Bill Rawlinson wrote: > Having to write Getters and Setters is a tedious process - but > being tedious doesn't mean its a bad thing. It protects your > data in a readonly state so that the only way it can be modified > is via the setter. I like the explicit nature of the Beans > mutator methods. > > There are alot of actions in software development that can be > tedious. Its why so many tools are developed. THe mach-ii beaner > is a fine tool to help you rapidly develop using very valid > design pattern. Dont let seeming redundancy and tedium turn you > away from using discreate objects to represent your model.
I very much like that you can have an object of type Employee, representing an actual business object, and that certain methods expect an object of that specific type to be passed into them, or return one. Non-generic-ness serves a real purpose in that case I think. But what about all those getters and setters? Yes, some setters do more than set, and maybe validate or convert argument types, but most don't. Similarly, while there may be exceptions that calculate something (getAge...), most getters just return a value from the bean/TO/BO/etc. What do you think about generic setValue(value_name, value, expected_type) and getValue(value_name) methods? You'd override them for any special cases, but those would cover most getters and setters, and eliminate a bunch of repetitive code that doesn't seem to add a lot of business or code-sanity value. Setting or getting a nonexistent value_name would throw an appropriate exception, instead of a native cf 'method not found' exception; no big difference I can see. I'd see a lot of benefit to individual set/get methods if we were in compiler-land, where the calling a nonexistent method was a compile-time showstopper rather than the run-time error it is in cf. It would be much harder to ship code that was broken on that level. But since that's not current cf reality, IMO it's much harder to justify the purpose of each identical basic getter and setter. Comments? Dave Merrill ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
