Thread: Programming Habits

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    Programming Habits

    Hi,
    I was wondering if someone can point me to some good books or on-line tutorials with good programming habits for preventing runtime error, code clarity and readability, etc?
    I have been bothered by these kinds of problems now and then. I've been trying to summarize the lessons that I have experienced, but advice from others is definitely in great need.
    Thanks in advance!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    One good resource would be C++ Coding Standards by Sutter and Alexandrescu.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    159
    Thank you! I am going to take a look.

  4. #4
    Registered User
    Join Date
    May 2007
    Posts
    147
    The series of books starting with "Exceptional C++" and More Exceptional C++, published by Addison Wesley, are all good reads. I'd dare say, must reads, perhaps.

    The series "Effective C++" isn't bad, either.

    One of Laserlight's suggested author, Alexandrescu, is always an authoritative source.

    Among the general themes you'll encounter; design patterns. The bottom line, that's probably the bulls' eye of the answer to your inquiry, but by no means the end.

    If you're not familiar with boost, you will want to become familiar with it, even if you only select portions for use. Pick up an introductory text if online resources aren't adequate for you (there's a "Beyond the STL, an Introduction to boost" text somewhere). Of course, this also assumes you're familiar with the STL, which boost 'extends'.

    I don't recall the book's name, but there's a 'standard' text on design patterns - google for design patterns, the wiki entries refer to it.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by JVene
    I don't recall the book's name, but there's a 'standard' text on design patterns
    You are probably thinking of the GoF book, which is titled Design Patterns: Elements of Reusable Object-Oriented Software.

    Quote Originally Posted by JVene
    One of Laserlight's suggested author, Alexandrescu, is always an authoritative source.
    Sutter chaired the C++ standard committee for quite awhile.
    Last edited by laserlight; 04-25-2009 at 03:39 PM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Reading books on the subject of "secure" programming will also help - because many security holes are by "poor conventions". Sorry, haven't got any titles to offer - I think the book I have is a MS one called "Secure Code" - but it's in one of the boxes in the loft at the moment.

    --
    Mas
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Neurotic bodily habits when coding
    By Sharke in forum General Discussions
    Replies: 36
    Last Post: 06-22-2009, 10:53 AM
  2. Bad coding habits
    By Magos in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-12-2005, 05:44 PM
  3. Learning Rate Of C++
    By Krak in forum C++ Programming
    Replies: 27
    Last Post: 01-29-2003, 01:53 PM
  4. Professional Habits?
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 01-17-2003, 02:27 PM