Coding Convention: Put identifying parameters first

When declaring a FactoryMethod put identifying parameters first.

Continue reading “Coding Convention: Put identifying parameters first”

Another good use for named queries

A while back, I blogged about how Hibernate named queries rock I found another reason why they rock today: it lets you hide what your persistent properties are called.

Continue reading “Another good use for named queries”

Differences cause problems

This is obvious, but differences between environments cause problems. You can expect bugs to cluster around them.
Continue reading “Differences cause problems”

Would you blame the hammer because the nail is blunt?

Cedric’s having another go at JUnit Again he misses the point: extensions to JUnit are not JUnit itself, and JUnit can’t be blamed for people extending it to the wrong way.

Continue reading “Would you blame the hammer because the nail is blunt?”

How do I find what tests use this method?

As I said earlier, I’ve been reading Michael Feathers _Working Effectively With Legacy Code_ recently (I’m taking my time with it; it’s a good book). He spends a lot of time talking about techniques to get code under test. However, he spends very little talking about finding out if (and to what extent) a method is under test in the first place. So here’s how I do it:

Continue reading “How do I find what tests use this method?”

Things that bug me about IntelliJ

For the last few years, I’ve been saying that IntelliJ is the best Java IDE on the market, but that Eclipse is pretty close. I’ve also been using Eclipse that whole time (having used IntelliJ before that), because my then-employer didn’t like to shell out money if they didn’t have to.

Well, I’m at a different company, and everyone here uses IntelliJ (bought-and-paid -for, even!). And I’m finding that IntelliJ is as good as I remember, but there are a lot of things that are bugging me with it. Enough that I wonder if it’s worth using.
Continue reading “Things that bug me about IntelliJ”

Beware the mechanical coder, my son…

Stumbled upon this beauty today (minor changes to protect the guilty)

Continue reading “Beware the mechanical coder, my son…”

Long != meaningful

Meaningful names for variables, methods, and classes go a long way to making uncommented code possible. However, meaning is not conveyed simply by length.

Continue reading “Long != meaningful”

Don’t propagate exceptions in test fixtures

Been seeing this pattern a lot today. I’m working with integration tests, which have a lot of test fixtures around to do common tasks (such as inserting data into the database). These test fixtures propagate exceptions. In many cases, they simply declare that they throw java.lang.Exception. Ouch.

Continue reading “Don’t propagate exceptions in test fixtures”

Programming by difference

I’m currently working my way through Michael Feathers Working Effectively With Legacy Code. Damn good book, BTW. Anyway, this was this section on “programming by difference” that got my thinking while reading it.

Continue reading “Programming by difference”