The Singleton Design Pattern

The Singleton Design PatternShort Description
The Singleton design pattern allows many parts of a program to share a single resource without … This article discusses this design pattern, shows several …

Website: www.theperlreview.com | Filesize: 440kb

Content
The Singleton Design Pattern
brian d foy
Abstract
The Singleton design pattern allows many parts of a program to share a single resource without having
to work out the details of the sharing themselves. This article discusses this design pattern, shows several
possible implementations, and highlights some Perl modules which use singletons.
1 About design patterns
Design patterns help structure code, although they do not say anything about how to implement it. They
solve problems before we start to write code because they affect the design of programs by recognizing the
possible abstractions in the problem. More than one pattern may apply, and within any pattern, many ways
to implement it.
We typically represent patterns with modules so their implementations are re-usable and abstract and make
full use of encapsulation. The rest of the program does not need to know how the module works, and indeed,
the more the program knows about the module’s workings, the more of a problem we have. Patterns promote
loose coupling so that their implementation does not affect the rest program.
2 When to consider using a singleton
Some things, like a particular hardware interface or serial port, or a software construct such as…

Get the file Download here

AddThis Social Bookmark Button
Related Books:
  • Douglas C. Schmidt Case Studies Using Patterns Case Study …
  • Generating design pattern detectors from pattern specifications …
  • The Visitor design pattern
  • Model-View-Controller A Design Pattern for Software
  • Automatic resource management as a C++ design pattern
  • POD a composition environment for pattern-oriented design …
  • Using RoleOf Relationship in Design Pattern Instantiation
  • Design Pattern

  • Related Searches: , , , ,



    Comments

    Leave a Reply