Using Design by Contract in C by Charlie Mills -- Design by Contract is a programming approach that formalizes the interface between callers and callees, leading to more robust and disciplined code. If your language lacks formal support for DBC, though, are you stuck? No--Charles Mills describes the design and implementation of Design by Contract for the C programming language.Design by Contract is a really great way to develop applications. It was first put forward in 1988 with the book Object-Oriented Software Construction by Dr. Bertrand Meyer (2nd edition published in 1997). This book was the impetus for the development of one of the best OO languages that exists, Eiffel. What is interesting about the article by Mr. Miller is that not only has he described a way of developing C programs under the DBC methodology, it's also that C is capable of using this mythology without becoming so convoluted and complex that the code is unmanageable and unmaintainable. It won't be a elegant as an Eiffel program but it will be something you can easily include in your systems development or any large project.
Ok, call me a geek but I think this stuff is fascinating. I am wanting to get back into programming so learning C and also DBC will be a Very Good Thing. In another life I was a professional programmer. Between 1989 and 1995 I was a mainframe COBOL programmer (developing under MVS, for those who might know these kinds of things). I'm not going to go into my "Why COBOL doesn't suck" rant right now but suffice to say that it was a good and fun time. Then I accidentally became a UNIX sysadmin and web developer overnight and haven't had the chance to do any major development since. Oh, I do get to hack stuff here and there, mostly using bash, perl and php. But it's not the same as developing something that can be more than just a minor little tool or one-off. So I have decided to try and get back into being a "real" programmer.
The plan is to teach myself using some of the better books and web resources. So far I have worked out a program like this -
- (Re)learn basic programming fundamentals using the book Programming From The Ground Up by Jonathan Bartlett
- (Re(re))learn C using the book C Programming for the Absolute Beginner by Michael Vine
- Build on that with more advanced C using Linux Programming by Example by Arnold Robbins
- Finally, GUI programming with GTK+ Programming in C by Syd Logan