Skip to Main Content
Professional C++, 3rd Edition
book

Professional C++, 3rd Edition

by Marc Gregoire
September 2014
Intermediate to advanced content levelIntermediate to advanced
984 pages
25h 22m
English
Wrox
Content preview from Professional C++, 3rd Edition

Chapter 3Coding with Style

  • The importance of documenting your code, and what kind of commenting styles you can use
  • What decomposition means and how to use it
  • What naming conventions are
  • What formatting rules are

If you’re going to spend several hours each day in front of a keyboard writing code, you should take some pride in all that work. Writing code that gets the job done is only part of a programmer’s work. After all, anybody can learn the fundamentals of coding. It takes a true master to code with style.

This chapter explores the question of what makes good code. Along the way, you’ll see several approaches to C++ style. As you will discover, simply changing the style of code can make it appear very different. For example, C++ code written by Windows programmers often has its own style, using Windows conventions. It almost looks like a completely different language than C++ code written by Mac OS programmers. Exposure to several different styles will help you avoid that sinking feeling you get when opening up a C++ source file that barely resembles the C++ you thought you knew.

THE IMPORTANCE OF LOOKING GOOD

Writing code that is stylistically “good” takes time. You probably don’t need much time to whip together a quick-and-dirty program to parse an XML file. Writing the same program with functional decomposition, adequate comments, and a clean structure would take you more time. Is it really worth it?

Thinking Ahead

How confident would you ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional C++, Second Edition

Professional C++, Second Edition

Marc Gregoire, Nicholas A. Solter, Scott J. Kleper
Expert C++ - Second Edition

Expert C++ - Second Edition

Marcelo Guerra Hahn, Araks Tigranyan, John Asatryan, Vardan Grigoryan, Shunguang Wu

Publisher Resources

ISBN: 9781118858134Purchase book