RSS

Monthly Archives: November 2011

#24 Sprinkling “trim” through the code

One bad practice I have seen on many occasions is the use of trim() statements throughout the code.  This is a poor coding practice, and it is an indicator of disorganized code. Read the rest of this entry »

Advertisements
 
Leave a comment

Posted by on November 19, 2011 in Coding

 

Tags: , , ,

#23 UTF-8 Encoding

Wondering what encoding to use for your web pages?  Wonder no longer.  Always use UTF-8 encoding.  It is the single best encoding, supports the most characters, the most languages, and is available on every browser.  That is all you need to know: always use UTF-8. Read the rest of this entry »

 
Leave a comment

Posted by on November 3, 2011 in Coding, practice

 

Tags: , , ,

#22 Avoid Multi-purpose Methods

This post is about the tendency to make a single method which does a lot of things depending upon the parameters sent in.  A method should not have multiple purposes, but should have a single purpose, and that purpose should be clearly named in the method name.  I have an example, and I show how it can be improved. Read the rest of this entry »

 
Leave a comment

Posted by on November 2, 2011 in Coding

 

Tags:

#21 Avoid Ternary Conditional Operator (? :)

There is a Java conditional operator, known as the ternary conditional operator, which is often used in entirely inappropriate situations that make poor code.  Abuse of this operator is so common that I advise avoiding it completely unless you know really what it is doing.  Actually there are cases where it works OK, but in many situations it creates larger, slower code. Read the rest of this entry »

 
2 Comments

Posted by on November 1, 2011 in Coding

 

Tags: ,