Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Counter.java

Name: Anonymous 2014-09-04 11:02

why the fuck do retards have to invent a goddamned class just to use a goddamned integer? have people no shame?

Counter.java

/**
* A simple counter class that can be initialized to
* a specific value, incremented, and cleared.
* @author Owen Astrachan
*/

public class Counter
{
int myCount;

/**
* Construct a counter whose value is zero.
*/
public Counter()
{
myCount = 0;
}

/**
* Construct a counter with given initial value.
* @param init is the initial value of the counter
*/

public Counter(int init)
{
myCount = init;
}

/**
* Returns the value of the counter.
* @return the value of the counter
*/
public int getValue()
{
return myCount;
}

/**
* Zeros the counter so getValue() == 0.
*/
public void clear()
{
myCount = 0;
}

/**
* Increase the value of the counter by one.
*/
public void increment()
{
myCount++;
}

/**
* Return a string representing the value of this counter.
* @return a string representation of the value
*/

public String toString()
{
return ""+myCount;
}
}

Name: Cudder !MhMRSATORI 2014-09-05 11:40

>>9
It's a horrible example, which upon further Googling appears to come from this disgusting ENTERPRISE ABSTRACT BULLSHITE-filled treatise: http://introcs.cs.princeton.edu/java/33design/ . OP should definitely submit it to The Daily WTF.

>>6,7
These ivory-tower architecture-astronaut abstraction-worshipping academics are entirely what's wrong with computer science. I can't stand reading through all of that link above but here's the part that's relevant to OP's WTF-inducing class:

Program Counter.java implements a counter, e.g., for an electronic voting machine. It encapsulates a single integer to ensure that it can only get incremented by one at at time and to ensure that it never goes negative. The goal of data abstraction is to restrict which operations you can perform. Can ensure that data type value always remains in a consistent state. Can add logging capability to hit(), e.g., to print timestamp of each vote. In the 2000 presidential election, Al Gore received negative 16,022 votes on an electronic voting machine in Volusia County, Florida. The counter variable was not properly encapsulated in the voting machine software!

THIS IS ABSOLUTE BULLSHIT. The bug is not because of "encapsulation", "information hiding", "abstraction", or any other politically-correct buzzword that's trendy these days. It is, plainly and simply, because whoever wrote that code was an idiot!

Theme = limit what you, the programmer, can do.

What the goddamn motherfucking bloody cuntshit!? If programmers are causing bugs, then it is absolutely the wrong thing to do to try to make it impossible for them to create bugs, because then they'll just never learn and their brains will decay instead. This naturally causes a feedback loop where the academics then try to come up with even more restrictive languages, and the programmers get even stupider in response, etc. It's the perfect solution to control-freak management in corporations whose goals are (implicitly) to take over the world - make everyone else stupid, so they can rule. Why else do you think we're seeing computers and OSs become more "secure", "encapsulated", and "user-friendly"? Knowledge is power and the corporations who want to control their users don't want them to know so much about how things really work, because an intelligent user/programmer is one who will be far less easy to manipulate. They can espouse all the benefits of "information hiding" with candy-coated words but it doesn't change the fact that it's a clever way of discouraging people from "knowing too much"!

Seeing this shit spewing from the mouth of someone who is in the education system, in a position of power, is overwhelmingly rage-inducing. They're deliberately turning people who potentially are very intelligent and creative into mindless drones/slaves, and if you don't think this is bad, you've likely been brainwashed already... The right way forward is to improve programmer education (i.e. not feed them this tripe), by letting them make mistakes so they'll learn from them.

"Freedom is not worth having if it does not include the freedom to make mistakes."
"Those who give up freedom for security deserve neither."

/rant

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List