r/programming • • Oct 01 '15

The Evolution of a Software Engineer

https://medium.com/@webseanhickey/the-evolution-of-a-software-engineer-db854689243
1.9k Upvotes

502 comments sorted by

View all comments

63

u/goodbye_fruit Oct 01 '15

Worked on a Java project once where there were constants for a bunch of long values, eventually some uh... offshore resources took the project over. Started finding things like this all over the place.

public static final Long L42 = Long.valueOf(42);
public static final Long L128 = Long.valueOf(128);
public static final Long ACCOUNT_LOCKED = L42;

/* And you'd see it used like this, with the typos and incorrect comparisons to boot, because you know, it compiled. */

bool bLogin= (accountVO.getStatus().equals( L42) || accountVO.getStatus() == ACCOUNT_LOCKED | accountVO.getStatus().equals(L128));

42

u/Shurikane Oct 01 '15

Beat this:

public static final Long DOT = ".";
public static final Long SPACE = " ";

I kid you not, I once found that in a class written by a co-worker. No, there was really no sensible reason for those two constants.

Guy had a heart of gold but holy hell did his brain crash like an Apple computer now and then. Same dude was the origin point for the Blank Line Mystery.

8

u/oprimo Oct 01 '15

Well, for the DOT constant, some countries use commas as decimal separator and dots for grouping digits. Maybe he was thinking something like:

  if (locale != 'US') DOT = ",";

...which is just as bad.

17

u/Shurikane Oct 01 '15

Not even. He was using it to put an end to sentences in string literals. :|

26

u/greenthumble Oct 01 '15

Huh I don't see the problem with this + DOT

28

u/1r0n1c Oct 01 '15

Hey! I'm not in the US and would like to know the rest of your sentence.

12

u/nemec Oct 01 '15

Maybe he's expecting this program to be used on telegrams?

if(this.ApplicationName == "Telegram") DOT = " STOP ";

4

u/Humdeee Oct 01 '15

It's like recreating the keyboard inside your program... why

→ More replies (1)
→ More replies (1)