3 ms·
Often functional tests provide more bang for the buck than unit tests. Concentrating on functional tests allows to move faster. This is because most modern lan
by nine_k 5y ago
Often functional tests provide more bang for the buck than unit tests. Concentrating on functional tests allows to move faster.
This is because most modern languages allow you to write in structural style which is impossible to get wrong without noticing. If you have a loop, you know it repeats for its condition, and does not otherwise. If you have a `then` clause, you know it will only run when the `if` condition is true. If you have a function, you know it's only computed when called.
Compare it to pre-structural languages like Fortran IV or Basic, where you can freely jump into the middle of the loop, inside of what constitutes an undelimited `then` clause, or even into the middle of a function, without "calling" it properly.
This allows for potentially very clever code that saves every last byte and cycle. It also allows for totally mind-boggling, insidious bugs in code we'd now consider plain and foolproof to write.
- theodorethomas 5y ago> If you have a `then` clause, you know it will only run when the `if` condition is true. Can someone please tell the clang compiler folks?
- int_19h 5y agoYou can goto inside a conditional statement in pretty much any language I can think of that has goto. Loops are sometimes more restricted, but even then, neither C nor Pascal prohibit it (Algol-60 did, curiously), and many languages derived from them that retained goto do the same. Off the top of my head, the only mainstream language I can think of that specifically prohibits goto into inner blocks is C#.