Hi. I`ve written some smaller projects in C, like programs which were listening on a specified port, and parsed coordinates coming from a gps device, or mini chat servers, so I know how to do some things in C, but I don`t have experience in it. Especially I don`t have experience in writing easily extensible code in C.
At work for years I used languages like Java, Actionscript 3, little objective C, and because these languages have an object oriented nature they made me think my projects in an OO way, like there is Class B which extends Class A, and overrides the methods where the implementation is different, etc. Because C doesn`t have classes I`ve looked around for some techniques to simulate them, like structures which have function pointers, or functions which call other functions instead of overrides, but the resulting code was messy, hard to understand (even by me after a time).
I tried to look at projects like the apache web server, php, svn or git, to steal some ideas and techniques, but these are large projects and just by reading the source code, I wasn`t able to see, how they are structured overall.
I would like to know how do you structure your projects, what techniques do you use to keep the code understandable and easy to maintain and extend without generating redundant code? I`m not interested in code samples necessarily, just the ideas behind them. Or if you know any good books about writing quality c code, please give me some links.
Kernighan and Ritchie did a wonderful job creating this language, I like it`s simplicity and I would like to know not only how to write an if statement or declare a pointer, but also how to organize larger projects to be easy to maintain and understand.
Thank you