I'll try to answer your specific question in more detail tomorrow when my brain's not so fried. ;-)
Peter's right to mention Hal Helms, and one of the statements from his latest newsletter is worth mentioning here. To paraphrase, you don't want to be so concerned with doing things "right" that you become paralyzed. The bottom line is always if it works, it works. That's step one. First start using objects and get them working, then as you get more and more into OO you can tweak and fine-tune and get more academic about things. The best way to learn OO is to actually build stuff and get it working, then smash it apart, rework it, read more about OO and rebuild ... it's a fun process! Just don't get so overly concerned with doing things right, using the right design pattern, etc. that you're afraid to actually write any code. In most cases there's more than one "right" way to do it anyway, so do it the best you can or in the way that makes the most sense at the time or given the situation. As you learn more you'll find that what made sense six months ago doesn't seem like such a good idea anymore! This is all part of the process. I know I've said this before, but it's really heartening for me to see so many people getting interested in OO. Not only is it a smart (and necessary at this stage of the game) career move, it honestly will make your programs better and more manageable. On top of that, for many of us it gets us thinking about things in a completely different way than we're used to. Flexibility is always good for the brain. Matt On Mon, 17 Jan 2005 22:30:31 -0600, Daniel Elmore <[EMAIL PROTECTED]> wrote: > That's how I'm using the singleton object. What I'm curious about is best > practices in referencing the singleton from within other objects. Normally > you create the object to know nothing about the outside world, but it seems > like in this case it might be overkill. > > Thanks > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Jack Lavender > Sent: Monday, January 17, 2005 10:26 PM > To: [email protected] > Subject: RE: OO Purity or Overkill > > I have no idea how the OO stuff in Cold fusion works. No contract to do so, > so have not taken time to do it. > > But the singleton pattern gives you one and only one of these objects in > your application by making the constructor private and provided a "static" > function that gives access to the allocate object on the heap. > > Or I should say I have done this per the GoF (Gang of Four) Singleton Design > Pattern in both Java and C++. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Daniel Elmore > Sent: Monday, January 17, 2005 9:57 PM > To: [email protected] > Subject: OO Purity or Overkill > > I'm working on my first OO application and wanted to make sure I wasn't > breaking any OO doctrines. I have a singleton object loaded into the > application scope which has settings that tell many of the other objects > what to do. So, would it be so bad to reference that singleton directly in > the other objects. Like: application.singleton.getSomeValue(), or should I > pass in a copy of the singleton to the other objects and let them work from > it within the arguments scope. > > I would really appreciate your experience and words of wisdom. > > Thanks > Daniel Elmore > > ---------------------------------------------------------- > To post, send email to [email protected] > To unsubscribe: > http://www.dfwcfug.org/form_MemberUnsubscribe.cfm > To subscribe: > http://www.dfwcfug.org/form_MemberRegistration.cfm > > ---------------------------------------------------------- > To post, send email to [email protected] > To unsubscribe: > http://www.dfwcfug.org/form_MemberUnsubscribe.cfm > To subscribe: > http://www.dfwcfug.org/form_MemberRegistration.cfm > > ---------------------------------------------------------- > To post, send email to [email protected] > To unsubscribe: > http://www.dfwcfug.org/form_MemberUnsubscribe.cfm > To subscribe: > http://www.dfwcfug.org/form_MemberRegistration.cfm > > -- Matt Woodward [EMAIL PROTECTED] http://www.mattwoodward.com ---------------------------------------------------------- To post, send email to [email protected] To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm
