How to port Java code to C ++

Source: Internet
Author: User

In actual development, some third-party open-source components or commercial components are usually used in our projects or products to help developers implement some specific general functions, such as XML parsing, regular Expression parsing and data compression. Generally, we will consider independent R & D only when both of them cannot meet the existing needs. Because appropriate third-party application components can ensure that developers can devote more energy to the core of the product.AlgorithmAnd core business logic, so as to ensure that the product development cycle and product quality can reach the satisfaction of the customer and the company.
Compared with open-source components, many commercial components provide more user-friendly interfaces and rich documentation and examples.CodeAnd more flexible interfaces and functions. Generally, once we select a commercial component, the functions provided by it can meet our needs. However, this is not always the case for open-source components. We occasionally need to make some modifications to them or perform secondary encapsulation on their interfaces. Fortunately, the main function will not be affected. As we all know, Java's Open SourceCommunityIt is extremely active and provides many open-source components with rich functions. Compared with Java, the number and function richness of open-source components of C ++ are eclipsed. In view of this, we can choose to re-implement some or all of the existing Java components with C ++ and form their own basic components. Compared with self-development, this method does reduce some risks, but it is still a thorny but challenging road. However, developers can benefit greatly from the entire code porting process. The following lists the main points:

1. Many open-source components are completed by developers with rich programming experience. Their design style and implementation skills, as well as the handling methods for detailed problems, will bring us some help and inspiration.
2. The paper is just a glimpse of the end, and I know that this is the case. Many design skills can be realized only when coding in person or writing test cases for yourself.
3. You can better understand the differences between the two languages, fully explore their potential, and identify their respective advantages and disadvantages. In this way, we can better control these two languages in future development.
4. many times, language differences affect the design of components. Our goal is to make full use of the features of the current language to complete our design and implementation, instead of coping with all the languages in a common way, this will often give people a sense of being in the city.
5. In the implementation process, you may master an algorithm or a common industry standard.
6. if some algorithms or functions are good at themselves, you can use this opportunity to embed them into the re-implementation component. This not only verifies your own ideas, it can also improve the performance and scalability of new components.
7. Remove some redundant code or functions to improve the efficiency and ease of use of new components.
8. compared with self-developed components, because existing components have processed and analyzed many boundary problems, these problems will also be solved in new components, in this way, the stability of new components can be greatly improved, thus greatly shortening the unit test cycle.

It should be noted that the problems and solutions listed here are only my practical experience. If you have a better solution or encounter new problems, I sincerely hope to communicate with you more, improve together.

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.