logo

Software Engineering - Singleton Pattern

   

Added on  2023-05-31

5 Pages538 Words412 Views
Running head: SOFTWARE ENGINEERING - SINGLETON PATTERN
Software engineering - Singleton pattern
[Name of the Student]
[Name of the University]
[Author note]
Software Engineering - Singleton Pattern_1
1SOFTWARE ENGINEERING - SINGLETON PATTERN
Singleton pattern is considered to be the software design pattern which is associated
with restricting the initiation of one class to one object. This Pattern is generally applied and
is useful when exactly one object is in in need of coordinating with the actions across the
system. This pattern is particularly used for describing the way by which the recurring design
problems can be solved so as to provide a flexible as well as reusable Object-oriented
software. This are the objects which are easy to implement, change, test and reuse (Kim et al.
2016). This pattern can help in hiding the constructers of the class and is associated with
defining a particular public static operation as (getInstance()), this in turn is associated with
returning the sole instances of the class.
Singleton pattern is generally utilized for the purpose designing the logger classes.
This are the classes which are applied as a singleton and is associated with providing global
logging access point to all the components of an application. However, it is always not
necessary that an object is created each time whenever a logging operation is performed.
For example: deployment of a static member in the singleton class, along with a private class
and a static public method is associated with returning a reference to the static member
(Uchiyama et al. 2014). The singleton pattern is associated with defining a getInstance
operation which is responsible for the exposure of the unique instance that gets accessed by
the clients.getInstance() is responsible for the creation of an unique class instance in cases
when it is not created and also for eh purpose of returning that instance. The program for
doing this have been provided below:
class Singleton {
private static Singleton instance;
Software Engineering - Singleton Pattern_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Software Engineering Order Assignment
|12
|2215
|23

Victorian Institute Of Technology - VIT Intro
|5
|831
|15

System Design Analysis Using UML PDF
|5
|950
|81

Object-Oriented Design Choices in Future College Console Program
|13
|1508
|247

Object Oriented Programming with C#
|6
|690
|365

Concept of Data Encapsulation
|10
|2878
|302