Archive for the 'Horror Code' Category
Shall configuration be bound to the underlying of your application?
0 Comments Published October 26th, 2008 in Horror CodeWelcome to anti-refactoring lesson number 4. Previously I posted about trivial programming errors, stuff for amateur programmers as in last case. Here we go for a more conceptual mistake. Answer this question: from 1 to 10, how do you think it's smart to bind the name of a configuration property to the internals of your [...]
Welcome to anti-refactoring lesson number 3. The "Repetita Juvant Principle" is the counterpart of the DRY principle: 1 @Override 2 public SomeObject getSomeObject() { 3 return super.getSomeObject(); 4 } 5 6 @Override 7 public void setSomeObject(SomeObject arg0) { 8 super.setSomeObject( arg0 ); 9 } Then, you may think... this code has been written for some [...]
Welcome to anti-refactoring lesson 2. There are painters that paint with pencils or brushes and painter that paints with a bucket. A bucket is very effective if you just want a canvas filled. An example: 1 private String prefix; 2 public String getPrefix(){ 3 return getClass().getPackage().getName(); 4 } 5 public void setPrefix(String prefix) { 6 [...]
It is quite fun when you see an extremely verbose code that can be replaced by two or three lines, just removing useless stuff, or using the correct API. But it is much less fun, when an expert makes a huge refactoring on your codebase covering it of useless crap. It happened to me today [...]
Apparently, with JDK 7 we will have Strings in switch statements. I got a SCPJ certification long time back, but if someone asks me to write a switch statement in a job interview today, I could probably fail: I begun writing Java code in 2000, and I bet I used switch statement six or seven [...]
I don’t know what XPers whould say about this, but I found it useful. Maybe someone could say: if you are not able to test something of your API, maybe you’ve badly designed your components… or: you should’n test this, because this is internal specifics of your object and you don’t have to know or [...]
Infamous programming errors on curly braced {blocks}
0 Comments Published June 11th, 2005 in Horror Code, JavaThat building Strings using StringBuffer (and in Java 5 StringBuilder) is much faster and less memory expensive than using String concatenation, is not a secret. But porting this concept to extremes, you can fall in coding conventions that mandate to never use String concatenation. And you can face hibernate queries like this: 1String alias = [...]
Search
About
You are currently browsing the NewInstance weblog archives for the 'Horror Code' category.
Longer entries are truncated. Click the headline of an entry to read it in its entirety.Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
Archives
Categories
Tag Cloud
Android API Bash Bios CSS Development Eclipse Encription Error Handling Font Git Google GWT Hardware How-To HTML Installation iPod Java JavaScript Karmic Linux Lucks MacBook Open Source Opinion OSX Pitfalls Pkg Practices Python Resume Security Software Suspend TDD Testing Tools Top Down Tricks Ubuntu Uninstall Wakup On Lan Web Workaround
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.




