Discover grokking object oriented design interview, include the articles, news, trends, analysis and practical advice about grokking object oriented design interview on alibabacloud.com
1. Opening and closing principle (the Open Closed principle OCP)
A module should be open in terms of extensibility and should be closed in terms of modification. Therefore, the interface encapsulation mechanism, abstract mechanism and polymorphic technique should be considered as far as possible in object-oriented design. The principle is also suitable for non
1. Change is the natural enemy of reuse!The biggest advantage of object-oriented design is that it resists change2. Re-understanding Object-orientedUnderstanding Isolation Changes:From the macro level, the object-oriented approach
30-minute understanding of Object-Oriented Design Principles
Many people have read the design patterns, but Martin does not have much estimation on the object-oriented design principles
1. Concept of Design PatternsThe design pattern describes a general solution to some common problems in the software design process.2. Object-oriented design modeObject-oriented
5 Programming styles and the abstractions they use:
Process-oriented algorithms
Object-oriented classes and objects
Oriented to logical goals, usually expressed in predicate calculus
Rule-oriented if--then the rule
A constraint-invariant
JAVA8 Series Tutorials: Getting Started with JAVA8 programming, object-oriented programming, advanced programming, core design patterns--dao Design Patterns01_ "Introduction to JAVA8 Programming"02001_java Development ProfileInstallation and configuration of 02002_JDK02003_ First Java program02004_classpath Environment
constructor, and by initializing the prototype in the constructor (only if necessary), while preserving the advantages of using both constructors and prototypes. In other words, you can determine whether a prototype needs to be initialized by checking that a method that should exist is valid.Parasitic constructor modeIf the above methods are not applicable, parasitic patterns can be applied. The core idea of this pattern is to create a function that simply encapsulates the code that creates the
Ask for PHP object-oriented design and data access design. for example, if one class Person has a database operation class ConnPerson, one operation is to buy a chicken, how should we design chicken information in the database? Whether to include the Conn class in perison, i
Ask for PHP object-oriented design and data access design. for example, if one class Person has a database operation class ConnPerson, one operation is to buy a chicken, how should we design chicken information in the database? Whether to include the Conn class in perison, i
[Favor composition over inheritance]
Combination
1. (object) combination is a method of reusing new functions by creating an object that combines other objects.
2. delegate the function to a combined object to obtain the new function.
3. Sometimes it is called "aggregation" or "inment", although some authors give special meanings to these terms
4. For example:
A
Before all the text, I need to emphasize that I personally opposed to structure typing, so even if the content of the text "looks like" go interface, readers should not feel that I am praising go interface. What I like more is the way that Haskell and rust. Unfortunately rust and go as much as I want to shrink all the words are the shortest, the result code written to even the readability is not, the word has become a symbol. If rust the mess of pointer desi
Rule
1
: Give priority to (object) combination, rather than (class) Inheritance
[Favor composition over inheritance]
Combination
N(Object) is a combinationCombinationTo obtain the reuse method of new functions.
NDelegates a feature to a combined object to obtain the new feature.
NSometimes it is also called "aggregation "(Aggregation) Or "inclusive
Object-oriented Thinking of design patterns, design patterns OO
[This article is my own learning notes. You are welcome to repost it, but please note the Source: http://blog.csdn.net/jesson20121020]
Object-oriented (OO) thinking
Why Study Design Patterns:1, more in-depth understanding of object-oriented thinking2, is conducive to the development of a strong extension of things What is a design pattern: a typical solution for a typical scenario that often occurs is the design pattern. For example,
1. Object-Oriented Analysis
The object of object-oriented analysis is the objective world of knowledge and modeling.
In fact, in the object-oriented analysis process is also the dem
attribute Name: type [= default value]
Visibility method Name (parameter list) [: Return value type]
Examples are as follows: (3) The relationship between classes ① Association Relationship 1) bidirectional correlation. Examples are as follows: 2) One-way association. Examples are as follows: 3) Self-correlating. Examples are as follows: 4) Multiple sexual associations. Examples are as follows: 5) Aggregation relationship. Examples are as follows: 6) combined relationship. Simi
Ask PHP design for object-oriented design and data accessibility
For example, there is a class person
There is a database operation class Conn
One of the actions in person is to buy a chicken, the chicken information to be put into the database
How should I design it?
is to
base classDo not let classes derive from specific classesA variable cannot hold a reference to a specific class6: Abstract Factory Method mode provides an interface for creating a family of related or dependent objects without having to specify a specific class.The factory method pattern uses inheritance: Delegate the creation of objects to subclasses, subclasses implement factory methods to create objects, and abstract factory method patterns use a combination:
Legend has it that object-oriented development patterns were first created by lazy programmers. Development so far, people from the initial hot loyalty to discuss whether a certain language is enough object-oriented to now start a broader focus on object-
"/"; return NewChu ($a,$b); Break; Case"%"; return NewQuyu ($a,$b); Break; } } } $j= Gongchang::d uixiang (3,2, "%");//Test Echo $j->js ();//OutputOutput resultsSecond, the design of six major principles1. The open-close principle is that the design should have good support for the extension, and the modification should be strictly limited.2. On the Richter scale also, the subclass mu
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.