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. Continue reading
Monthly Archives: November 2011
#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. Continue reading
#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. Continue reading
#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. Continue reading