“I’m having a party this weekend. I’ll invite you if you promise to behave.”
“Hah! What’s the dress code?”
“It’s a black underwear event…”
“God is a human construct…”
“Sure. A recipe are also a human construct but that doesn’t mean we don’t need food…”
A: If a tree falls in the forest and no one is there to listen…
B: You’ve apparently never been in a forest…
B: There’s always someone that can listen… or something…
You don’t say? Well, let me counter that with an…
Let me explain. I’m creating a unit test where I need to do some calculations in order to create an expected value (i.e. do the same computation as the function I’m testing but differently… or usually more manually…)
So this is my test (high lighted was marked as “pointless”):
final MinMaxAverage mma = new MinMaxAverage();
final double min = mma.min();
final double max = mma.max();
final double sum = mma.sum();
final double average = mma.average();
final int count = mma.count();
assertEquals(1d*1d + 2d*2d + 4d*4d, sum);
assertEquals((1d*1d + 2d*2d + 4d*4d) / (1d + 2d + 4d), average);
Sure, this test could have used another weight, but I wanted to test with a weight of 1. And regardless… is this pointless arithmetic in a test? Or for that matter in a complex program that might actually benefit from more simple code?
Programming isn’t just coding and numbers… it’s also communicating with other programmers and yourself in a year. Some IDE simplifications aren’t necessarily simplifications at all. Sure, you can make the code look lean and nice, but you probably should think twice about that if it’s a fringe case, something you use very seldom, or in this case the attempt to make the inner workings of a function in a test more transparent.
Ah well, regardless… I fear I’m expecting the IDE to understand my thoughts and feelings… I guess our relationship is in choppy waters then? 😀
Your facts are opinions and we don’t like your opinions…
Why mankind is going to hell via internet:
A: This is a picture of a fish, it clearly have fins!
B: Giraffes don’t have fins!
A: It’s a picture of a fish!
B: What’s fishes got to do with anything?
A: They have fins.
B: Giraffes don’t.
A: We’re talking about fish.
B: Giraffes don’t have fins!
A: Right Giraffes don’t have fins.
B: See, I’m right…
A: Yes with regards to giraffes…
B: …fishes don’t have fins.
A: I give up.
B: I’m so cool! I’m so right! I’m so hot! I’m so bright! I’m so yeah oh yeah!
We’re implementing CI/CD in my current project… you know; Continuous Irritation / Continuous Disappointment…
Volatile AtomicIntegers… what could possibly go wrong?
“Did you kidnap this girl?”
“You didn’t even look at the picture!”
“I’m not saying no to the girl, I’m saying no to the whole concept of kidnapping!”
Paraphrased from “Magnum P.I. (2018)”
A: I don’t know if he’s insisting, pontificating, or stipulating. Maybe I should use all three with slashes in between?
B: Did he use words?
A: Sure, but…
B: Then he “says.”