Express yourself clearly .... in the code you write

Speaking with people face-to-face, on the telephone, or via email requires a clear understanding of what you want to say.

Effective communication is so important.  You have control of what you want to say.

You cannot expect to have the same direct control with all the individuals (and technology) you communicate with.

For example Mobile telephony is annoying in that the operating environment is complex and frustrating.  Try making a call with poor reception, with the background noise of a  busy London street, while others  “try” to do the same.  Everyone is trying to be heard.

**Writing code **faces the same situation.  The code you write should focus on what you specifically _want to say - through the code itself, style, comments, and _clear view of what you are trying to solve.

You have some code which reads a file, does some reporting, and then processes…..

void process() { open a file   // we open the file while() {   //read line by line into a variable and do some reporting on each line } // process the file }

Follow the usual best-practices by splitting the code into individual parts.  But think about what you are saying in your code.

The valuable choice is made in point 4.  This simplifies what you are saying in your code:

void process() {  // **1.**  rename method so it describes the task open a file   // - **2.**  move into own method // we open the file - **3.**  remove this comment it's not needed while() { read line by line into a variable and do some reporting on each line **4.**  **D****o** we need to do reporting here?  Far simpler to remove it.   // IF you remove it - add a relevant comment and make sure that a code Wiki / check in comment is relevant (up-to-date). } // **5.**  process the file - move into own method

Author | Miles Davenport

Career programmer, who designs, assembles, fixes, and supports customers, software and systems.