Design Patterns-Preface

Source: Internet
Author: User

Since reading Objective C ++ in September, there have been a lot of lab tasks and mentors have been managing them strictly. They can only stay in the lab during the day, at night, I didn't go back to my dormitory to read much books, so I learned much slowly about computer-related content.

By reading Objective C ++, I have gained a deeper understanding of the underlying features of C ++. At that time, it was expected to start from C ++. The first direction was to understand the object model and language features of C ++ in a deeper and deeper manner, and to learn how to use STL and boost, in this way, you can learn the software engineering knowledge of the design mode and use C ++ to build a program framework for development. I learned QT for a period of time during the summer vacation and got a preliminary understanding of its development framework, but I don't have time to do in-depth case development (I'm also so lazy, I didn't have the perseverance to develop a project. I originally wanted to develop a simple Weibo tool. However, the interfaces on Sina Weibo were too fast to change. After a long time, I was not frustrated, I have not made any excuses for myself, so I should criticize it !), However, I have an understanding of the overall framework of software development. This reading of "Design Pattern" is a consolidation on this basis. The goal is to use the C ++ language to extend to software development.

At that time, I found a lot of books about the design model. It seems that this book was written by the "four-person gang" with the most classic ratings. Many others said that the Chinese version of this book is too bad, an error occurred. The language is not fluent. We recommend that you buy the original version. After comparison, I bought the English version of the book. From the end of September, I saw little progress in middle October. At the end of October, the experiment was busy and delayed until the last week. Time is the water in the sponge. Squeeze it hard. There will always be.

Although this book is in English, it is not obscure. Level 4 should not be difficult to understand, and the sentence structure is very simple. Even if you cannot understand it several times at once, you can understand it. In addition, during the course of reading, you can refer to the Reading Notes and blog series written by the online scalpers. some difficult questions are explained. Baidu should have a lot of questions. At the same time, when reading books, the dictionary is on the computer, basically there is no obstacle.

I didn't want to record it on the Internet, but later I thought it would be better to remember it than to write a new one. It was a learning process, so I began to write down the summary in the course of reading.

-----------------------------------

Preface

1. what is the design pattern? It is derived from the concept of architecture. The so-called pattern describes a common problem and proposes related core solutions, you can use it again when you encounter similar problems (of course, you must make some corrections ). In software engineering, it refers to the description of communication between objects and classes when solving common problems in specific circumstances.

In this book, a total of 23 design models are proposed for common problems encountered in software engineering. Each model includes the following content: model name, applicable issues, solutions, and utility. The purpose is to improve Program Flexibility, scalability, and portability.

Classification of the 2.23 design patterns:

Purpose

Creation type

Structural

Behavior Type

Applicability

Used for class

Factory Model

Adapter mode (For Class)

Interpreter Mode

Template Mode

Used for objects

Abstract Factory Model

Builder Mode

Prototype

Singleton Mode

Adapter mode (for objects)

Bridging Mode

Combiner Mode

Decoration Mode

Appearance Mode

Hengyuan Mode

Proxy Mode

Responsibility Chain Model

Command mode

Iterator Mode

Intermediary Mode

Memorandum Mode

Observer Mode

Status Mode

Policyholder Mode

Visitor Mode


Relationship between them:

3. solutions to problems in the design model

(1) Find the right object: break down the problem into the right object.

(2) determine the granularity of these objects.

(3) determine the interface of the object.

(4) determine the object implementation. Here we need to distinguish the inheritance of classification from the inheritance of interfaces. Pay attention to the principle of "programming for interfaces rather than implementing programming.

(5) mechanism for reuse. Principle: Try to use the combination of objects instead of class inheritance.

(6) reasonably use the "RunTime structure" and "compile-time structure ".

(7) Remember that the program is always changing, and make the program "change ".

Generally, software is applicable to three types of applications (internal reuse, maintainability, and scalability are required) and Toolbox (code reuse is required) and Development Framework (requiring reusability at the design level)

4. How do I select a design mode? How to use the design pattern?

I personally think this is something that is widely used in space. At least I have no experience at the beginning. However, according to the Internet, I need to understand the principles of software design and understand what problems I want to solve. I need to design them according to different structures and needs (empty? All nonsense ). My understanding is that more coding and more write will naturally be known.

In addition, familiarizing yourself with and mastering a development framework is also a good way to learn the design model. Many development frameworks use these design patterns. The examples mentioned in the author's book show the development frameworks that were popular in 1990s. Although they are somewhat outdated, but it is in the same line with the commonly used Java framework and QT, and can be used as a reference.

While reading a book, I took a stroke while reading it. When I saw the UML diagram, I wrote one by myself. The sample code just looked at it and didn't implement it. The author's code in the book is written in C ++ and smalltalk. I mainly look at C ++, and the latter is generally skipped directly.

-----------------------------

In the second chapter, the author gave an example of a document editor to explain software development. I want to learn the knowledge before looking back, So I skipped it directly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.