RSS

Tag Archives: programming

Return Null or Exception?

I am writing a getter function, and the requested object can not be found.  Do I return null?   Or do I throw an exception?  The answer is “it depends.”  Sometimes both options are needed, but how to decide? Read the rest of this entry »

Advertisements
 
Leave a comment

Posted by on May 11, 2019 in Coding, Example Code, practice

 

Tags: , , ,

Variable Names & Key Values

Constructing JSON in Java can be a bother.  The most standard JSON library requires objects to be created, and then called to put the members on there.  So much easier in JavaScript, but it is not Java script.  Still, one technique to improve the readability is to name the variable in java to match the key in JSON.   Simple concept, easy to do, I sometimes wonder why it is not obvious to all. Read the rest of this entry »

 
Leave a comment

Posted by on May 7, 2019 in Coding, Example Code

 

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

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

Constant Abuse 2

Some programmers believe that constants are the source of all goodness, because it means in the future that everything will be malliable.  Particularly programmers paid by the hour.  This is a mistake.  Readibility suffers if constants are abused.  I am reading some code today which exemplifies this. Read the rest of this entry »

 
Leave a comment

Posted by on November 14, 2018 in Coding

 

Tags: , , ,

The Urge to Merge

Concurrent development of software in a team relies on being able to merge the changes from each person successfully.  Experienced developers will already know this, but there are theoretical limits on how effective merging can be. Read the rest of this entry »

 
1 Comment

Posted by on December 16, 2017 in Coding, practice

 

Tags: , , , ,

Abstraction and Encapsulation

Abstraction and encapsulation are opposite sides of the same coin, and essential to good object oriented software design.  Why the, is there a tendency of some programmers to go in exactly the opposite direction?  This trend and its implication is discussed below. Read the rest of this entry »

 
Leave a comment

Posted by on November 22, 2017 in Coding, Design

 

Tags: , ,