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
-
Announcing hspec - BDD for Haskell I've long been interested in Behavior Driven Design and it's something that is strangely missing ...
-
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 ...
-
More vague notes about rogulikes; this time about monster difficulty or Power Curve . In I Rule, You Rule, We All Rule Old-School Hyrule th...
-
[FD's BlOg] - Adnet là một hệ thống quảng cáo trực tuyến trên nền tảng mạng Internet mà công cụ chính là các Website & Blog. Adnet ...
-
Bước 1 . Sử dụng ảnh rocket.psd để import vào trong dự án Flash của bạn. Xây dựng 2 layer để chứa tên lửa và phần nhiên liệu bị đốt cháy. Bư...
-
Dijkstra's algorithm is a useful algorithm for roguelike developers to know. It basically calculates the distance from a starting point...
-
I'm rarely a fan of posts that are in list form (e.g. "Top 10 tips for writing top 10 lists") but I seem to be in "list m...
-
[FD's BlOg] - Khi mà các comment ở một bài viết nào đó trong blog của bạn trở nên quá nhiều, nó sẽ làm cho blog của bạn dài lê thê, là ...
-
[FD's BlOg] - Hôm nay mình lại quay về với menu cho blog. Và bài này mình xin giới thiệu 9 kiểu menuside cực kì bắt mắt. Xem demo trực ...
-
"Make a game — Take it to Market — Earn $1" I'm in. I just got haxe setup on my computer and I'm ready to start working on...
No comments:
Post a Comment