Original address: http://blog.csdn.net/feixiaoxing/article/details/7749331
"Disclaimer: Copyright, welcome reprint, please do not use for commercial purposes. Contact mailbox: feixiaoxing @163.com "
First, History
Open source code as a feature of the product, with the progress of the Internet of things has been unprecedented development. At first, many of the code is actually not open source engineering, and later software developers found that it is impossible to use the code to make money, so simply put the code on the Internet, so that more people to carry out maintenance and development, such as the IBM eclipse is like this. Of course, there are many people with similar interests on the web, because the network lets them go together, discuss the program together, discuss the software architecture, slowly the community will become more and more influential, the best thing to do is Linux, KDE, GNOME and other software. Later, after the development of the community, many big companies in order to let these open-source software on their own hardware equipment to run, have to invest resources in these open source projects, the establishment of a corresponding foundation, contribution code, such as HP, Fujitsu and so on. Until later, some companies actively develop open source software, do not expect them to give the company any benefits, but hope to bring a broad popularity, such as Android software.
About open source code, actually want to say a lot of content, each person also has own experience. Today, I would like to talk about some of my own experience in the open source code, of course, the project is mainly based on C language projects, for other search projects, framework projects, platform projects have little experience, also talk about bad, I hope you have a lot of understanding.
second, the characteristics
Compared to proprietary software, open source code has a lot of its own characteristics, we might as well chat to see,
(1) The quality of open source code is different;
(2) Open source code in different forms, some complete software, and some just plug-ins;
(3) The source code heat is not the same, many software is actually no one to maintain;
(4) Open source code generally does not have a dedicated support staff, a lot of things need to solve their own;
(5) The compilation environment of open source code is very different, try to find the right one.
Third, read the code
To read the code, you need a lot of upfront conditions. First of all, you have to compile the software, and then you need basic software knowledge, the common debugging methods must be mastered; Finally, for the software itself needs to understand the content of the video playback to know the video codec related knowledge, make compression software to know the compression of related algorithms, engage in search engines need to know crawling, Knowledge of Word segmentation and index finding, of course, these are some basic conditions. So, if we have done the above, what should we do next?
(1) Download the code, compile it locally, build the version;
(2) Skilled use of the software, understand the basic functions of the software and operating methods;
(3) According to the SOFTWARE function analysis software module structure;
(4) Find out where a software is most likely to break, set a breakpoint to view the context;
(5) To judge the context of the code, gradually unfold;
(6) Try to modify the code, recompile to verify their ideas, loop it;
(7) Constantly expand the reading range of code, pay attention to record notes and share with friends;
(8) When analyzing the code, avoid fast, yimushihang rather than read a line.
Four, the compilation environment
For C and C + +, it's more of a Windows environment and Linux environment. In fact, C language compilation is actually quite simple, Windows above has Visual Studio Help, Linux above has autoconf and automake this powerful tool, compile looks is an easy thing, actually,
(1) different compilers for C language Support standards are not the same;
(2) Different versions of the compiler will also appear inconsistent compilation;
(3) Many software often need to be modified, this is the test of basic skills for everyone;
(4) Some software needs to rely on third-party libraries, need to compile themselves;
(5) Some software only support the high version of the compiler, porting to the lower version of the compiler to rely on their own;
(6) Some software using Linux can be compiled, but in Windows Cygwin is compiled but;
(7) Some software compile time is long, and memory occupies large, once the compilation fails, naught;
(8) header file failure, link failure, data type conversion failure, many cases need to deal with their own solution.
v. Select Code
There's a lot of code on the Web, but choose the code that really works for you. Otherwise, for low-quality code, even if you download it, it's no use.
(1) Download high-quality code;
(2) The code to be downloaded should be well-structured and write the specification;
(3) Download the code to be compiled;
(4) The downloaded code is best kept evolving;
(5) The downloaded code is best verified for a long time;
(6) Download a piece of code that can be used independently, good reading, good summary;
(7) Use the industry's widely used open source code to reduce costs and try not to fight alone.
Six, download tool
The current approach to code download is still a lot of, of course, the simplest, most convenient or directly from the server to download the use, but now there are a lot of download software, for example,
(1) SVN tools;
(2) Git tools;
(3) FTP tools and so on.
Vii. Search for code
I usually see the code is mainly C and C + + code-based, Java code will occasionally look. Usually in addition to their own accumulation of some code, will also take the initiative to find some code, for example,
(1) Find the relevant code on the SourceForge;
(2) Find specific code on Google code;
(3) To find Java related code on Apache website;
(4) directly to the open source project site to find code;
(5) to csdn and other websites to download code, occasionally there will be unexpected harvest;
(6) The code to download the book appendix to the book publishing house;
(7) Contact the software author directly to see if you can get the relevant open source code.
Viii. Learning projects:
(Coolplayer): a complete MP3 player
http://coolplayer.sourceforge.net/
Lua: A complete scripting virtual machine
http://www.lua.org
FTK: A simple GUI solution that both Windows and Linux can use
Http://code.google.com/p/ftk/downloads/list
Ucos: Practical, real-time embedded operating system code
Http://micrium.com/page/home
EMule: Good-to-peer code
http://www.emule.org.cn/download/
(Irrlicht): Open source 3d engine
http://irrlicht.sourceforge.net/
(TightVNC): Remote control code, both client and server
http://www.tightvnc.com/
ToDoList: Powerful task management software
http://www.abstractspoon.com/
(notepad++): A useful text editing tool
http://notepad-plus-plus.org/
(Pnglib), Jpeglib: Photo library file
http://libpng.sourceforge.net/
http://sourceforge.net/projects/libjpeg/
(one) CUnit: Unit Test library file
http://cunit.sourceforge.net/
LIBSVM: A useful data Mining library
http://www.csie.ntu.edu.tw/~cjlin/libsvm/