RSS

Monthly Archives: January 2019

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

Java TimerTask Implementation Pattern

When implementing a TimerTask class, there are a couple of things to remember. Read the rest of this entry »

 
Leave a comment

Posted by on January 15, 2019 in Uncategorized

 

Simple Rule for Exception

If you want a program that runs reliably, then there is a simple rule to follow about exception handling.   It is so simple, it can be stated in a single sentence:   if a method does not accomplish what it is supposed to do, it must throw an exception.   Read the rest of this entry »

 
Leave a comment

Posted by on January 11, 2019 in Uncategorized

 

Poor Exception Handling Examples

Having just written about JSON error messages and exceptions, I did a small survey to see what others were doing, and I saw some of the most egregious examples of poor coding.   Sloppy exception handling makes programs that behave bad when the network runs into problems, and causes no end of suffering.  Here are some poor examples and why they are bad. Read the rest of this entry »

 
Leave a comment

Posted by on January 10, 2019 in Uncategorized

 

Ultimate Java Exception Class

This is the third in a series about translatable exceptions (see Translatable Error Messages).  This post is about the class JSONException which contains the required features. Read the rest of this entry »

 
Leave a comment

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

 

Tags: , , ,

Exception Receiving

When you make a web service call, you want to report the problem to the user save as you do for any other part of the program, and that is through an exception object.  This post talks about converting the JSON received back into an exception object so that it can be reported properly.  This is the fourth post in a series about translatable errors for REST web services. Read the rest of this entry »

 
1 Comment

Posted by on January 8, 2019 in Coding, Design

 

Tags: , , ,

Variable Arguments for Messages

We need to construct an object which has a template and a set of parameter data values.  Java offers a couple of ways to do this, and this post shows how the variable parameter mechanism works easily and conveniently for this purpose. Read the rest of this entry »

 
1 Comment

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

 

Tags: , , ,