RSS

Tag Archives: code style

What is wrong with this code?

It is code review time, and I offer a sample of Java code for you to critique.   Can you find the problems? Read the rest of this entry »

 
Leave a comment

Posted by on November 14, 2019 in Coding

 

Tags: , , ,

Eliminate Useless Comments

Be careful what you ask for.   I was reviewing some code that had absolutely no comments. I asked the developer to add some comment.   So, indeed they did, however the comments added no value to the code at all.   There is no point in adding comments for comments’ sake.  In fact, useless comments make the code worse by adding lines without adding value.   Let’s talk about what a valuable comment is. Read the rest of this entry »

 
Leave a comment

Posted by on October 18, 2019 in Coding, practice

 

Tags: , , , ,

Keep Things the “Same”

This general design principle does not mean to never change anything, but to consciously create a paradigm where the same things have the same names and are accessed in the same way as much as possible. Read the rest of this entry »

 
Leave a comment

Posted by on January 24, 2019 in Coding, Design

 

Tags: , , ,

Translatable Error Messages

This is the first of a series of posts, I want to go over some of the groundwork of what it takes to make exceptions localizable into other languages. Nothing new here, but just want to explain clearly the requirements of a localizable exception messages.

Read the rest of this entry »

 
3 Comments

Posted by on January 5, 2019 in Coding, Design, Uncategorized

 

Tags: , ,

Constants and Errors

Still reviewing that code base and finding more bad patterns for use of constants, this time for error messages.   This is another “don’t do this” post. Read the rest of this entry »

 
Leave a comment

Posted by on November 27, 2018 in Coding, practice, Uncategorized

 

Tags: , , ,

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 »

 
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: , , ,