A Software Design Pattern Computer Science

Essay add: 11-03-2016, 15:04   /   Views: 14

Although many techniques are there to help system designer, system analysts and programmer like uses cases and collaboration diagrams ,still the most hardest thing to do is trying to "discover" the object , especially for non professional system designers .

This will defiantly lead to design a system with too many interacted objects or a system which is hard to understand and maintain. Patterns aims to solve this problem by giving lessons from Experts .

Designing a pattern is considered as a solution to a general software problem within a particular context. Design patterns capture evolved solutions that experts and developers have reached them within time for more flexibility in their system designing process.

Patterns do not only talk about how software is structured , but also how classes and object interact with each other especially during runtime .

Patterns are a design description that is both generic and reusable design which is specially designed to solve a problem.

"Pattern" as the name suggests, means series of events occurring in a definite order.

The patterns can be found in Java and J2ee technologies also. Many a times, we find

that there is a particular way of tackling a problem. This way is easy and has been

used many times successfully by a number of people earlier also. This method

becomes a pattern.

Design patterns were first described by architect Christopher Alexander in his book A

Pattern Language: Towns, Buildings, Construction (Oxford University Press, 1977).

The concept he introduced and called patterns -- abstracting solutions to recurring

design problems -- caught the attention of researchers in other fields, especially those

developing object-oriented software in the mid-to-late 1980s

The largest part of Design Patterns is a catalog describing 23 design patterns. Other,

more recent catalogs extend this repertoire and most importantly, extend coverage to

more specialized types of problems. Mark Grand, in Patterns in Java: A Catalog of

Reusable Design Patterns Illustrated with UML, adds patterns addressing problems

involving concurrency, for example, and Core J2EE Patterns: Best Practices and

Design Strategies by Deepak Alur, John Crupi, and Dan Malks focuses on patterns for

multi-tier applications using Java 2 enterprise technologies.

According to Wang (2003), a design pattern is a recipe for solving a certain type of

design problem that captures the high-level objects, their interactions, and their


Software design patterns are schematic descriptions of solutions to recurring problems

in software design. (Jia, 2003)

A design pattern describes how objects communicate without becoming entangled in

each other's data models and methods. (Cooper, 2000)

Design patterns are recurring solutions to design problems you see over and over.

(Alpert, Brown and Woolf, 1998)

And according to Gamma, Helm, Johnson, and Vlissides (1993 ) Patterns identify and

specify abstractions that are above the level of single classes and instances, or of


Why it is important to know about pattern design?

As programmers initially design a program or an implementation , they (or other developers )often discover some improvements which makes the first design more adaptable . Solution comes with design pattern issue which allow for such programs or systems to reuse the knowledge provided by other software developers experts as a pattern that they have designed to capture such solutions. Studying designing patterns provides a common used words and expressions for documentation.

When should (not) we use it?

While using a pattern properly results in reusable code, the consequences often

include some costs as well as benefits. Reusability is often obtained by introducing

encapsulation, or indirection, which can decrease performance and increase

complexity. For example, you can use the Facade pattern to wrap loosely related

classes with a single class to create a single set of functionality that is easy to use. One

possible application might be to create a facade for the Java Internationalization API.

This approach might be reasonable for a stand-alone application, where the need to

obtain text from resource bundles, format dates and time, and so on, is scattered in

various parts of the applications. But this may not be so reasonable for a multitier

enterprise application that separates presentation logic from business. If all calls to the

Internationalization API are isolated in a presentation module -- perhaps by wrapping

them as JSP custom tags -- it would be redundant to add yet another layer of


Some of Java Designed PatternsCreational patterns:

This group of design patterns deals with the process of object creation: they create

objects for the programmer, and help him avoid having to instantiate objects directly.

and the program will have earner more flexibility in selecting the objects that you

need to create a particular case.

5.2 Behavioral Patterns

This group of design patterns deals primarily with dynamic interaction among classes

and objects: help the programmer to define connections between objects in your

system, and how the flow is controlled in a complex program.

5.3 Structured patterns

This set of design patterns deals with the composition and structure of static objects

and categories are: to help the programmer to configure groups of objects in the

structures of the largest, such as user interfaces and complex accounting data.

Creational patterns6.1 Overview :

Creation Patterns shows a prescription of the creation of objects , when a decision must be made at the time class is instant , such patterns are used. They abstract the instantiation process .

By that creation patterns help a system they build , to be composed , represented and at the same time independent of how its classes are really created.

Details of such classes are of course, encapsulated by abstract superclass and hidden from users . Users can know only know about abstract class which the class provides by its interface. Inheritance is used by such classes to vary the class that is instantiated. Objects , by creational patterns delegate instantiation to another object. It Keeps the specific type of the concrete class unknown to the user .

6.2 What Creational Patterns performs

They provide independency about how objects are created, composed, and represented within system

Instantiation processes are abstracted , such that

- Knowledge provided about system use of concrete classes is encapsulated .

- Creation and assimilation about instances used for these classes are kept hidden .

They provide governess for the created objects

6.3 Why Creational Patterns?

 The are useful for encapsulation of knowledge concerning those concrete classes used by the system.

 They hide information about how instances of them are created and how they work together.

 They use a small set of behaviors instead of using hard - coding

6.4 List of Creational Patterns

Class scope pattern:

- Abstract Factory

Object scope patterns:


- Singleton

- Builder

- Factory Method

6.3 Example : Singleton Pattern6.3.1 Problem:

There are some classes that have conceptually one instance , such that when we have many printers within a software system but we have only one print spooling , or when having one file system or one window manager. In these classes , when a programmer creates many objects that represent this conceptual instance , it will add complexity and overhead to the system.

6.3.2 Solution

For such systems create one object code that represent this instance and reuse it with providing encapsulation for such code.

6.3.3 Benefit

- While class encapsulation ensures the reuse of the object will provide an easy

facilitated way for clients , this reusing implies a better performance too.

Article name: A Software Design Pattern Computer Science essay, research paper, dissertation