UNIX programming has its own specific style, we should try to follow this design style when we learn UNIX programming, it can help us to avoid some problems.
Simplistic
Many of the useful and easy-to-use UNIX system software are simple, small, and understandable. "Small and simple" is a technology worth learning. The larger and more complex systems are destined to contain larger, more complex errors, which is a very painful thing for us to debug.
Centralization of
It is usually much better to have a program perform a task than to concatenate all the functions together. Bloated programs are generally difficult to maintain and use, and modifying one function of the program can easily cause other errors and affect the use of other features than a single-function program. In UNIX programs, when a user emerges with new requirements, we often combine gadgets together to achieve a more complex task rather than trying to put the user's needs into a single program.
Reusable components
Implement the core of the application as a library. With a simple and flexible programming interface, a fully documented library can help others develop similar programs, or apply these technologies to new application areas. The DBM Library is an example of a reusable set of functions rather than a single database management program.
Filter filters
Many UNIX applications can be used as filters. In other words, they convert the input and produce output. As you will see later, UNIX provides mechanisms that allow us to combine some Unix programs in a novel way to develop quite complex applications. Of course, this type of reuse is supported by the development approach we mentioned earlier.
Open File formats
The most successful and popular UNIX programs are either plain ASCII text files or XML files as configuration files and data files. If you're using any of the procedures when you're developing a program, you're doing the right thing! It enables users to modify and search for configuration items with standard tools, and to develop new tools to perform new functions on data files. The Ctags source code cross-reference system is a good example of how the symbolic location information is recorded in the form of a regular expression appropriate for use by the search program.
Flexibility
You can't expect users to be able to use your program very correctly. Therefore, you should try to consider flexibility when programming, avoid arbitrarily restricting the length of the field or the number of records. If you can, the Web program you write can run on a single machine and across the network. Never think you know all the things users want to do.
Learning the path of Linux programming (1) UNIX Programming philosophy