Hey James,

 

That's a great article; classic Adam Haskell, he pulls no punches and tells us 
exactly what he
thinks.

 

He raises the issue of writing getters and setters just for the sake of 
architecture, and talks
about what a waste of time and code it is to write these extra methods for the 
sake of sticking to a
design pattern.  He has a good point, but the general counterargument is that 
the point of having a
design pattern is that it follows a pattern.   So if you want to write 
bean-like CFC's, you need to
write getters and setters for even the properties that don't NEED encapsulation.

 

Fortunately, CF9 will provide us (along with a ton of other new features) the 
ability to have
implicit getters and setters (or mutators and accessors if you want to get 
geeky with the
terminology).  What this means is that you can write getters and setters for 
the properties that
need them (a setter that has business logic in it, for example), but you can 
still use setProperty()
to set properties that you haven't explicitly written setter methods for.

 

So the argument against writing empty getters and setters becomes moot.

 

The article is worth a read for anyone who is, or wants to be, working with OO 
ColdFusion, as is
Adam's blog for anyone serious about CF in general.

 

Take Care,

 

Seth

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of James 
Husum
Sent: Wednesday, October 08, 2008 5:59 AM
To: [email protected]
Subject: [houcfug] Getters and Setters

 

Greetings,

Having read this article by Adam Haskell
(http://cfrant.blogspot.com/2008/10/why-bother-getters-setters.html) and the 
topic being kicked off
by our own Seth Bienek I was wondering what people's thoughts were on this. 

I've seen many apps that have been coded with the bean/DAO/Gateway/Service 
object style of doing
things. The beans are nothing but a large collection of getters / setters in 
most cases. The DAO
populates the beans which then get passed around to displays or other 
functions. Is this just adding
lots of overhead to the app? I know this style of coding is not the only way to 
architect a system,
but it certainly seems to be popular and widely pushed among the CF blogs and 
magazines. But is it a
'best practice' or just lots of extra work for little return?

I know, each app should be approached and designed according to its own needs. 
Does having a set way
of doing things (like making beans, DAOs, Gateways, and Service layers) make it 
easier or harder
overall to get an app up and running quickly and keep it maintained over time?

-- 
James Husum
The Quixote Project - one guy's quest to make the world a better place -
http://www.thequixoteproject.org/
Brainsludge - all the shtuff running around my brain - 
http://www.brainsludge.com/
Know any writers? I need their input! - http://www.smotu.org/
Currently reading: The Sapphire Rose by David Eddings




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit http://groups.google.com/group/houcfug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to