Category Archives: Coding

Factoring Functionality: Who Needs to Know?

There are many ways you can break the functionality of a program into blocks that are manageable: some right, some wrong.  This post promotes a simple principle.  The primary way should be around “who needs to know.”

Posted in Coding, Design, practice | Tagged , , , , , | Leave a comment

XML vs. JSON vs. YML

Here is a side by side comparison of the same data presented in three common formats.  How do they compare?  What are they good for?

Posted in Coding, Design | Tagged , , , , | Leave a comment

Good Error Messages Can Be Easy

Here is an error message I encountered one day.  It is frustrating, because obviously the code was checking something, but it is frustrating because you get no real clues what the problem really was, and a simple change would make … Continue reading

Posted in Coding, Example Code, Poor Error Msg | Tagged , , , , , | Leave a comment

Don’t Erase Wrong Data

Data validation is a tricky area for usability.   On one hand you help the user by catching possible error early.  On the other hand, the validation check can not be perfect, so there are important errors to avoid.

Posted in Coding, practice | Tagged , , | Leave a comment

Safe API Upgrade

First consideration for any Application Programming Interface (API) is how it will evolve in the future.  This critical interface must stand the test of time, and should whenever possible be both upgrade and downgrade compatible. 

Posted in Coding, Design, practice | Tagged , , , , | Leave a comment

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?

Posted in Coding | Tagged , , , | Leave a comment

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 … Continue reading

Posted in Coding, practice | Tagged , , , , | Leave a comment

Let Me Save Incomplete Files

This is a usability problem that I have run into a number of times.   A programmer writes a UI screen to receive a long list of inputs in order to create an object in system.  Save is enabled only when … Continue reading

Posted in Coding, Design, Uncategorized | Tagged , , , | Leave a comment

The Magic of MemFile

In the Purple Utilities Library is a class called MemFile which you can efficiently stream into and out of. Learn to use it properly can increase the efficiency of your programs when reading and writing data.

Posted in Coding, Design, practice | Tagged , , , | Leave a comment

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?

Posted in Coding, Example Code, practice | Tagged , , , | Leave a comment