Should I Use TDD?

前端 未结 15 1899
孤街浪徒
孤街浪徒 2020-12-12 19:34

I\'m the only developer in my (very small) company and I\'m about to start on a medium sized ASP.NET web application for said company.

I\'m trying to figure out if

15条回答
  •  青春惊慌失措
    2020-12-12 19:53

    I recently started to use TDD as well on all new code. Yes at first it looked like it was just a waste of time since all my logic was too tightly coupled with the Gui, so I couldn't write any unit tests that really could garantee that my code does what it should be doing.
    But after a while I realized that writing unit tests was such a pain because the code was written badly. I started to refactor my code in such a way so I could write unit tests for it that mattered. I started to make my methods shorter, made more use of interfaces and tried to separate the logic as much as possible from the Gui.
    I think the purpose of using unit tests beside testing and validating your code is to just make you an overall better programmer. So anyhow it's worth the effort learning it.

提交回复
热议问题