Skip to main content
Engineering LibreTexts

2.2: The Importance of Good Looking Code

  • Page ID
    29015
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Why Looking Good is Important

    There is a contest - The International Obfuscated C Code Contest - who's goal is to: 1) to write the most Obscure/Obfuscated C program within the rules; 2) to show the importance of programming style, in an ironic way; 3) to stress C compilers with unusual code; 4) to illustrate some of the subtleties of the C language; and 5) to provide a safe forum for poor C code. :-). The term obfuscate means to make something obscure, not easy to understand. Go and look at their web site - the code is there. This is how you should NOT!! write your code. Code written to be obscure will not get you very far as a software developer, so lets set down some ground rules for this class.

    As a software professional you sit in front of a computer day after day crunching out code. A true professional will take pride in their work, and ensure that the code is more than just some characters typed into a file that gets the job done. It takes a true "code master" to write code with style. As affirmed by the Obfuscated code contest, we can write code that does something, and at the same time is difficult to read, almost impossible for anyone else but the original programmer to debug, and is a maintenance nightmare.

    If you continue to pursue the world of software engineering as career, you will find opportunities for promotions as you gain experience. The code you worked on ever since you started your current position will now become the responsibility of someone else to continue to develop and to maintain once the project is released for public use. If you wrote good code, followed some of the ideas we are going to talk about, that person will be grateful for your extra effort to write readable, understandable code.

    Writing good code has several concepts that will discuss in the next few pages. These concepts will be required in all the code you write this class as well:

    • Documentation
    • Decomposition
    • Naming
    • Use of the language
    • Formatting

    This page titled 2.2: The Importance of Good Looking Code is shared under a CC BY-SA license and was authored, remixed, and/or curated by Patrick McClanahan.