I just bought from Amazon. I am very serious in understanding TDD, so the rest assured that this is a real question.
But I think I'm constantly on the verge of finding justification to give it.
I am going to play devil's lawyer here and I hope someone can prove me wrong and help me to be more confident in my properties and kill the alleged benefits of TDD I am trying to I think I'm missing something, but I do not know.
1 TDD to reduce the bug
It is the unit test design tool and not to catch the bugs:
In my experience, unit tests are not effective methods, TDD software components ("units") are a strong way to design so that their behavior can be specified through unit tests.
...
All this!
Makes sense. The edge of the case will still always be there, and you will find only the surface worms - that as soon as you run your app the same, as soon as you find it. After making a good part of your software, you still need to do a proper integration test.
Enough work, reducing the bug is not the only thing that is to help with TDD.
2. TDD as a design paradigm
It is probably bigger TDD is a design paradigm that helps you (or compels you) to make your code even more.)
But composibility is a multiplied quality; Functional programming style, for example, also integrates the code quite a lot, of course, it is difficult to write fully on a large scale application in functional style, but there are some compromise patterns that you can follow to maintain composability.
If you start with a high modular functional design, and then carefully add state and IO to your code, then you will end up with the same pattern that encourages TDD. For example, in order to execute business logic on the database, the IO code performs different functions that access the database "monadic" and pass it as a logic of the task responsible for commercial logic. To do this, it will be a functional way.
Of course, this is a small CD, so instead, we can put a class of database IO code in one square and give it to the object in which related business logic is the same thing , Which is an adaptation of the functional way of working, and it is referred to as a repository pattern.
I know that this is probably going to scream me a lot, but many times, I can not help, but TDD seems to be made for some bad habits that can encourage OOP - which can be avoided by a little inspiration from the functional style.
3. TDD in the form of a document
TDD is asked to work as a documentation, but it only serves as a documentary for peers; The consumer still requires text documentation.
Of course, a TDD method may work as the basis of the sample code, but in the investigation, there are usually somewhat socks which should not be in the sample code, and generally considered very good. So that they can be evaluated for equality against the candidate's results.
A good unit test will verify the exact behavior in the signature of its method, which is being verified, and the exam will not be further verified and will not be less that behavior
So, I would say, your document would be better to polish your document. OK, why not just make the document fully in advance, and do it with documentation-inspired designs?
4. TDD for regression testing
It is mentioned in the post later that TDD is not very useful for detecting regression. This is definitely because non-obvious cases are those which are always disturbed by changing some code.
It is also worth noting that the chances are good Most of your code will remain the same for a very long time. So, does it not make much sense to write unit tests when changing the code, keeping the old code and its results being compared with the new function?
In addition to this, it puts you in the user's mind, you think "what the user needs my method to do this" or whatever, "I hope my method is Has acquired what he should have done ". In this way, it can also help in reducing the bug.
Comments
Post a Comment