Discover design patterns reusable object oriented, include the articles, news, trends, analysis and practical advice about design patterns reusable object oriented on alibabacloud.com
and can is accessed outside of the project.Using Access control we can only expose the API we want the other objects to use, and hide the properties or methods we do NT want to, which can leads to loosely coupling.For example, we can use computed properties to being the API for other objects, and we can use the Set{}or get{}to interact W ith private value and add more spedified logic.Sorry guys i ' m using a Chinese blog website, so I had no idea if there was a blog I can use in 中文版, please lea
1. Why to use C languageUntil today, although the C language is not the most used language, but C is not old, in many core system code, still running is beautifully designed C, the vast majority of embedded development core library software is developed by C, most of the standard algorithm is based on the standard C design. C language with its concise, flexible and superior performance, still in the heart of the core software designers have an unshaka
computing problems. But the method of gradual refinement cannot provide a system strategy or method to solve a specific problem. Sometimes, there is no top-down method for some problems. Structured program analysis is an effective method for small-scale programs, but it is often ineffective to promote it to large-scale system development, developers cannot use this method to easily reuse reusable components of previous programs. The abstract mechanis
Just like the location of Newton's three major laws in classical mechanics, the open-closed principle is the cornerstone of object-oriented reusable design (Object Oriented Design or OO
Today, I got the book "JavaScript design Mode" written by Zhang Jongming, and began a deeper study of JavaScript.See the beginning of the book, although before reading, some good video of the explanation, to JavaScript has a basic understanding, but, in the content of the book, I still have a feeling of their own poor 108,000, the previous code is not written, using global variables, global functions, is just a process-
Object pool, that is, the object pool. objects are pre-created and initialized and put into the object pool. The object provider can use existing objects to process requests, reduce the memory space and initialization time occupied by frequent object creation. For example, d
1 OO design principlesThe use of object-oriented analysis and design ideas, for us to analyze and solve problems to provide a new way of thinking. After we get the demand (omit Ooa, complete later), the next question is: How to object-or
. Now, we can generalize these objects into a class.
(52) it should be illegal to overwrite the methods in the base class by using an empty method (that is, a method that does nothing) in the derived class.
(53) do not confuse optional items with the requirements for inheritance. Model the optional include into a class that inherits and can cause flooding.
(54) try to create reusable frameworks rather than reusabl
dependent on abstraction, and often the customer has a service interface.In fact, the inversion of this dependency is exactly where the object-oriented design marks. It doesn't matter what language you use to write your program. If the dependencies of a program are inverted, it is an object-
combination/aggregation, rather than inheritance (because it is intuitive, the first impression is "oh, this is oo "). This is the so-called "favor composition over inheritance". In practice, combination/aggregation will bring greater benefits than inheritance, So priority should be given.
6) Law of Demeter or least knowlegde principle (low level or LKP), the Demeter principle or least knowledge principle, which was first formally applied in the Demeter system and therefore defined as the Demet
student and could be used to solve a multi-dimensional equation immediately. Later, structured programming was developed to split the code into multiple modules, this enhances code reusability and facilitates debugging and modification, but the structure is much more complex. The earliest programming method was process-oriented. It was very intuitive for beginners to understand quickly. Later, with the object
derived class. p103(53) Do not confuse the optional inclusion with the need for inheritance. Modeling an optional inclusion into a class where inheritance can lead to flooding. p108(54) When creating an inheritance hierarchy, try creating a reusable framework, rather than a reusable component. p112(55) If you use multiple inheritance in your design, let's say yo
(that is, a method that does nothing) in a derived class.
(53) Do not confuse the optional inclusion with the need for inheritance. Modeling an optional inclusion into a class where inheritance can lead to flooding.
(54) When creating an inheritance hierarchy, try creating a reusable framework, rather than a reusable component.
(55) If you use multiple inheritance in your
I recently read a Demo of Native 2d ON THE Unity3d official website and found that Unity3d is a pure object-oriented game engine,
I was amazed at the degree of object-oriented.
Normally, objects work independently. For example, in an ordinary ARPG game, a character has weapons and can attack monsters,
We can encapsulat
61 military rules of PHP object-oriented analysis design. (1) all data should be hidden inside the class. (2) a class user must depend on the common interfaces of the class, but the class cannot depend on its users. (3) minimize the elimination in the class protocol (1) all data should be hidden inside the class.
(2) a class user must depend on the common interfa
Seven Principles of object-oriented design and seven
Today we will talk about seven principles, namely: single responsibility, Lishi replacement, dimit law, dependency reversal, interface isolation, synthesis/aggregation principle, and openness-closure.
1. Open and Close principles(Open-Closed Principle, OCP)
Definition:The software entity shall be open to extens
inheritance in the design, first assume that you have made a mistake. If you do not make a mistake, try to prove it.
(56) as long as inheritance is used in object-oriented design, I have two questions: (1) is the derived class a special type of the thing it inherits? (2) is the base class part of the derived class?
(5
overwrite the methods in the base class by using an empty method (that is, a method that does not do anything) in the derived class. P103
(53)Do not confuse optional items with the need for inheritance. Model the optional include into a class that inherits and can cause flooding. P108
(54)When creating an inheritance layer, try to create reusable frameworks instead of
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.