Object-oriented design heuristics notes (1)

Source: Internet
Author: User
I learned this book from a blog of csdn. Next I will take a look at the strange title and popular style of literature. Today I read Chapter1-2 and think Arthur J. riel, his old man, makes a lot of sense. Besides, there is no more feelings. Maybe it is because I lack the good experience. I had to extract the summary of Chapter2 and chat about taking notes.

Summary of heuristics

Heuristic 2.1 All data shocould be
Hidden within its class.

Heuristic 2.2 users of a class
Must be dependent on its public interface, but a class shoshould not be dependent
On its users.

Heuristic 2.3 minimize
Number of messages in the protocol of a class.

Heuristic 2.4 implement
Minimal public interface that all classes understand [e.g., operations such
Copy (deep versus shallow), equality testing, pretty printing, parsing from
ASCII description, etc.].

Heuristic 2.5 do not put
Implementation Details such as common-code private functions into the public
Interface of a class.

Heuristic 2.6 do not clutter
Public interface of a class with things that users of that class are not able
Use or are not interested in using.

Heuristic 2.7 classes shold
Only exhibit nil or export coupling with other classes, that is, a class shocould
Only use operations in the public interface of another class or have nothing
Do with that class.

Heuristic 2.8 a class shocould
Capture one and only one key pair action.

Heuristic 2.9 keep related data
And Behavior in one place.

Heuristic 2.10 spin off
Nonrelated information into another class (I. e., noncommunicating behavior ).

Heuristic 2.11 be sure
CATEGORY actions that you model are classes and not simply the roles objects
Play.

Since there is nothing to say, don't talk about it. It's better to calm down and design it. In practice, we can understand the essence of good... practice make perfect!

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.