Java, Eclipse and Web programming Tutorials
Follow me on twitter About Lars Vogel

Design Patterns in Java

Lars Vogel

Version 0.3

01.07.2009

Revision History
Revision 0.102.07.2007Lars Vogel
Singleton, Observer
Revision 0.202.09.2007Lars Vogel
Facade introduced, Singleton with Enumerations
Revision 0.301.07.2009Lars Vogel
Moved every pattern to separate article, this article contains only the overview

Design Pattern

Design Patterns are best practices how to solve common know problems. Since the publication of the book "Design Patterns" from the so-called Gang-of-Four (GOF) this topic did increase in popularity. This article will try to summarize same of these patterns and describes its application from the Java perspective.


Table of Contents

1. Introduction
2. Pattern
3. Thank you
4. Questions and Discussion
5. Links and Literature

1. Introduction

Design Pattern are proven solutions approaches to specific problems. A design pattern is not framework and is not directly deployed via code. .

The terminology of "Design Pattern" in software developed is based on the GOF (Gang of Four) book "Design Patterns - Elements of Reusable Object-Oriented Software" from Erich Gamma, Richard Helm, Ralph Johnson und John Vlissides das Buch.

Design Pattern have two main usages:

  • Common language for developers: They provide developer a common language for certain problems. For example if a developer tells another developer that he is using a Singleton, the another developer (should) know exactly what this means.

  • Capture best practices: Design patterns capture solutions which have been applied to certain problems. By learning these patterns and the problem they are trying to solve a unexperienced developer can learn a lot about software design.

Design pattern are based on on the basis principles of object orientated design.

  • Program to an interface not an implementation

  • Favor object composition over inheritance

Design Patterns can be divided into:

  • Creational Patterns

  • Structural Patterns

  • Behavioral Patterns

2. Pattern

Please see the following description for details on the design pattern.

Singleton

Observer

Facade

Adapter

3. Thank you

Thank you for practicing with this tutorial.

4. Questions and Discussion

For questions and discussion around this article please use the www.vogella.de Google Group. Also if you note an error in this article please post the error and if possible the correction to the Group.

I believe the following is a very good guideline for asking questions in general and also for the Google group How To Ask Questions The Smart Way.

5. Links and Literature

http://en.wikipedia.org/wiki/Design_Patterns Wikipedia Entry about the GOF Design Pattern book.