673
Sounds great in theory (programming.dev)
submitted 11 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 11 points 10 months ago

How would you know what you're going to need or what it can do before you code it ?

[-] [email protected] 7 points 10 months ago* (last edited 10 months ago)

The Test part of TDD isn’t meant to encompass your whole need before developing the application. It’s function-by function based. It also forces you to not have giant functions. Let’s say you’re making a compiler. First you need to parse text. Idk what language structure we are doing yet but first we need to tokenize our steam. You write a test that inputs hello world into your tokenizer then expects two tokens back. You start implementing your tokenizer. Repeat for parser. Then you realize you need to tokenize numbers too. So you go back and make a token test for numbers.

So you don’t need to make all the tests ahead of time. You just expand at the smallest test possible.

[-] [email protected] 4 points 10 months ago

It also forces you to not have giant functions.

No, being unable to read giant functions is what forces me not to have giant functions.

[-] [email protected] 4 points 10 months ago

My friend, let me tell you a story during my studies when I had to help someone find a bug in their 1383-line long main() in C… on the other hand I think Ill spare you from the gruesome details, but it took me 30 hours.

[-] [email protected] 2 points 10 months ago

Case in point, actually. Whenever I'm forced to write a giant function, I always get nervous because it could be crawling with bugs that I have little hope of spotting.

load more comments (5 replies)
this post was submitted on 05 Aug 2023
673 points (97.9% liked)

Programmer Humor

31214 readers
1206 users here now

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

Rules:

founded 4 years ago
MODERATORS