Atitit. --- normalization of Api design principles
1.1. called normalization 1
1.2. Example of normalization: all objects can be serialized /tostring through an interface implementation 1
1.3. Pan- file concept,2
1.4. everything in the game industry is elf 2
1.1.
called normalization
Interface InheritanceIt is essentially a requirement to "make a good abstraction, which prescribes a compatible interface so that external callers do not have to care about specific details and can treat all objects of a particular interface in a non-discriminatory process"-a program calledNormalization.
Normalization makes it possible for external users to handle a collection of objects that are compatible with all interfaces without distinction -just like the generic file concept of Linux, everything can be treated as a file, without worrying about whether it's memory, disk, network, or screen (and of course, if you need to, you can also distinguish " Character devices "and" block devices, "and then make a targeted design: to what extent, depending on the requirements.
1.2.
normalized instances: All objects can be serialized /tostring through the interface implementation
A, all objects can be serialized/tostring
b, all UI objects are a window, and can respond to Windows events.
It must be noted that all objects (subject to XX conditions) can do anything, not "everything". The latter has no meaning.
Software design is the same. For example, when a message loop is distributing a message, it is sufficient to know that all the UI objects are a window, and that it is enough to respond to Windows messages; It is not necessary to know what each UI object is--the object knows what to do with the message itself.
Reasonable division of functional levels, timely cut off unnecessary miscellaneous information, a layer of upward provide concise but complete information /interface, high-level modules will not be exhausted--kiss is the most difficult and optimal software design method, not one.
Summary: The object-oriented benefits are actually two points.
first, through the encapsulation clearly defined what is the interface, what is the internal implementation of the interface, what is the external caller of the interface, so that we do their own duties, not cross-border;
Second, through the inheritance + polymorphism of this built-in mechanism, at the language level supportNormalization Design and make it possible for insiders to see the design from the code itself --but, note that justSupportnormalized design. A layman who does not know how to make such a design is still unlikely to gain any benefit from the design of the nonsense.
Obviously, without the object-oriented language, not the class, you can do the normalization of the design (such as the old-fashioned universal file concept, the game industry, all the Elves), as can be encapsulated (by defining modules and interfaces), Just use object-oriented language to explicitly declare these directly with language elements;
and with the object-oriented language, full text is a class, does not mean that there is a normalized design. Even, because they are confused by these fancy things, but even more do not know what is the design.
1.3.
The pan-file concept,1.4.
everything in the game industry is Elf
in fact,when the UNIX system presents the generic file concept, the object-oriented language does not exist at all, and the basic abstraction of the game-World Sprite is originally written in C or even sinks;
author:: Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui)
Kanji Name: Etila ( Ayron) , email:[email protected]
reprint Please indicate source: http://www.cnblogs.com/attilax/
Atiend
Atitit. ---Normalization of Api design principles