this post was submitted on 20 Nov 2024
197 points (98.0% liked)

Programmer Humor

32524 readers
486 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] CanadaPlus@lemmy.sdf.org 1 points 22 hours ago* (last edited 22 hours ago) (4 children)

Can't you just add the wrapper to the test as well, if it's easy to do in the actual code?

[–] leisesprecher 1 points 20 hours ago (3 children)

If you have to ask "can't you just" the answer is almost always no.

[–] CanadaPlus@lemmy.sdf.org 1 points 18 hours ago (2 children)

Well, yeah, but I was kind of hoping you'd explain why.

[–] leisesprecher 1 points 17 hours ago (1 children)

Because you don't know what you'll need that wrapper beforehand, that's my entire point.

Unless you're only doing trivial changes, the chances are very high that you won't be able to design the class structure. Or, you end up essentially writing the code to be able to write the tests, which kind of defeats the purpose.

[–] CanadaPlus@lemmy.sdf.org 1 points 5 hours ago

That's kind of the whole philosophy, though. The tests are the main way you understand what you're doing, the working code is just an addition on top of that. Presumably, there's a way to do that without repeating yourself - although I'm not turning up much on a quick look.