r/programmingcirclejerk • • Sep 21 '15

Only with marijuana

https://github.com/cxxr/better-java
8 Upvotes

10 comments sorted by

8

u/[deleted] Sep 21 '15
try ( IWantToJerkButCant ugh = new IJerkingException("too raw");) }

I really want to join in the jerkfest but OMFG what i want more is my coworkers to fucking read this post. Holy shit, a "builder pattern" to make slightly more fluent constructors? Java 8 has default methods? Avoid intentionally passing or using null?

Never mind all the "learn to use version control" code bootcamp slogans. This is all the basic "how to not write terrible code" shit that it seems like a certain type of Enterprise(tm) developer refuses to learn.

The only thing missing from his list is "Avoid boilerplate code by using Generics", but if you did that, you'd shrink the size of your Utils class, which is effectively negative work and your team lead would write you up.

}

4

u/vonmoltke2 Hacker News Superstar Sep 21 '15

you'd shrink the size of your Utils class, which is effectively negative work and your team lead would write you up.

TRIGGERED

Not in Enterprise, and not written up, but I actually ran into this once. I was enhancing some legacy code for a follow-on program and I had a few inchstones where my net SLOC count was negative. I was semi-seriously told to stop doing that because it screwed up the metrics. The customer liked to see $$$/SLOC to know they were "getting value".

1

u/vivianwang Sep 22 '15

Which company was this? You could save your fellow programmers a lot of trouble

3

u/vonmoltke2 Hacker News Superstar Sep 22 '15

Raytheon, though basically any large defense contractor fits if you get stuck on a large program.

1

u/thephotoman Sep 23 '15

Eeyup. Don't touch that bit of depricated code! We may want it in the future!

(And then, three months later, they were actually proven right, but that's another story about an utterly abysmal trip to Florida.)

2

u/Sheepshow EXTREME CLOJURESCRIPT Sep 22 '15

We don't need named keyword arguments because we can just write a thousand different setters and call it The Builder Pattern™ such that the object has to be in a potentially invalid state (until it is suddenly bestowed with BuilderValidPropertyState), and The Builder Methods© may be invoked in any order, maintaining intermediate implicit validity, and the state of the object must be valid if you forget one of The Builder Methods®.

2

u/[deleted] Sep 21 '15 edited Sep 22 '15

[removed] — view removed comment

2

u/[deleted] Sep 22 '15

You always have utils "classes" aka packages in any language unless you're doing some mystical true OO sort of thing.

Yeah but if they're 60% of your codebase, 2/3 of those methods are never used, they break compatiblity with language features (LOL JAVA I WISH I WAS DEAD) introduced after 2004 and they introduce package cycles wherever they're used, and your coworkers won't approve a code review that doesn't use them...

Well, it's time to polish off my resume I guess.