Re:Cognition versus Programming: The Big Two – Why TDD?
by thibauts on Friday March 18, 2022 @05:41AM
(#30720175)
How does TDD force you to a better design ?
[ Parent
| on HN ]
Re:Cognition versus Programming: The Big Two – Why TDD?
by tremon on Friday March 18, 2022 @05:57AM
(#30720264)
By forcing you to think about your code's interface before thinking about its implementation. That means you get larger components that fit together based on the problem requirements, rather than components with interfaces that are only locally optimal.
You can see this same thing in action when watching functional programming live coding sessions: most live coding is bottom-up, but they still write the function signatures before writing any code.
Re:Cognition versus Programming: The Big Two – Why TDD?
by duped on Friday March 18, 2022 @12:31PM
(#30724318)
This strikes me as tautological. If you're using anything statically typed you have to write the function signature before it's body.
Re:Cognition versus Programming: The Big Two – Why TDD?
by tremon on Tuesday March 22, 2022 @10:56PM
(#30774344)
Static typing is not synonymous with manifest typing (always require an explicit type declaration). Many functional languages can infer the type of an expression from its definition, so explicit type signatures are optional. These languages are still statically typed though.