понедельник, 6 июня 2011 г.

One XP Episode

We all know about TDD (Test Driven Development) and always try to apply this fashionable practice. Yesterday I read one fine article by Robert C. Martin http://objectmentor.com/resources/articles/xpepisode.htm. There he and his friend are implementing a program which calculates bowling game scores. And one thing impressed me a bit in this article.

Those guys started with common practice : draw object diagram. And the diagram seems logical and correct to me. Then they started implementing unit tests. They wrote tests one by one, but objects that they drew didn't appear in code. The final solution greatly differs from object diagram and contains only two classes. Despite this it looks simple and each class contains single responsibility.

The conclusion is not that object diagram are useless. But all diagrams should be proved by code, and you should not follow them strictly.

I really recommend this artcile for reading. It's a clean example of TDD, and dialogs are rather funny:-)

Комментариев нет:

Отправить комментарий