Never use data which can be localized as part of business logic
I was reviewing a code and came across something as
public doSomeStuff(String shortMonthName){ if(shortMonthName.equlaIgnoreCase("jan")){ //do something} }
.
In this code client passes a month name based on which some logic is executed.
At first it might look as whats wrong? hmm ..what if in future multilingual support is introduced -the month names will be localized and the client supplies equivalant of “jan” in a language other than english –it will simply fail.This is a very simplistic use case, but hope I make my point
Never use data which can be localized as part of a business logic
Posted on August 31, 2012, in Coding practice, Java and tagged Coding practices, design, localized data. Bookmark the permalink. 1 Comment.
Reblogged this on Agile Mobile Developer.