Java Reference
In-Depth Information
is appropriate may strike some as a bit fascistic. And the user interface—well, let's just say
this is the sort of interface that could only have been produced by programmers on an open
source project. Everything can be configured and changed, which is the good news. And most
everything needs to be configured and changed, which is the bad news.
Still, these are great tools, and their rapid evolution and improvement over time is a testament
to the open source development model they have adopted. If you still want to write your code
with an editor, then there is little I can do to convince you that life could be better otherwise.
But if you spend time working with code that has been written by someone else, you owe it to
yourself to become familiar with at least one of these IDEs. Even if you spend all of your time
with code that you write, it is probably worth your time to try one of the IDEs on a project.
You might be surprised to find that they are useful.
JUnit
Writing tests for your code is the software equivalent of flossing. Everyone knows that they
should do it, everyone knows what bad things will happen if they don't do it, and yet very
few people do it. After all, management is always after you to produce new functionality, and
writing tests slows you down from doing that. And a lot of the code you have written is so
simple that nothing could go wrong, so writing tests just wastes precious time. And writing
tests is boring, and not much fun, and sometimes is really hard. And the best thing that can
happen when you write a test is that you find out your code was right to begin with. Most of
the time it just shows that there are problems, which you have to go back and fix before you
can work on the exciting new stuff.
It is when a junior engineer gets to this point that I roll up a newspaper and start swatting him
with it. [ 46 ] We all know that unless code is tested, it has bugs. [ 47 ] Testing may be hard, but it
need not be boring, and it is absolutely necessary. Remember that what Java is good for is the
building of large-scale, long-lived, reliable systems. Such systems need lots and lots of tests,
both to ensure that they are right in the first place and to keep them right as they evolve over
time.
Fortunately, there are good tools to help you build tests for your Java code. These testing
frameworks give you a way to build and run your tests, and will even generate some of the
boilerplate code for you. My current favorite is JUnit. [ 48 ] It is free, open source, and simple,
all of which are features that I find appealing. Even better, it is integrated into most of the
IDEs, so there is already support in the environment for writing tests. It may not make writing
 
 
Search WWH ::




Custom Search