Archive for the 'Horror Code' Category
Shall configuration be bound to the underlying of your application?
0 Comments Published by Luigi 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 application?
In [...]
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 [...]
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 [...]
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 [...]
Unit Testing internal object state
0 Comments Published by Luigi December 7th, 2005 in Java, Horror CodeI 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 by Luigi June 11th, 2005 in Java, Horror CodeThat 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 = "cd";
[…]
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 |
|---|---|---|---|---|---|---|
| « Jan | ||||||
| 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 | 31 | ||||
Archives
- January 2010 (2)
- December 2009 (1)
- November 2009 (3)
- September 2009 (2)
- August 2009 (4)
- July 2009 (1)
- June 2009 (2)
- May 2009 (4)
- April 2009 (2)
- March 2009 (7)
- February 2009 (5)
- January 2009 (2)
- December 2008 (1)
- November 2008 (8)
- October 2008 (12)
- September 2008 (3)
- August 2008 (2)
- July 2008 (6)
- June 2008 (16)
- May 2008 (2)
- April 2008 (3)
- March 2008 (6)
- October 2007 (1)
- September 2007 (1)
- August 2007 (5)
- July 2007 (6)
- June 2007 (6)
- May 2007 (1)
- March 2007 (1)
- February 2007 (2)
- January 2007 (1)
- December 2006 (2)
- November 2006 (4)
- October 2006 (7)
- September 2006 (1)
- August 2006 (2)
- July 2006 (6)
- June 2006 (3)
- February 2006 (1)
- January 2006 (1)
- December 2005 (5)
- November 2005 (2)
- October 2005 (2)
- September 2005 (7)
- August 2005 (2)
- July 2005 (8)
- June 2005 (12)
Categories
- Books (7)
- Eclipse (10)
- Errors (2)
- Firefox (7)
- Hardware (14)
- Horror Code (8)
- Internet (17)
- Java (85)
- JavaScript (8)
- Life, universe and everything (29)
- Linux (44)
- Mac (18)
- Software (25)
- Speeches and Conferences (8)
- Web (19)
- Windows (16)
Latest
- Syntactic sugar and Java arrays.
- 3G USB Stick on Ubuntu
- Ipod touch with Linux
- Karmic and Luks: USB drive encryption made (almost) easy
- Suspend/Resume in Karmic /2
- Suspend/Resume problem in Ubuntu Karmic 9.10 running on MacBook Pro 5.1
- MacBook International Keyboard and Linux
- Mighty Mouse: reverse horizontal scrolling workaround on Ubuntu Linux 9.04
- Skype 2.1.0.47 beta released, and amd64 packages available!
- Linux RAM Disks

