Why Design Patterns Java implementation of more books, C + + is very small. __c++

Source: Internet
Author: User

We found that design patterns are very popular in the Java community, but not so much in the C + + community, or even a bit of exclusion, what causes this difference.


(1) C + + memory needs to be managed by itself, so some patterns are not easy to use in C + +, but Java does not care about memory, so the use of design patterns in Java has a natural advantage. With shared_ptr, weak_ptr, unique_ptr, etc. joined C++11, I believe that this aspect will be improved.


(2) In the Java Class Library system, many of the design itself is based on design patterns, so when invoking the Java class Library, you unknowingly use the design pattern, which causes you to design your own interface will also use the design pattern.


(3) C + + is commonly used to solve some of the underlying problems, so in C + +, we are more concerned about how to implement a certain feature, but Java with its rich class library, implementation of feature is often not a problem, so they have more focus on design.


(4) design pattern is usually indirect layer, can cause the loss of performance, and the application of C + + occasions often more emphasis on performance. For this issue, if your program is more about performance (such as the kernel), you really shouldn't introduce too many indirect layers, but if your program is more focused on scalability and maintainability, you should consider design patterns.


(5) Many programmers in the C + + community are transferred from C or even assembler, so these people are more accustomed to the process-oriented design approach, that is, using C + + is simply to encapsulate some simple classes and not use design patterns.


(6) C + + supports a variety of programming models, including process-oriented, object-oriented, object-based, generic programming, and so on, design patterns are mainly based on object-oriented, while Java only supports object-oriented development.


(7) The design pattern in the relatively large-scale C + + open source project to use or more, such as Network library ACE, interface Library qt, game engine Orge, Irrlicht and so on.

Related Article

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.