[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Implementing a singelton

  • Thread starter Thread starter marian.edu
  • Start date Start date
Status
Not open for further replies.
M

marian.edu

Guest
Well, as Mike said you can use a manager (factory) to provide you such an instance and then it’s the manager/factory job to make sure it’s only one alive in the session - this will not stop one to create a new instance using new (static or dynamic). Using the ‘singleton’ approach it’s the object responsibility to make sure it can only be one instance active, for that you do need at least one static property/method to give you that instance so then the ‘static’ part of the class will be there once loaded, a pain in the … on development environment :( If you only need that to keep state (shared variables anyone) then you can just go with pure static properties and forget about singleton, but then again maybe it’s time to think about some session/context manager to help you keep ‘global state’. Marian Edu Acorn IT www.acorn-it.com www.akera.io +40 740 036 212

Continue reading...
 
Status
Not open for further replies.
Back
Top