Why extends is not evil §
extends keyword is not evil. It has never been evil; it will never be evil. What is evil is
concrete behaviour inheritance, which is also known as 'implementation inheritance' or just 'concrete
inheritance'. Holub sets out to prove this, but inadvertantly implies a correlation between the Java extends
keyword and implementation inheritance. The fact is, this correlation does not exist. This assertion would be a
mere issue of semantics and would probably not warrant this article, if it weren't for a nasty, underlying issue.
more...
MD5 and Speed Cameras §
There has been some recent controversy regarding speed camera photos and the use of the term MD5 seems to have been taken well out of context as a result. MD5 is what is known as a hash algorithm or one way function. It is sometimes erroneously referred to as an encryption algorithm or cipher - this is simply false. Some other absurd claims are that "MD5 is susceptible to viruses" or that "MD5 ensures cryptographic security". These statements are to be ignored as nothing more than typical media hype.
Speed camera photographs are typically associated with an MD5 hash in a flawed attempt to verify integrity of the photograph. That is to say, in transit from the camera to your letter box, integrity of the document can be (but isn't) guaranteed, since any modifications of the document would mean that a different MD5 hash is generated upon verification. First and foremost, MD5 is a weak hash algorithm, and does not even ensure document integrity in a practical sense, since it can be demonstrated to be broken. Second, any hash algorithm is mathematically proven to be breakable, which may be considered insufficient by a court.
Finally, and perhaps most amusingly, the photograph and associated hash are not digitally signed. I'm sure that anyone who has any knowledge of electronic security would find this oversight somewhat astonishing, but it must be highlighted that we are dealing with the traffic authorities in the land down under, where surprises are really just expectations. Digital signing is a way of ensuring that the entire document and hash were not modified during transit assuming that the cryptographic key is kept safe. more...
How to resolve a java.lang.NullPointerException §
Turning on the Ball and Appealing for Let §
JTiger Unit Testing Framework for J2SE 1.5 §
JTiger Unit Testing Framework for Java 2 Standard Edition 1.5 is an Open Source solution that provides a robust and feature-rich abstraction to develop and execute unit test cases. Test case metadata and unit test documentation is expressed through annotations. Assertions, from the basic to the complex, can be made using the JTiger assertions package rather than having to write the logic for those assertions yourself.
JTiger includes rich assertion abilities, ranging from 'assert true' to 'assert adherence to the Object equals method contract on this type', an Apache Ant task, and reporting capabilities in HTML, XML or plain text format. For an example JTiger HTML report, see the Self Test Report. JTiger provides reassurance of being a robust unit test framework by providing its own self test fixtures that assert 100% class and 100% method coverage over the JTiger source code. more...
Assertion Extensions for JUnit on IBM alphaWorks §
Assertion Extensions for JUnit on IBM developerWorks §
Assertion Extensions for JUnit (JUnitX), an extensions package for the JUnit framework, is available for download from alphaWorks (see Resources). It provides the required implementation of many common complex assertions. Rather than write a complex JUnit test case for an assertion, you can call a JUnitX method to make that assertion from the same context -- with no additional setup. JUnitX also asserts that it functions as documented by including its own JUnit self-test suite. This reassures you that JUnitX is making its assertion according to the JUnitX documentation; if a unit test fails, you know it's the software code unit that has failed, not the JUnitX test implementation asserting a false failure.
A typical scenario in which JUnitX would be beneficial involves the contracts set out by the java.lang.Object class' equals(Object) and hashCode() methods. You're often required to adhere to these contracts in the classes you develop. Using JUnit to make the assertion that you've adhered to them would require you to develop complex unit-test cases, which are prone to error. In contrast, making the assertions using JUnitX is as simple as creating a factory implementation that returns instances of your class and calling the JUnitX assertEqualsContract and assertHashCodeContract methods from your unit-test case. more...
Java Frequently Asked Questions §
Java Trivia §
Type-safe Scala Sequence Comprehensions §
A Fling with Lazy Evaluation §
Idempotence versus Referential Transparency §
The Power of Type-classes with Scala implicit defs §
A core part of Haskell's type system is that of type-classes. If you have never used type-classes, then there is a pretty good description in Yet Another Haskell Tutorial (YAHT). Haskell type-classes have been likened to Java/C# interfaces or Scala traits, but there are some significant differences.
With Scala's implicit definitions (defs), it is possible to come pretty close to emulating Haskell's type-classes. This ability can make writing certain constructs very simple and also, extremely flexible.
more...Refunctoring §
ScalaCheck (committer) §