Atitit. ---Normalization of Api design principles

Source: Internet
Author: User

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

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.