Unit tests cause pain. Unit tests, by themselves, do not solve problems, do not make users happy, do not make maintainers happy, do not make a better product, and do not improve design. Unit tests make certain things hurt; nothing more and nothing less. But pain can indicate something is wrong and can lead you to do something else.
The first assumption behind unit tests (and bodily pain) is that if something hurts we'll pay attention and do something else instead. The second assumption is that what we do as an alternative will not only hurt less but make things better. For example, since unit tests make singletons and hard coded dependancies so painful, we can rely on dependency injection techniques and the single responsibility principal. This should cause code that is easier to test and understand and that responds to rapidly changing requirements.
So unit tests are one way to show what hurts and needs attention and avoid blundering into bad and potentially project-killing designs. The problem is when we can't or don't change how things are done. If we must rely on singletons, the filesystem, database, complex api calls, undefined behavior, or slow techniques then writing and running the unit tests will hurt. In these cases the costs of writing and maintaing unit tests can outweigh the benefits of running those tests.
Compile and Execute Java Online - Try and experience the best cloud computing where you can edit, compile, ... Compile Preview | Execute | Share Code.
Thursday, December 23, 2010
Subscribe to:
Post Comments (Atom)
Popular Posts
-
This tutorial will be written in Java since I'm familiar with it and it's a decent enough language, has many tools and libraries, a ...
-
Announcing hspec - BDD for Haskell I've long been interested in Behavior Driven Design and it's something that is strangely missing ...
-
Pro form comment for blogger [FD's BlOg] - Chúng ta có lẽ khá quen với form comment của blogger , với tính năng hiển thị thời gian comm...
-
Related Posts Widget for Blogger / Blogspot (using CSS + Java) [FD's BlOg] - Tiện ích cho phép hiển thị các bài viết liên quan (có cùng...
-
[FD's BlOg] - Đây là một trong những thủ thuật cơ bản để trang trí cho blog của bạn. Ví dụ như chèn banner flash cho header hoặc cho fo...
-
Widget Recent Posts Using jQuery [FD's BlOg] - Sau một lần lục lọi, tìm kiếm trên mạng được một hiệu ứng từ jQuery , mình đã quyết định...
-
Add emoticons to comment form and Show/Hide tab emoticon [FD's BlOg] - Thủ thuật này có lẽ khá quen thuộc với nhiều người, tuy nhiên một...
-
Đáp ứng yêu cầu của giáo xứ phú giáo , trong nhưng ngày đầu năm này có lẽ anh Dũng cũng bận cho việc ... Va lung tung .. Không có thời gian...
-
Khi khai báo các tham số hình thức bên trong hàm. Nếu các tham số đó được gán giá trị mặc định, thì khi gọi hàm, chúng ta sẽ có một vài các...
-
www.fandung.com [FD's BlOg] - Sau gần 1 năm khởi tạo, và gần nửa năm chính thức hoạt động với nội dung chính là viết về thủ thuật cho b...
No comments:
Post a Comment