Avoiding the "hammer" mentality

Source: Internet
Author: User

Avoiding the "hammer" mentality

Yesterday saw "Big talk design Mode", which talked about the protagonist's side dishes, since the understanding of object-oriented inheritance, like the use of such code structure, and thus limit the thinking of things.

I began to reflect on my recent thoughts. To warning AH.

First, Rethinking

The essence of this "hammer" mentality is to want immediate return-I learned this hand, it should be put in handy, otherwise I paid the time and painstaking efforts, I lost money. The results are likely to be used for use, not only to bring convenience to themselves, but to bring trouble.

Learning technology is actually taboo of such psychology. To warning.

at the same time, learning technology, there should be such a magnanimous -this thing I study, may not use, may use very little, or simply do not use (the likelihood is very small oh, more situation is you in use, lack of unaware). But then again--the night road is much more, will always be used. Unless the road is not right.

Second, combination / aggregation multiplexing principle

inheritance, composition, and aggregation are common means of reusing code in object-oriented.

inheritance. An object's inheritance is defined at compile time, so an implementation inherited from the parent class cannot be changed at run time. The implementation of the subclass has a very close dependency on its parent class, so that any changes in the parent class implementation will inevitably cause the subclass to change. When you need to reuse subclasses is, if the inherited implementation is not appropriate to solve the new problem, then the parent class must be overridden or replaced by another more appropriate class. This dependency limits flexibility and ultimately limits reusability.

combination. A combination is a strong "owning" relationship, such as a wild goose and wings. The geese have wings, and they have the same life cycle. The combination emphasizes the word "group", which is the relationship between the part and the whole.

aggregation. Aggregation is a weak "owning" relationship, such as a wild goose and a flock of geese. Geese are a small goose in fact can still be called the flock of geese. Aggregation emphasizes the word "poly", which is a relationship that contains and is included, but is not necessarily part of it.

Third, Essay

above all is a big big paragraph is copy of "Big Talk design pattern" exact words. If we just organize and parse other people's things, it is impossible to surpass them. Only you to create, to open up, to build the things that the predecessors did not, can become opinion.


Avoiding the "hammer" mentality

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.