News for hackers. Stuff that matters.
Re:I was saved by Test Driven Development by LAC-Tech on Saturday February 11, 2023 @09:57PM (#34759212)
TDD can be great if you know exactly what you're building and what you must test for

But you should know this from your functional requirements, right?

(Slightly sarcastic comment, I know in a lot of places people just start coding without a plan, but I think TDD and functional requirements go together well).

Re:I was saved by Test Driven Development by devoutsalsa on Saturday February 11, 2023 @10:21PM (#34759370)
TDD is pretty useless when the requirements are shit. It just takes longer to realize you need better directions.
Re:I was saved by Test Driven Development by scott_w on Sunday February 12, 2023 @01:32AM (#34760455)
Or it tells you straight away that you have no idea what you’re supposed to be doing instead of spending 3 days building the wrong thing.
Re:I was saved by Test Driven Development by chrisandchris on Sunday February 12, 2023 @02:24AM (#34760699)
> ... start coding without a plan ...

Well, I don't do that. But i usually don't know all the names of my (internal) interfaces and models and properties right at the start. I might move things around and rename stuff along the way. And I think that's quite normal if you don't live in a world where the spec for a small task is multiple books thick.

Doesn't TDD get in the way with? Wouldn't I keep refactoring the tests all the time then?

Re:I was saved by Test Driven Development by missingdays on Sunday February 12, 2023 @05:40AM (#34761783)
When you rename an interface or a method, IDE renames them in tests too
Re:I was saved by Test Driven Development by dmitriid on Sunday February 12, 2023 @01:39PM (#34765480)
> But you should know this from your functional requirements, right?

Functional requirements describe observable behaviour. You can't write any meaningful tests for that behaviour until a lot of your code is written.

Yet somehow in all the discussions there's this unexplaned leap from "you have the requirements" -> "well you just write a unit test for your function first, and then code it".

My functional requirements come in the form of "Given publisher A in Country B and contract requirements C the service must return D for a subset of products E", for multiple combinations of A, B, C, D, and E. And where each of those may and will require lookups in external services and databases.