Archive for the ‘Java’ Category.
June 18, 2008, 14:23
These days virtualisation seems to be all the rage. There are some benefits to it. It’s a way to increase the utilsation of your hardware just as pipelining increases the utilisation of the processor’s execution units. But as pipelining it comes at a price. You might increase the throughput, but the latency gets higher. Furthermore the response times become highly random, as they now depend on all the other users on the machine.
Especially in the context of development this poses a few risks. I have been working in environments with the build servers using virtual machines and shared database servers. This leads to variable build (and test) times – usually not shorter ones though!
It leads developers to ignore the time the code takes to execute, because there is no reliable feedback and all problems tends to be blamed to the environment or the database. In the worst case it leads to integration tests being ignored and abandoned, because they fail for timeouts, which result from dead slow code and unreliable system performance.
It is often said that code is to be read by humans. This is true. But it is also true and to be borne in mind, that code is run on machines. Virtualisation is clearly obscuring this fact.
Update: Dale was making the interesting point, that virtualisation is giving you a more controlled environment, because you can save your virtual machine and go back to defined points. This seems like a good thing and makes things easier in the first place. I think this is a double edged sword. In my experience you actually start incurring dependencies to that very environment. In my opinion software should be written in a way that it manages and contains it’s state. I have seen projects where you had to install database servers into the operating system (registry!). Then install stuff into the database server. Of course you also needed an application server. Everything needs to be configured. Then you run another obscure unscriptable utility to get your test data into the database. There is a huge temptation just doing these things manually and then save a snapshot of your vm. The actual problems like the use of side-effect-laden tools, resource-leakage during runtime, and poor setup-scripts remain untacled.
Writing a system that can’t work without a reboot is not a good practice. It should be a good citizen in the operating system or on the virtual machine it runs on.
May 28, 2007, 10:26
I just stumbled across the concept of ZipFileSet in ant. A closer examination confirmed my suspicion. A ZipFileSet can be two pretty different things. We should stop spoiling young programmers using such outflows from a sick minds that are not capable of a single straight thought. The mainstream of java software (including the JDK) is to the software community what Hegel was to philosophy – poison that prevents all sound thinking.
March 12, 2007, 10:57
Might just be the post hangover depression, but I woke up this morning with a great longing for meaning. Why do we use all kinds of tools that actually hide the meaning and intention of our programs. I’m talking about fit and fitnesse, which actually does great amount of damage to my respect for Ward Cunningham. I don’t want to hear excuses about the target audience and anything. Eventually you do want to have a full blown programming language for testing, not a macro assembler.
In the point of programming is to create and clarify meaning. Not to obscure it.
March 9, 2007, 17:42
I just discovered Anna Ternheim, a nice Swedish Singersongwriter. I am listening to here Album Separation Road and try to call an external process from groovy which after all uses the Java API to perform such tasks.
Given the slightly depressing nature of the music and the slight drizzle outside, I can’t go on ranting I’m just sitting here sobbing about the sorry state of the world and the hardship of having to deal with java.lang.Runtime and java.lang.Process.
January 11, 2007, 19:33
This week I started writing a few automated test cases for the jbehave eclipse plugin. I used Beck’s and Gamma’s “Contributing to Eclipse” as a starting point. They provide a simple test fixture that allows you to create java projects, packages and classes. I created a simple project with a trivial class and an even more trivial jbehave test case and launched the test case using the jbehave plugin. Then I wanted to verify the output that is been written to the console and my synchronsation problems started.
So I came up with two issues:
- Some things like the autobuild run in background jobs, so that you have got to wait for those jobs to finish before verifying. For the autobuild there is a simple solution:
Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- The second issue was around the update of the console, which happens in the UI thread. Unfortunatly the testcase runs in the UI thread as well, so a
Thread.sleep() won’t help. The key is calling Display’s readAndDispatch() and sleep() methods to get the event queue processed while waiting. It’s still a bit awkward to work with delays, but I couldn’t come up with a better way.
January 8, 2007, 14:03
Now that jdk 1.6 is finally out, I think it´s a good time to have a closer look at jdk 1.5. Of course I read that they included Doug Lea´s concurrency utils, but I never got around actually browsing the documentation. I should have done this earlier. It´s good loads of useful abstractions, like blocking queues and semaphores.
October 9, 2006, 20:36
Today I stumbled across a bug in the java file handling on windows. On Windows you can have multiple Strings denoting the same file. Like “TEST.txt” and “test.txt”. If you create two file Objects with different names accessing the same file and compare the objects using equals you will get false.
You should read the answer. There’s a workaround, but it kills all the nice things about OO. So now I can’t do a List.contains(myFile), because the List implementation uses the equals method. But as in so many cases they don’t get it.
July 10, 2006, 23:47
In my Opinion the only valid argument for static typing is better tool support. While refactoring capabilites of state-of-the-art Java IDEs are pretty
good, there are other possibilities to assist the developer.
One such way is shown by Prospector a tool to mine APIs for jungloids. That is calls or call chains that return an object of a desired type for an object of a given type. It is a kind of query engine over your (or better someone else’s) code base. If you start with an IFile object in eclipse you might want to get the containing IProject. Prospector will then propose call chains to get the desired return type.
The approach is detailed in a
paper
and there are also some
slides
available.
June 28, 2006, 11:58
Eitan Suez has just open-sourced his JMatter framework which is an implementation of the Naked Object Paradigm explained in a Book
by Pawson and Matthews.
This Programming Model seems to be very expressive. As far as I know JMatter is the first professional implementation, that provides persistency in a database as well as a rather nice UI and a useful set of base classes.
In the documentation there’s a chapter on the desktop, which describes the author’s vision of a desktop of objects. I think the consquences of applications beeing deployed as a set of classes into an objectframework are quite amazing. It reminded me of Dan Ingalls Byte article on the Design Principles Behind Smalltalk, where he argues that there shouldn’t be an operating system, which goes beyond the object runtime. He states: “An operating system is a collection of things that don’t fit into a language. There shouldn’t be one.”
Another interesting implication is the fact that JMatter provides a dramatic productivity boost which will lead to severe problems for those teams building everything from scratch. On the other hand new applications will become feasible due to falling prices.
There’s a lucid post by John Reynold’s.
I think this thing goes well beyond the scope of ruby on rails. Though it’s somewhat more complex due to the more static nature of the java language.
March 15, 2006, 20:33
Lukily I found this article, which explains how to change the behaviour.