ASCII silly question, Get a silly ANSI.
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
[OCP 21 Professional Study Guide] [OCP 17 Complete Study Guide] [OCP 17 Practice Tests] [OCP 11 Complete Study Guide] [OCP 11 Programmer I] [OCP 11 Programmer II] [OCP 11 Practice Tests] [OCA 8] [OCP 8] [OCP 8 Practice Tests Book] [Blog]
Tony Morris
Java Q&A (FAQ, Trivia)
Originally posted by Tony Morris:
Aside from the less obvious fact that a singleton is an implicit requirement defect, it might yield some insight by reflecting on the statement "You can define multiple singletons" with emphasis on the term "multiple singletons". Spot the contradction in requirements?
Granted, the JLS does talk about "constant variables" or was it "variable constants"? so all bets are off with respect to making sense
-Rich, SCJP 1.4
Originally posted by Richard Anderson:
Are you saying that by using Singletons, you're using an antipattern?
Tony Morris
Java Q&A (FAQ, Trivia)
-Rich, SCJP 1.4
Aside from the less obvious fact that a singleton is an implicit requirement defect, it might yield some insight by reflecting on the statement "You can define multiple singletons" with emphasis on the term "multiple singletons". Spot the contradction in requirements?
[OCP 21 Professional Study Guide] [OCP 17 Complete Study Guide] [OCP 17 Practice Tests] [OCP 11 Complete Study Guide] [OCP 11 Programmer I] [OCP 11 Programmer II] [OCP 11 Practice Tests] [OCA 8] [OCP 8] [OCP 8 Practice Tests Book] [Blog]
[OCP 21 Professional Study Guide] [OCP 17 Complete Study Guide] [OCP 17 Practice Tests] [OCP 11 Complete Study Guide] [OCP 11 Programmer I] [OCP 11 Programmer II] [OCP 11 Practice Tests] [OCA 8] [OCP 8] [OCP 8 Practice Tests Book] [Blog]
Originally posted by Scott Selikoff:
One other thought on J2EE and singletons... although you can use singletons in J2EE, it is not the recommended standard. Since one of the most common uses of a singleton is for caching for example, it is recommended you use some kind of standard caching mechanism available on the server. There are other such standards that are situation dependent where you can replace singletons with a more advanced model.
Although *personally* I find a lot of the alternates to be very proprietary. For example when working in WebSphere, IBM consultants tried to steer us toward IBM-specific solutions which I found dangerous since the more you depend on them, the less portable you are. Singletons are often faster and simpler than anything out there but they require very good understandings of server class loading and are sometimes too delicate.
Tony Morris
Java Q&A (FAQ, Trivia)
A singleton is only ever used to replicate the behaviour of global data, which always has a better approach (typically, a callback as a more appropriate abstraction).
Curious, what WebSphere-specific solution are you referring to?
[OCP 21 Professional Study Guide] [OCP 17 Complete Study Guide] [OCP 17 Practice Tests] [OCP 11 Complete Study Guide] [OCP 11 Programmer I] [OCP 11 Programmer II] [OCP 11 Practice Tests] [OCA 8] [OCP 8] [OCP 8 Practice Tests Book] [Blog]