As an experienced, C + + program Ape, must have written a variety of functions of the code, such as encapsulating the database access to the class, encapsulating the network communication classes, encapsulating the log operation of the class, encapsulating the file access to the class, encapsulated UI interface library, etc., but also in the actual project, but back to think carefully, In fact, I have written this code, can only be used in a specific project or a specific environment, for themselves, in different projects, only need to copy the code, change can be, because their own code is very familiar with writing. The problem is, you encapsulate these libraries, in the use of others, when others are very convenient to use, cross-platform is not also very common, performance is not enough good, is not support multi-threading, the function is not strong enough to apply to a variety of different needs. Assuming you've done all of this, it's a testament to the fact that you've spent a lot of time on this library, and it's been continuously improved and optimized.
In the daily development, as a program ape, a lot of things have no need to develop again, can be used directly, after all, 21st century has been over n years. There is no need to invent the wheel again (there is no denying that the process of inventing a wheel can learn a lot, and that's how I came along).
The following combination of their own years of development experience, think where to write where, I hope that the new people have some help.
First, the network
The network library must master aces and Libevent, one is a heavyweight network library, and the other is a lightweight network library. Think carefully, now that program does not use the network AH. Do not understand the network, you will be unable to move AH. Familiar with the two open Source Library premise is that you must understand the principle of socket, to recommend the good Book is "UNIX Network Programming", read this book can be, and other what "Windows network Programming" These do not have to look, because of network programming, you learned the Berkeley socket, You will be able to do network programming on whatever platform, do not need to learn what network programming under Windows, because the network under Windows is also from the Berkeley socket, if you learn "Windows network Programming", then you Linux,unix under the network programming that day, You'll have to study a bit. There is no need for that.
Second, the database
Database, open source MySQL and open source PostgreSQL only to understand that one can, business database in mastering an Oracle can, file database Master SQLite. Just please note, do not be confused by the database name above, the nature of the database is SQL statement, must understand the basic principles of the database, proficient in the use of SQL language, understand the optimization of the database, stored procedures. The principle of the database to understand, take what database come easy to master, will not care whether it is MySQL or Oracle.
Third, the log operation
Log operations recommended that you are familiar with Log4cpp this log library, support multi-threading, log redirection to the network, etc. have, anyway you can think of the function of the log, there are.
Log, one is convenient to find the problem, easy to record the implementation of some cases of the program. This is a must.
Iv. Management Background
As we all know, the knock code is for others to use, not their own use, so in the program's ease of use, more to the other side to provide some direct view of the management interface, appears to be divided into important. For the program to provide a Web management interface, convenient for users to log on to view the program's various information, it is necessary.
I have a convenient web management HTTP implementation, which can be easily integrated into the application. Enter the listening port in IE to see the status of the program. The code has not been carefully collated. There is a need for the brothers can give me a message, to everyone sent.
V. Read the configuration file
All programs must have a configuration file that facilitates configuration of projects and provides flexibility for the program. So to knock the code, there must be a wrapper class to read the configuration file.
Six, Memory pool
All processes need to allocate memory, and allocating and managing memory is a very challenging task for C + +.
We recommend Nedmalloc this open source memory pool library. Nedmalloc is a cross-platform, high-performance multi-threaded memory allocation library that is used by very many libraries.
Vii. Cache Library
As we all know, the most used cache library is memcache. It is particularly useful when doing database development.
Eight, the script
Script is a very interesting thing, very versatile, in fact, we just have to write a script can be completed, the code is small, development speed.
The scripts that must be mastered are more common than Perl, very old languages, but they are too powerful. I can assure you that. Net,java's ability to work can certainly get Perl to do it. C capable, Perl is not necessarily capable. Perl as Linux, Unix's system-integrated scripting language, must learn.
The Lua language, the language, is used more in the game industry. Do not recommend learning.
Python script, very powerful, recommended to learn.
These are the more common functions that all programs will use.
In different application areas, need to master different open source libraries, such as game development, may need to master the open source UI library Cegui, open source 3D engine ogre and so on.
There may be distributed File system libraries for distributed development.
Today for everyone to introduce here, slowly intact slowly add.