posts - 7,  comments - 11,  trackbacks - 0

source: javauc   archives

I’ll start with a confession: I’m a unit testing addict. In fact, I
just can’t write enough unit tests. If I’m developing for long stretches
of time without having written corresponding unit tests, I get
the jitters. Unit tests give me the confidence that my code works and
that I can change it, at a moment’s notice, without the fear of it
breaking.

Furthermore, as an addict, I tend to write a plethora of test cases. My high,
however, isn’t from writing the test cases; it’s in seeing
their results. Consequently, if I can write the tests in a rapid manner,
I can view their results quicker. That way I feel better. Quicker.

No more Java purism!

Before I launch into the practical aspects of unit testing with Groovy, I think it’s important to talk about the more general issue of its place in your development toolbox. The fact is, Groovy isn’t the only scripting language that runs on the Java Runtime Environment (JRE), it’s just the only one that has been proposed as a standard language for the Java platform. As some of you will have learned from the alt.lang.jreseries (see Resources), there are myriad options when it comes to scripting for the Java platform, most of them presenting highly agile environments for rapid application development.

Despite this abundance of choices, many developers choose to stick with their favorite and most-familiar paradigm: the Java language. While Java programming is a fine choice for most situations, there is one very important shortcoming to wearing Java-only blinders. As a wise person once put it: If the only tool you have is a hammer, you tend to see every problem as a nail. I think there’s a lot of truth to this saying that is applicable to software development.

Just as I hope to convince you with this series that the Java
language is not and should not be your only choice for developing
applications, it’s also true that scripting languages make sense in some
scenarios and not in others. What separates the professional from the
tyro is knowing when to apply the power of scripting and
when to eschew it.

posted on 2010-05-14 21:55 sonicluo3 阅读(132) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: