Looking into a helper class written by someone who was clearly not a master of their craft. The class deals with some string IDs...

public getIDPosition1(String id){
return id.substring(0,1);

So far so useless. But it gets better. What is declared immediately below the above method?

public getIDPosition2(String id){
return id.substring(1,2);

And below that? You guessed it:

public getIDPosition3(String id){
return id.substring(2,3);

This continues to position 10.... -.-

  • 16
    Probably got paid by the amount of lines of code...
  • 3
    How can you feel decent about doing that?

  • 6
    That is... Not spaghetti code, at least.
  • 3
    1-based indexing... Urgh!
  • 2
    He must be concatenating all of those to get the full ID. Isn't he?
  • 3
    Unacceptable, how could he forget the setIDPosition1,2,3 methods
  • 4
    This is like un-programming. It's already in a more abstract form! You'd think having to type almost the exact same thing out 10 times would be a clue.
Add Comment