RSS

Tag Archives: code style

Context Error Reporting

One of the biggest mistakes I see programmers make when writing an error message is to forget to include details about the context into the message.  The message effectively “assumes” that the reader knows the context, but that assumption is not always valid, and the error message can fail communicate. Read the rest of this entry »

Advertisements
 
Leave a comment

Posted by on April 20, 2018 in Coding, Design, Poor Error Msg

 

Tags: , , , ,

Software is Clutter-Prone

Software will always increase in amount and size, and that includes not only things that are needed, but unneeded things as well.  Unless you fight diligently against it, code will tend to get more and more cluttered. Read the rest of this entry »

 
Leave a comment

Posted by on January 4, 2018 in Coding

 

Tags: , , ,

When are “best practices” less than best?

A “best practice” is a heuristic which is used to guide early stages of a project, in order to set some patterns.  When should you use them?  More important: when are you justified in ignoring a best practice? Read the rest of this entry »

 
Leave a comment

Posted by on July 3, 2017 in Coding, Design

 

Tags: , , , ,

Two Kinds of Exceptions

An exception is a message from the system to the user about something that the program can not handle. There are a couple of main categories of exceptions: environmental and program logic. They warrant quite different treatment. Read the rest of this entry »

 
Leave a comment

Posted by on March 14, 2016 in Coding, Design, Poor Error Msg, practice

 

Tags: , , , ,

Brainless Getters & Setters are a Waste

Someone long ago set a pattern that all members should have a getter and setter method.  Some are persuaded that this is OO and this is encapsulation, so a lot of inexperienced programmers do this by default.  But this is a problem. Read the rest of this entry »

 
Leave a comment

Posted by on March 7, 2016 in Coding, Example Code, practice

 

Tags: , , , ,

Always use a brace even if not needed

In C, C++, Java, and other languages, you use curley-braces — ‘{‘ and ‘}’ — to indicate the start and the end of a block of code.  However, the braces are optional if the block is only a single line.  This is an option you should never use.  Always use the brace, even if it is a single line. Read the rest of this entry »

 
Leave a comment

Posted by on June 14, 2013 in Coding

 

Tags: , ,