Discover object oriented design and patterns 2nd edition, include the articles, news, trends, analysis and practical advice about object oriented design and patterns 2nd edition on alibabacloud.com
The basic principle of object-oriented design http://www.cnblogs.com/malaikuangren/archive/2012/03/22/2411315.htmlInterface:Understand:An agreement between the parties.Benefits:interface and implementation separation;Easy to expand;Object-Oriented
First of all, it must be stated that the viewpoint described in this article is only applicable to the implementation process of object-oriented systems based on the traditional waterfall model, this process includes feasibility analysis, requirement analysis, object-oriented analysis and
Most of the time, we understand that object-oriented means adding methods to data, encapsulation means hiding data, but this is not comprehensive. For example, a cat has a head, four legs, and a tail. Although there is no error, it is not comprehensive. In terms of appearance, this is indeed the case for Object-Oriented
Lua Object-oriented implementations:A class is like a stencil that creates an object. Some object-oriented languages provide the concept of classes in which each object is an instance of a particular class. LUA does not have a cla
Method Invocation Pattern
When a function is saved as an attribute of an object, we call it a method of the object, so this is bound to the object.
Copy Code code as follows:
var myobject={
Name: "MyObject",
value:0,
Increment:function (num) {
This.value + = typeof (num) = = ' number '? num:0;
} ,
Tostring:function () {
Return ' [
access methods defined in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
(15) Be cautious about classes that contain too many non-communicating behaviors.
Another manifestation of this problem is that many get and set functions are created in the public interface of the class in your application.
(16) In an application that is composed of an object-
access methods defined in the public interface. A large number of access methods means that the relevant data and behavior are not centrally stored.
(15) Be cautious about classes that contain too many non-communicating behaviors.
Another manifestation of this problem is that many get and set functions are created in the public interface of the class in your application.
(16) In an application that is composed of an object-
association between people and Student
student.prototype = object.create (people.prototype);
var human = new People ("Joy");
Human.sayyourself ()//
var studenta = new Student ("Cindy", "Junior");
Studenta.sayyourself ()//
Such code seems to solve the problem of inheritance, but it is very cumbersome, the following is my recommendation for the delegate-oriented, and object-related
The process-oriented design method emphasizes the consideration of the software's functional characteristics. process-oriented designers usually divide the system into multiple functional modules at different levels, at the same time, try to minimize the Coupling Degree between modules.
The main task of object-
One, Factory mode: Similar to function func (A, B) { var obj=new Object (); obj. A=a; Obj. B=b; return obj;}; var obts=func (' Name ', ' ages '); Two, constructor mode: can be used to construct a specific type of object function Createobj (A, b) {this. A=a; This. B=b; This.func=function () {alert (this. B); }} var obts=new createobj (' name ', ' ages '); using new to create an
.friends); //output: John Doe, Harry, Zhao Liualert (person2.friends);//output: John Doe, Harry, Zhao LiuAnalyzing the code above, when we add a friend for Person1, we find that Person2 has also been added a friend, but this is not what we want, and this is due to the shared nature of the prototype pattern, as long as any one instance modifies the property value in the Prototype Property object, All instances associated with the prototype
underlying modules, both of which are dependent on abstraction. Depending on the abstraction, it is programming the interface, not programming the implementation.Dependencies are bound to exist between classes and classes, modules, and modules. When there is a tight coupling between the two modules, the best way is to separate the interface and implementation: To define an abstract interface between dependencies so that the high-level module calls the interface, and the underlying module to imp
only one change point (every class shocould attempt to make sure that it has only one reason to this, the death of each badly designed piece of software .)
What remains unchanged in the software is changes. Poor design will cause the software to crash in changes, but good software can be easily changed.
Each type has only one reason for change, which will make your software relatively simple to cope with changes. In other words, reduce the change
project, the organization defines
The name of the class, you need to follow certain rules, preferably with the class name as the center, or you can add a uniform prefix or suffix shape
into filenames, such as xxx_classname.php, classname_xxx.php, and classname.php, and so on.
This example attempts to load the MyClass1 and MyClass2 classes from the myclass1.php and myclass2.php files, respectively
Code Snippets
Copy the Code code as follows:
function __autoload ($classname) {Require_once $c
more detailed description, after reading this article, I believe you should almost understand, online a lot of master JS writing, monomer mode is very common.
A monomer is an object that is used to partition a namespace and organize a group of related properties and methods together, and if he can be instantiated, he can only be instantiated once.
Monomer mode is one of the most basic but also most useful patte
Introduction to the prototype of JavaScript design patterns (Object. create and prototype), object. prototype
Prototype description
Note: You can use a prototype instance to copy and create new custom objects. You do not need to know the specific process of creating the original o
Three main features of object-oriented design: 3. encapsulation and object-oriented
Add a new assembly:
Right-click solution-add-new project-class library
Select Main project-reference-right-click to add reference
Using assembly
Class access modifier:
The class has
Js object-oriented design: {} is good or function () {} is good. You have replied and I feel good. I would like to share it with you. I have read many JavaScript projects on the Internet, and the objects used are in the form:
For example, jQuery and TinyMCE all have the following shapes:
The Code is as follows:
Var Dialog ={Int: function (){....},Insert: funct
Putting these two concepts together is really not neat. But for those who are keen on design, we only need to use it.
First, we will explain these two concepts. What Is Oo? Haha, maybe everyone will laugh at me. Oo, who doesn't know? Don't talk to me about encapsulation/Inheritance/polymorphism! These are all so-called features. My question is: what is oo doing? For example, suppose you are a project manager. Now you have a task on hand that you need
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.