Random Thoughts (Build your own code base)

Source: Internet
Author: User

"Disclaimer: Copyright, please reprint, do not use for commercial purposes." Contact Box: feixiaoxing @163.com "


There was a time when I was very upset about how to improve the robustness of my Code. Is there no other way than unit testing? This problem has been scratching me for a long time. Until recently there was a hint. As a whole project, it involves a lot of uncontrollable factors. And for individuals, there are many difficult things, but there are many ways to improve the efficiency of personal development methods. For example, it's a good idea to build your own code base. The method of improving efficiency can be achieved in a short time by using already tested methods.


(1) Create your own local function library code

Building a code base is one of the most basic methods. For example, if the algorithm is more proficient, you can create a basic function library code locally. The code can include some basic algorithms and data structures, such as linked lists, stacks, heaps, binary trees, sorting algorithms, lookup algorithms, and so on. Note that the code as long as you use it conveniently, as for the short time can be used for others, that is something.


(2) Creating a Cross-platform code base

Now, the code we need often needs to implement cross-platform functionality. Therefore, we can build some basic cross-platform functions locally, such as memory access, thread mutex, file operations, network operations, database operations, and so on. Of course, other factors such as byte-order, byte-order should also be considered. Because building a local Cross-platform code base is a long-term basic work, but once done, not only can improve their ability to understand the code, but also effectively improve their development efficiency.


(3) abstraction and refinement of existing business modules

There is no denying that much of what we do now has a lot of repeatability, so whether we can refine the business and abstract out a basic architectural module. A standalone module can schedule a compiled macro, and if the module itself does not support it, you can simply not allow it to participate in the compilation. After refining the module, not only can have a great expansion, but also in the robustness of the above will be guaranteed.


(4) More use of Open Source Library code

Many times, we use open Source Library code, does not represent the corresponding code we do not have the means to write out. Just because of the problem of efficiency and time. If the industry has a more recognized and authoritative code, then we really do not need to repeat the wheel of car building. This is a lot of code, such as Lua, WebKit, ffmpeg, Zip, libpng, libjpg, lwIP, Ucos, SQLite, FTGK, and so on. As long as we're testing the code, why doesn't someone else's code work for us?


(5) Save and improve your practice code

A lot of people have a bad habit, including me, of course. That is, we don't pay attention to accumulating the usual practice code. After a while, you'll find that you've actually practiced the code. But the original code already no longer exists. Save the original code, so that our work can be built on a higher starting point, while saving time. Now the mobile hard drive so cheap, put a few 10 trillion or hundreds of megabytes of code, I think there should be no problem. This is always more than DotA, QQ rook, NBA, live football, the Chinese paladin, the world, Tianlong eight space to less.



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.