From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Date: Mon, 19 Nov 2012 12:17:10 +0000 From: Balwinder S Dheeman Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit References: <7a746291161fe83e1df0401af21f6ce4@quintile.net> Subject: Re: [9fans] c++ Topicbox-Message-UUID: d8b39008-ead7-11e9-9d60-3106f5b1d025 On 11/19/2012 03:29 PM, Steve Simon wrote: > I need to learn c++ for work - people have strong opinions on > languages I know, and not everyone likes c++ but its a requirment for me. > > I really want to develop a good sence of c++ style, I learnt C at the feet of > K&R and then the plan9 sourcecode so I learnt how to write clean elegant code > (I think :-). The problem I am finding is there are many c++ styles and I have > yet to find a clean and elegant one. > > anyone sugest a project that I could look at that contains well written code? > failing that is there a book that teaches good style? > > I am refering to things like adding a leading m_ to class member variables > (which looks horrid to me but I am willing to learn), and smart locks (mutexs > which unlock on destruct). I think, one should use proper design regardless of program size; keep in mind that the small programs tend to become large programs. In my view this means adhering to the OO (object oriented) programming paradigm making full use of established design patterns. In essence this boils down to programming against interfaces (pure virtual classes in C++). The best books in the best practice category I've come across are: 1. C++ Coding Standards by Sutter and Alexandrescu, and 2. API design for C++ by Reddy. The best OO design pattern introductory book I come across unfortunately uses Java as model language but it's still worth reading for the insight, 3. Head First Design Patterns by Freeman & Freeman. and a few of the must read books: 1. C++ Annotations by Frank B. Brokken http://www.icce.rug.nl/documents/cplusplus/ See also: 1. http://www.cplusplus.com/ The best projects in the best/clean coding style I've come across are: 1. http://yate.null.ro/ 2. http://qt.digia.com/ Hope that helps. -- Balwinder S "bdheeman" Dheeman (http://werc.homelinux.net/contact/)