Posts Tagged ‘antipatterns’
Extreme Tips for Unmaintainable MIDlets
I stumbled on a blog post containing “Extreme Tips for Lightning-Fast MIDlets“. Let’s look at some of these programming gems:
Avoid synchronization when possible
Mmm, okay. Don’t know about you, but I synchronize code only when I need it. Perhaps the author of this article likes to synchronize on a whim? Not me…
Array-spreading
Example:
// Before int[][] table; // a 4×4 table // After int[] table; // a 1×16 table
WTF?! Let’s look at the pros and cons of this:
Pros:
- marginally quicker
Cons:
- extra computation needed to find the correct array element, if the data structure is supposed to model multi-dimensional data. Espcially relevant if the number of the items in the first dimension isn’t fixed at compile-time
- yields code which is more difficult to maintain. Associated risk of introducing bugs
Tags: antipatterns, j2me
Filed under tech :
Comments (0) :
Aug 5th, 2008