Posts Tagged ‘java’
I’ve recently been using EasyMock to create mock objects to pass in my JUnit tests, and I often find that I often mock up objects for private members which are auto-wired or injected by the platform, and in some cases are unrelated to the code I unit testing. Usually it is too expensive to run a full environment of middleware for testing, and it is also necessary to test the exception handling code which will most likely not be called unless it is specifically mocked.
So I wrote the following function to insert a mock object into a private member:
Have fun with it.
I was reading ESB in Action* while preparing to implement Apache ServiceMix and was interested to read about JiBX, which is a tool for binding XML data to POJOs (Plain Old Java Objects). What it immediately reminded me of was Hibernate, which does ORM (Object Relational Mapping), and the possibilities there were for integration. This brought the thought to my head that together they could be used to create a WebService which could expose features of the database easily.
A search brought me the view of a Hibernate developer who pointed out in 2004 that there was a “impedance mismatches here: object/relational and object/hierarchical.” And I believe that would be true if it wasn’t for the fact that much of the data in relational databases is mostly hierarchical in nature. Even the core pattern of the embedded indexing in Hibernate Search assumes that the data being indexed is a nested hierarchy or inclusion hierarchy. I won’t get started on the issues that Hibernate Search has due to this impedance mismatch, needless to say there are a number.
The JiXB documentation is quite clear, and makes it easy to implement.
I recently made myself a map of terms I had found related to J2EE. Most of these items aren’t completely unknown to me, and this list is far from complete.
– Denotes the definition of the anagram abbreviation
Image source: Java Logo – Wikimedia; J2EE Mind Map – me
John R. Rymer wrote a piece on Forrester about the The Future Of Java, it’s pretty complete with the exception of the greatest weakness being called the greatest strength.
“Fewer young developers will learn Java first. One of Java’s greatest strengths has been the number of young developers who learn it as a first language.”
—John R. Rymer
It may have been an advantage for the adoption of Java as a programming language, but it is certainly not a strength of a programming language that students learn it as a first language.
Personally I don’t see it as an advantage for students to learn Java as a first language, it means that every language learned afterwards is seen from a perspective of a language which doesn’t teach the student simple rules like type safety or writing portable code. A programming language as teaching tool should allow a student to make all the mistakes which can be made, as a student learns more of their failures than from their successes. It should allow different programming modes, Object Oriented, Linear and a mixture.
I’ll stop here before I start talking about round pegs and square holes. 😉
Image source: Hillary Hartley