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...
-
Widebar for three columns template [FD's BlOg] - Widebar thực ra chỉ là tên gọi, đơn giản là 1 sidebar lớn hơn bình thường, sở dĩ nói ...
-
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...
-
Create TabNews with jQuery [FD's BlOg] - Một lần có 1 bạn nhờ mình thay đổi template cho blog, và mình đã tìm thấy một thủ thuật khá đẹp...
-
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...
-
[FD's BlOg] - Với thủ thuật nhỏ này bạn có thể tạo một tab nhỏ để hiển thị các thông tin của bản thân. Hình minh họa: Để thực hiện, bạn ...
-
Đá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...
No comments:
Post a Comment