Embrace open source--linux C + + program apes must be familiar with open source projects

Source: Internet
Author: User
Tags python script

As an experienced Linux C + + program APE, you must have written the code of various functions, such as encapsulating the class of database access, encapsulating the class of network communication, encapsulating the class of log operation, encapsulating the class of file access. Encapsulates the UI interface library, and so on. Also used 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 that the libraries you encapsulate are very handy for others to use when they are being used. Cross-platform aspects are not also very generic, 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. Assuming you've done all of this, it's a real effort to prove you're on the library. has been continuously improved and optimized.

In the daily development. As a program ape, a lot of things have not been necessary 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 ACE and Libevent, one is the heavyweight network library. One 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 sockets, to recommend a good book is "UNIX Network Programming", read this book can be. What else "Windows network Programming" doesn't have to look, because of the network programming, you learned Berkeley's socket. You will be able to do network programming on any platform, do not need to learn what the 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 the day under the network programming. 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 need to understand one of the can, business database in mastering a Oracle can be. File Database Master SQLite.

Just please note, do not be confused by the database name above. The essence of a database is the SQL statement. Must understand the basic principles of the database, proficient in the use of SQL language, understand database optimization, stored procedures and so on.

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, knocking code is for others, not for their own use, so in the application of the ease of use. Give each other a few more direct access to the management interface. seem 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 HTTP implementation for Web background management here. Can be easily integrated into the application. Enter the listening port in IE. will be able to view the status of the program.

The code has not been carefully collated. If you need a brother, you can leave a message for me. Send it to everyone.

V. Read the configuration file

All programs must have a configuration file to facilitate the configuration of some projects. 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. It is used by very many libraries.

Vii. Cache Library

Known. The most used cache library is memcache. It is particularly useful when doing database development.

Eight, the script

The script is a very interesting thing, very versatile, in fact, we just have to write a script to complete. Low code volume, fast development speed.

Must master the script. It's more common to count Perl. Very old language, but the function is 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 is a system-integrated scripting language for Linux, Unix. Must learn.

The Lua language, the language. Used more in the game industry. Do not recommend learning.

Python script, very powerful, recommended to learn.

Ix. File System

Linux under the open source file system is really a lot, EXT2/3/4,XFS,JFFS2 also have the recent hot hadoop,openstack and so on.



Embrace open Source--linux-C + + program ape must be familiar with the open project

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.