Clean Code Talks - Unit Testing

by Miško Hevery

Google Tech Talks October, 30 2008 ABSTRACT Clean Code Talks - Unit Testing Speaker: Misko Hevery

Video



Slides

Permalink | Links to this post |
The comments you read here belong only to the person who posted them. We do, however, reserve the right to remove off-topic comments.

10 comments:

André Faria said...

Good Job. Thanks!

Steven said...
This post has been removed by the author.
Steven said...

from this s/w test engineer... thanks, this give us plenty to think and talk about this week.

Are these tech talks auto-downloadable as a video podcast? if not, please pass along my suggestion that they be, they're great.

Dev Dimitrov said...

Hi,

being Test Enginner myslef and having the same problem to persuade and educate developers how to write testable code I find your presentation very nice.
Is it OK to use your slides?

Misko said...

Yes, the slides are posted for the world to use. Nothing would make me happier than influencing someone miles away.

tc said...

Good points! The tests are and should be easy. The whole point is to make the code testable in much the way you described.
About those static calls in Java: is it really not possible to use import statements as seams ? In Working effectively with legacy code it's suggested that linking against a fake library (C++) could be used to break such dependencies?

whateverdood said...

Nice work! I like the push for unit testing. I encourage you to push for test-driven development as well: having developers write the unit test before any code is written (when possible or practical). This has made my life *so* much simpler.

The car metaphor didn't work for me. I recommend you use an example that's easier for developers to relate to, like a typical web application stack (headless or with a UI).

Finally, and for what it's worth, I feel like I've had a lot of success when I develop all my classes as plain old Java Beans: no argument constructors and setters for everything that needs injecting. I avoid constructor args as I find that leads to the "Long Parameter List" code smell.

Again, nice work and I look forward to more!

Misko said...

@whateverdood

I prefer constructor injection over setter injection since compiler makes it clear to me in which order I need to instantiate things. It also allows me to make objects immutable.

If your constructor becomes too long, than yes it is code smell. Perhaps your class has too much responsibility? Perhaps you are mixing concerns? Don't blame the constructor, the dependencies are there, constructor just makes them painfully obvious.

Nirav said...

Excellent article!!!

Markos said...

Congrats Misko not only for the excellent subject you touched but for being a great speaker as well.

I also vote for the video podcast!

Please make it happen :)