I read Hiroshi Yuki "Introduction to Design Patterns Learned in Java Language" (SB Creative)

Hello, I and Pu Yi.

This time, let's learn design patterns with Hiroshi Yuki's book. I did.

What is a "design pattern"?

The reason I picked up this book was a recommendation from an information-related friend. It was because I had a problem. "Because it is absolutely useful in practice" I swallowed the taiko stamp and picked it up with a big surprise. It depends.

The first thing that came to my mind was "What is a design pattern?" thing I said. This was explained at the beginning of this book.

"When I'm programming, I do the same thing as before. There are times when I notice that I'm turning back. Experience As the number increases, the next development of such "patterns" (….) You will be able to apply it to.  Erich Gamma, Richard Helm, Ralph Johnson, John The four Vlissides have the "experience" of such developers The pattern as "internal accumulation"   "Design pattern"

I arranged it in the form of. "(From" Introduction ")

In short, design patterns are like "wisdom of ancestors" Things. Also, something like a "common language" between developers, That is. By the way, the four people who devised the Gang of It seems that it is called Four (GoF). looks strong.

Chapters of this book

This book is one of the 23 design patterns defined by GoF. I'm introducing each one by showing an example in a Java program. I will. The chapters are as follows.

    1. Iterator Count one by one
  1. Adapter Cover with one skin and reuse
    1. Template Method Leave specific processing to subclasses Four. Leave Factory Method instantiation to subclasses Five. Singleton Only one instance
  2. Prototype Copy and create an instance
    1. Builder Assemble a complex instance
    1. Abstract Factory Make a product by combining related parts
  3. Separate the Bridge function hierarchy and implementation hierarchy Ten. Strategy: Switch algorithms
  4. Composite Identification of container and contents
  5. Decorator Identification of decoration frame and contents
  6. Visitor Work while walking across the structure
  7. Chain of Responsibility Responsibility
    1. Facade simple window
  8. Mediator has only one advisor
  9. Notify Observer status changes
  10. Save Memento state
  11. State Express the state as a class
  12. Flyweight Eliminate waste by sharing the same thing twenty one. Proxy Make after you need it twenty two. Command Make a command a class twenty three. Interpreter grammar rules are expressed in classes

What I worked on

・ Copy the program posted as a sample by yourself And ran →→ As expected for each of the 23 design patterns I was able to move to ・ Explain which class plays what role I tried to read and understand

What I want to do in the future

・ Solve the leftover exercises at the end of the chapter ・ Learn how Java programs work

One last word

If there is a supplement to my article or "what I want to do in the future" If you have any recommended books for, please leave a comment. I would be happy if you could! … so, that's it for today. It was Puyi.

Recommended Posts

I read Hiroshi Yuki "Introduction to Design Patterns Learned in Java Language" (SB Creative)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 10)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 7)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 3)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 9)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 6)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 4)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 5)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 2)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 1)
I read "7 Design Patterns to Refactor MVC Components in Rails" (writing)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 11)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 12)
Summary of "Design Patterns Learned in Java Language (Multithread Edition)" (Part 8)
Introduction to design patterns (introduction)
Introduction to design patterns (Flyweight)
Introduction to design patterns Prototype
Introduction to Design Patterns (Iterator)
Introduction to Design Patterns (Strategy)
Introduction to Design Patterns (Factory Method)
Introduction to Design Patterns (Abstract Factory)
I want to send an email in Java.
I tried to implement deep learning in Java
I wanted to make (a == 1 && a == 2 && a == 3) true in Java
rsync4j --I want to touch rsync in Java.
What I learned in Java (Part 2) What are variables?
I tried to output multiplication table in Java
I tried to create Alexa skill in Java
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
Java Design Patterns
[Java] Introduction to Java
Introduction to java
I want to do something like "cls" in Java
I tried to implement Firebase push notification in Java
# 2 [Note] I tried to calculate multiplication tables in Java.
I tried to create a Clova skill in Java
I tried to make a login function in Java
What I learned in Java (Part 3) Instruction execution statement
Introduction to Java for beginners Basic knowledge of Java language ①
What I learned when building a server in Java
I tried to implement the Euclidean algorithm in Java
~ I tried to learn functional programming in Java now ~
I tried to find out what changed in Java 9