Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "private static final"
-
Today I saw this in our code base:
private static final int THREE = 3;
To do this:
rating += THREE;
I laughed, and cried a little.8 -
One of our devs seems to love "attribution" comments in anything he writes.
private void foo() { //Author: John Cribbins
...public static final int FOO_BAR = 21; //Author: John Cribbins
I mean, I get it for an author tag at the top of a file, but certainly not on every field or method. Is this some kind of weird thing newer devs are encouraged to do these days?!9 -
private static final int TEN = 10;
private static final double THOUSAND = 1000.0D;
[a copy-paste from our repo]12 -
Since becoming an "Architect", I've come to learn "Architect" simply means siphoning your will by eliminating all opportunities to actually write code ...
public class Architect {
static final boolean inMeeting = true;
private int will;
public static void main(String args[]){
Architect me = new Architect();
if(me.inMeeting){
while(meeting.active){
me.reactToEvents();
}
}else{
me.writeCode();
}
}
public void reactToEvents(){
if(new Random().nextInt() % 3 == 0)
will -= this.hit(this.face, this.palm, Force.CONSIDERABLE);
else
will -= this.hit(Office.desk, this.head, Force.MODERATE);
}
public int hit(Object object, Object with, Force force){
object.useForce(force);
object.moveTo(with);
return new Random().nextInt();
}
}1 -
So, I need to customize some shit for my company's app...
Just discovered they somehow manage to call a protected method on an object stored in a field... I can't even... How does that even compile? And also, things neccessary for my subclass are private with no getter...
private static final int ZERO = 0;
private static final int ONE = 1;
private static final int TWO = 2;
What. The. Hell. Why?
Damn Java. Though this is the programmer's fault, it does seem to favor this kind of shit.2 -
Jason Bourne logic: type "run predictive algorithm" without any parameters into a terminal and it returns the locations of whatever you want. Either that function is the _best_ at predicting user input, or its variables are so hardcoded that we've just discovered the hardest material on earth2