693
Sounds great in theory (programming.dev)
you are viewing a single comment's thread
view the rest of the comments
[-] lobut@lemmy.ca 41 points 1 year ago

I like TDD in theory and I spent so many years trying to get it perfect. I remember going to a conference where someone was teaching TDD while writing tic tac toe. Unsurprisingly, he didn't finish in time.

The thing that I hate is people conflating TDD with testing or unit testing. They're vastly different things. Also, I hate mocks. I spent so long learning all the test doubles to pass interviews: what's the difference between a spy, fake, stub, mock, etc. Also doing it with dependency injection and all that. I much prefer having an in-memory database than mock what a database does. Last company I worked at, I saw people write tests for what would happen if the API returned a 404 and they wrote code that would handle it and all that. In practice, our HTTP library would throw an exception not return with a statusCode of 404. Kinda funny.

You obviously can't always get replacements for things and you'll need to mock and I get that. I just prefer to not use them if I can.

Also, TDD advocates love saying, you're just not doing it well or you just don't know enough.

I get it, you love TDD and it works for you and more power to you.

I definitely believe in testing and having resilient tests that will minimize changes upon refactoring, but TDD doesn't work for me for most of the work I do. It works for some and I love it when it does, but yeah .... sorry random long ramble.

[-] ChickenLadyLovesLife@lemmy.world 14 points 1 year ago

I had a coworker who was big into TDD. He was using it on a disaster project that was way over budget and long overdue. I was sitting in on a meeting between him and the client when he tried to defend the project's status by saying "you don't understand - we've written six times as much test code as actual code!" The client almost punched him.

IMO it doesn't matter what methodology you use if a) you don't have the ability to understand what the client actually needs, and 2) you can't code your way out of a paper bag (or to put it more technically, if you over-architect your solution and then can't solve all the self-inflicted problems you run into).

[-] fiah@discuss.tchncs.de 5 points 1 year ago

a) you don’t have the ability to understand what the client actually needs

the client doesn't understand either. This I have had to learn to accept and not blame the client for, it's OK and we'll figure it out together

b) if you over-architect your solution

we can't figure out what we actually need by overarchitecting something to death. If and when you find you've coded yourself into a corner because you didn't architect well enough 6 months ago, then congratulations it seems like what you're doing is good because you've made enough progress to actually need a better architecture

obviously I'm oversimplifying and people more experienced than me understand better how to walk the tightrope between unmaintainable spaghetti and an overengineered mess, but me, I try to keep shit as simple as possible because you never know

load more comments (1 replies)
load more comments (6 replies)
this post was submitted on 05 Aug 2023
693 points (97.9% liked)

Programmer Humor

32291 readers
31 users here now

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

Rules:

founded 5 years ago
MODERATORS