C + + programmers have to master open source projects

Source: Internet
Author: User

as an experienced C + + programmers, must have written a variety of functions of the code, such as encapsulating the database access classes, encapsulating the network communication classes, encapsulating the log operation of the class, encapsulated the file access class, encapsulated UI interface Library and so on, but also in the actual project application, but back to think carefully, in fact, they have written before the code, can only be used in a specific project or a specific environment, for their own, in different projects, only need to copy code, change can also be, Because the code you write is very familiar to me. 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, can be applied to a variety of different needs. If 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 programmer, a lot of things have no need to re-development, can be directly used, after all + the century is over. N years. There's no need to reinvent the wheel ( There's no denying that the process of inventing wheels 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 masterACEand theLibevent,One is a heavy-weight network library, and one is a lightweight network library. Think about it, now that app doesn't use the Internet. Do not understand the network, you will be unable to move AH. The premise of being familiar with these two open source libraries is that you must understandSocketthe principle of a good book recommended to everyone is theUNIXnetwork Programming, read this book can be, and other what theWindowsNetwork Programming "None of this, because network programming, you learned Berkeley socket, you can do network programming on any platform, do not need to learn anythingWindowsunder the network programming, becauseWindowsThe network is coming from Berkeley sockets. If you studyWindowsnetwork Programming, then you were there that dayLinux,Unixnetwork programming, you have to learn a bit. There is no need for that.

second, the database

database, open source.Mysqland open-sourcePostgreSQLas long as you know one of them, the business database is in control of aOracleYes, the file database is in control.Qlite. but please note, do not be confused by the database name above, the nature of the database isSQLstatement, must understand the basic principles of the database, skilled applicationSQLlanguage, understanding of database optimization, stored procedures and so on. The principle of the database to understand, take what database come easy to grasp, will not care isMysqlor isOracleup.

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 operation of some cases. This is a must.

Iv. Management Background

As we all know, writing programs 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 here a handy web - Managed http implementation that can be easily integrated into the application. In IE , enter the listening port, you can view the status of the program. The code has not been carefully collated. A brother in need can give me a message and send it to everyone.  

V. Read the configuration file

All programs must have a configuration file that facilitates configuration of projects and provides flexibility for the program. So write a program that must have a wrapper class to read the configuration file.

Six, Memory pool

All processes need to allocate memory, and allocating and managing memory is a 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 many libraries.

Vii. Cache Library

As we all know, the most used cache library is memcache . This is especially useful when doing database development.  

Eight, the script

Script is a very interesting thing, a lot of features, in fact, we just write a script can be done, the code is small, development speed.

must master the script, compare the general to calculatePerl, very old language, but the function is too powerful. I can assure you that. NET,Javaable to work, certainly can makePerlto do it. Ccapable,PerlNot necessarily capable. Perlas aLinux,UnixThe system integrates the scripting language that must be learned.

The Lua language, the language, is used more in the gaming industry. Do not recommend learning.

Python script, very powerful, recommended to learn.

All of these are all Programs as an experienced C + + programmer, must have written a variety of functions of the code, such as encapsulating the database access to the class, encapsulating the network communication class, encapsulating the log operation of the class, The class that encapsulates the file access, encapsulates the UI Interface Library, and so on, has also been applied in the actual project, but back to think about it, in fact, the code that I wrote previously, can only be used in a specific project or in a specific environment, for yourself, in a different project application , just copy the code and change it, because the code you write is familiar to me. 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, can be applied to a variety of different needs. If 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.

This article transferred from: http://www.toceansoft.com/c/4558.jhtml

C + + programmers have to master open source projects

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.