XML, java.io, and the Composite Pattern

Tony Obermeit posted a question to the AJUG-QLD mailing list asking for help with a problem reading XML snippets. So, I thought I’d help him out, and this is the answer I gave.

*Update*: As pointed out by Pepijn Schmitz, Sun already provided the same solution: java.io.SequenceInputStream

*Another update*: I raised an RFE with Sun for the vararg support Vote early, vote often!

Continue reading “XML, java.io, and the Composite Pattern”

Line counts are a silly way to compare languages

Des Traynor did a little post about how languages are not all the same, and Jeff Atwood jumped in with a C# version. Java came out looking really bad at 15 lines for a simple program, but frankly, the reason isn’t because of Java; it’s because of the coding styles used.

Continue reading “Line counts are a silly way to compare languages”

It’s a bird, it’s a plane… it’s a super call?

Martin Fowler wrote about the Call Super smell. This occurs when you are allowed to override a method in a parent class, but you must (as opposed to can) call the parent implementation in your method.

Continue reading “It’s a bird, it’s a plane… it’s a super call?”

Your brain on design pattens

Picked up my copy of Head First Design Patterns today (I’d ordered it in a couple of weeks ago). So far I’m loving it.

Continue reading “Your brain on design pattens”

Text files, test data, and the Jakarta Commons BeanUtils

Earlier, I wrote about testing only one thing at a time. A little one-liner I tossed out in that was using text files to load object graphs in your test cases. I thought I’d elaborate on that a bit more.

Continue reading “Text files, test data, and the Jakarta Commons BeanUtils”

Interfaces are interesting…

Cedric’s got an interesting post on obtaining extensibility via interfaces As usual, he makes a lot of very good points, and (again, as usual when I link to Cedric’s posts), there are a couple that I think could be elaborated on.
Continue reading “Interfaces are interesting…”

Testing patterns: don’t assert without cause

One thing that I see a lot of with JUnit tests are “cascade failures”. That is, one change causes lots of tests to break. This is often (not always) associated with tests that assert things they shouldn’t.

Continue reading “Testing patterns: don’t assert without cause”

I’m not a Hungarian Notation user

Joel Spolsky wrote an interesting article which had a brief history of Hungarian notation, amongst other things. Cedric Beust’s picked it up and made the claim that We are all Hungarian Notation users. I’m not buying it.
Continue reading “I’m not a Hungarian Notation user”