Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 82459f3

Browse files
committed
update reamde
1 parent 6f0ee0e commit 82459f3

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

‎README.md‎

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ __What is a Design Pattern ?__
1515
1616
__Java Design Patterns__ are divived into tree parts : *Creational*, *Structural* and *Behavioral*.
1717

18-
# CREATIONAL DESIGN PATTERNS
18+
## CREATIONAL DESIGN PATTERNS
1919

2020
Creational design pattens provide solution to instatiate an object in the best possible way for specific situations.
2121
The basic form of object creation could result in design problems or add unwanted complexity to the design. Creational design patterns solve this problem by __controlling the object creation__ by different ways.
22-
There are five creational design patterns that we will discuss :
22+
There are five creational design patterns that we will discuss on :
2323

24-
1 .Singleton Pattern
25-
2. Factory Pattern
26-
3. Abstract Factory Pattern
27-
4. Builder Pattern
28-
4. Prototype Pattern
24+
*Singleton Pattern
25+
* Factory Pattern
26+
* Abstract Factory Pattern
27+
* Builder Pattern
28+
* Prototype Pattern
2929

3030
### Pattern Singleton
3131

@@ -63,17 +63,14 @@ We'll implement the thread safe one here. Classes are in the package `com.single
6363

6464
Factory design pattern is used when we have a super class with multiple sub-classes and based on input, we need to return one of the sub-class. This pattern take out the responsibility of instantiation of a class from client program to the factory class. Let’s first learn how to implement factory pattern in java and then we will learn its benefits and we will see its usage in JDK.
6565

66-
* Super Class
67-
Super class in factory pattern can be an interface, abstract class or a normaljava class. For our example, we have super class as abstract class with overridden toString() method for testing purpose.
68-
see `com.factory`.
69-
* sub-classes
70-
Let’s say we have two sub-classes PC and Server with implementation in `com.factory`
71-
72-
Here's what we have in image :
73-
[](http://zupimages.net/up/17/13/7w9z.png)
74-
75-
76-
Now let's write the test class.
66+
* Super Class
67+
Super class in factory pattern can be an interface, abstract class or a normaljava class. For our example, we have super class as abstract class with overridden toString() method for testing purpose.
68+
see `com.factory`.
69+
* sub-classes
70+
Let’s say we have two sub-classes PC and Server with implementation in `com.factory`
71+
Here's what we have in image :
72+
[](http://zupimages.net/up/17/13/7w9z.png)
73+
Now let's write the test class.
7774

7875
```java
7976
import com.factory.FactoryClass ; //The factory class
@@ -214,5 +211,6 @@ public class PrototypePatternTest {
214211
System.out.println("users List: "+users.getEmpList());
215212
System.out.println("users New List: "+list);
216213
System.out.println("users New1 List: "+list1);
214+
}
217215
}
218-
}
216+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /