Saturday, October 31, 2009

Enough is enough

This year would be the 5th winter in a row in Sweden for Anna and me. Clearly not an attractive thought. For this reason we decided to follow the sun.

I don't want to spill the beans as yet about where the journey will take us, but I am hoping to be able to spice this blog up with some exclusive travel reports.

As a little teaser I am posting a popular landmark of the city we will be traveling to:


Does anyone know which city this is? Or maybe you've been there and can give us some travel tips?

--Hardy

Tuesday, October 27, 2009

OS X 10.6 Snow Leopard

I finally managed to update my Mac OS X 10.5 to the latest version - Snow Leopard. There is a lot of information about this on the web so I don't want to go into too much detail.

The basic upgrade via the CD was simple. No problems there. Except of the gained disk space and a slightly changed behavior of the dock items when you keep the mouse button pressed I actually haven't noticed anything outstanding yet.

Unfortunately, there were a few things which needed additional care after the upgrade:
  • Java 5 is gone. Well, there is still a 1.5 symbolic link in /System/Library/Frameworks/JavaVM.framework/Versions, but it just point to the 1.6 JDK. WTF? As Java developer I needed my JDK 5 back. One way to solve this is described here.
  • Next up was MacPorts. Given my addiction to command line tools I actually use a broad range of Unix tools on my Mac which I get via MacPorts. After the upgrade you have to completely replace your MacPorts installation :( The good news is that it is not too hard - see here. MacPorts needs Xcode installed. Unfortunately, the upgrade removes the old version without replacing it with the new. Instead you have to insert the Snow Leopard CD again and install Xcode from the optional package directory on the CD. While on it you should also reinstall Rosetta (also on the CD).
  • The reason for reinstalling Rosetta is that without it TextMate stopped working.
Ok, now I almost had everything back I used to have. One more problem was MySQL. I had an instance which I installed via a Mac installer package downloaded from the MySQL homepage. Unfortunately, this instance stopped working after the upgrade and I decided to use MacPorts to install a new version - mysql5-macports.

Last, but not least, there are at the moment two programs I am aware of which don't work anymore and where I don't have a upgrade solution. Luckily both tools are not so important to me:
  • JarInspector 
  • Shimo (there might be an upgrade for them, but in Snow Leopard the network configuration options have changed so that I can use now the build in network manager)
Enjoy!
--Hardy

Wednesday, October 14, 2009

Give my scripting support back, please ...

Just recently I struggled again with Maven.Don't get me wrong, it's a great build tool, but it is sometimes frustrating that due to the lack of scripting capabilities you are limited to whatever use-cases the developers envisioned. Often things feel a little like:"My way or the highway!"

Here is my current problem. Say you are developing a library and you have an optional dependency to another library. Depending on whether this optional library is available at runtime your own library behaves differently. For example a factory class could check whether a the optional dependency is available and if so create a different type of service class.

As a developer of this library I would like to have two test sets. One where the tests are run with the optional dependency on the classpath and one without. It is already possible two configure two executions of the surefire plugin, but I cannot remove an optional dependency. Admittedly, you can solve this use case using profiles, but the POM becomes very long and the dependency management is confusing in this case :(

I created a Jira issue - SUREFIRE-576 - for it. Let's see what's going to happen. However, what's the best solution for now? Try to patch surefire yourself and host the patched version until the patch (hopefully) gets integrated and released. Seems very tedious. If I just would have the possibility to modify the test classpath ;-)

I wonder whether this use-case would be easier to handle in the latest hot build tool - Gradle.

enjoy!

--hardy

Wednesday, October 07, 2009

3rd day of JAOO and wrap up

Day started of with a keynote by Cameron Purdy. Basically the talk was about why Java has overtaken C++ as the main programming language and a bit of speculation about the future. Maybe Scala is the next language?

Linda Rising held a talk that was not directly related to IT and certainly could be applied to any discipline. Starting out in the industrial revolution and the introduction of clocks, schedules and plans to mankind she suggested that this may not be the ideal way of life. Until rather recently in the history of men it has been possible to sleep until waken. The physical clock of the body was the only one. Then factories appeared and with them a need to make sure that people worked a certain amount of time every day. We still live under this preposition whether or not it is a valid one. Around the same time as the industrial revolution caffeine came around. So in order to be alert enough to work the exact times that factories required we started to (ab)use this substance. Apparently we miss good research on what caffeine does to our body. We know that it inhibits our feeling of being tired. This could mean nothing or be a really bad thing. Linda showed pictures from an experiment on spiders and their ability to make webs when influenced by different substances. Spiders high on marijuana actually performed better than the ones with caffeine.... Linda went on to talk about sleep patterns and the well-known 90 minute cycle. We probably need 5 such cycles a night and it is a good thing to wake up when a cycle just ended. When woken by the alarm bell the need for caffeine is naturally higher than woken naturally and thus we end up in a vicious circle. This can be extended to the daytime where cycles naturally also is important. 90 minutes work chunks might be a good idea and then breaking and perhaps even napping. Breaks with physical activity is preferable and what we naturally are disposed for. Several studies shows that taking a nap during the day increases our ability to learn. She referenced the pomodoro technique as one way of reaching this way of working. (I wrote about Staffan Nötebergs pomodoro tutorial at jfokus this year. Apparently there is a book coming out very soon.) All these things affects our productivity in the most profound way.

The talk "Organizational Patterns and Scrum: Fine-tuning your Agile Implementation" held by the couple Gertrud Bjørnvig & Jim O. Coplien aka Cope started out with a little play involving people in the audience where proximity between different roles in a team illustrated different patterns. Cope then went on to talk about organizational patterns in relation to Scrum. I didn't know that the first incarnation of scrum actually was a pattern language. He related this to the pattern language he and some others have evolved and published in a nice book. This is indeed interesting stuff in times of naive simplicity and was a reminder to bring forth that book again. Surely there are things to learn and apply in my current context. Cope also mentioned that there will be a ScrumPLoP conference in Sweden next year.

Mary Poppendieck talked about "Deliberate Practice in Software Development" - a talk about expertise. She started out with looking at some other disciplines and related research that suggests that practicing makes an expert. Apparently some 10 years are needed to become an expert in a field given a continuos practicing during this time. There are 4 elements of deliberate practice: mentor, challenge, feedback and dedication. Mary then applied this to software development and noted that open source projects often offers an environment that fosters learning.

Lastly (cause I had a flight to catch, I missed the very last session) I listened to Richard Durnall from Thoughtworks. The first name today that I didn't recognize and a really interesting speaker. (Also nice slides.) The main thing Richard pointed out to me was that continuos and incremental improvement isn't always the right thing to do (a bit contrary to what Cope said earlier on). He illustrated this with a graph with Performance on the y axis and the choice we make to set up our organization on the x axis. If there is only one peak on this curve then incremental improvement will work perfectly. You change a little, measure performance to get the feedback if you are moving in the correct direction. If not - move in another direction. But consider the possibility that there are several peaks in productivity. Then incremental improvement may lead us to a lower peak although there are better performance peaks around. To avoid this problem consider a more radical change where the organization is thoroughly changed. Richard went on and compared 2 types of organizations, the standard command chain organization that is built inwards-out and the process organization that is built outwards from the needs of the customers and in. It took 5 years for Ford to discover that jeeps are not sold anymore. At Toyota however..... see rambling about Toyota below..... There are several benefits from process organizations but some of them comes with a bit of pain. Richard ended his presentation with this depressing quote by Konosuke Matsushita: 
We are going to win and the industrial west is going to lose: there’s nothing much you can do about it, because the reasons for your failure are within yourselves. Your firms are built on the Taylor model; even worse, so are your heads….

Have you notices that Toyota is the new holy grail for methodists? Toyota works fine and is probably a great place to get inspiration from. But one thing that strikes me is that the software business doesn't seem able to come up with stuff of its own. We have the architecture analogy since way back and now we have a car dealer to draw from. Can it be that our discipline is too abstract to just talk about as is? Do we need clues from the "real world" to actually understand what we are doing? Probably nothing to be sad about but rather a sign of sanity!

This has been 3 great days with lots of interesting insights from lots of cool people. Going to conferences like JAOO is a great way of getting the feel for what is up and coming in the business. To my delight portals and portlets weren't mentioned a single time fueling my criticism of the project I work in currently. A bit surprising was the lack of an Erlang presentation - it seems like just as interesting a language as Clojure or Haskell. One thing I missed was more interaction. All sessions were mostly one way communication. There are several formats that can activate the audience but none of them were used. With this many developers around - wouldn't it be great with a hackathon for example? (I guess the pay extra tutorials are like this but....)

By the way - slides are available at the conference site. For some a password is needed but most are freely available to anyone.


Tuesday, October 06, 2009

2nd day of JAOO

This day started out with a great guy talking enthusiastically about Haskell. I just understood parts of it but it certainly was a good talk by a cool and enthusiastic speaker.

Rod Johnson - founder of Spring - talked about why the industry moved to lightweight open source. An interesting talk starting with an odyssey through the history of Enterprise Java. It is very interesting that J2EE was created by a bunch of companies that can benefit a lot from a complex approach. Rod called this "the growth of the complexity industry". It not only includes evil big corporations that create standards for products they want to sell. It also includes architects benefitting from being one of a few that actually understands what is going on and developers aiming to get these complex technologies on their resumes. It is kind of a sad story. More recently it happened again with the SOA buzz. An important point though is that standards isn't necessarily a bad thing. The standards forming J2EE is probably one important reason to why Java still is a choice for businesses. Without a formalized approach to the server side it is not hard to imagine an alternative road where Java would have been marginalized and we would have had a different landscape where probably Microsoft would have been a winner. All in all the talk was a really interesting retrospective with lots of hope in the future. There has never been a better time to be a developer than now.

Hardy made his talk on Hibernate Search and it has sharpened a lot since the first time I heard it and it was nice to see. The talk makes it painfully clear that doing full text search of things yourself is really not a good option. Hibernate Search takes care of all the infrastructural things you need when building search functionality on top of Hibernate ORM. Cool stuff.

Henrik Kniberg compared Kanban to Scrum in a good and useful way. His main point that there are different tools to use when setting up a software project and it depends what tool is appropriate for a certain project. If a project doesn't work it is not because the tool is bad - it is because the tool is badly used or because it is the wrong tool for the situation.

Kris Lander and Gus Power - No excuses : concept to cash every week. These 2 guys had perhaps the greatest slides but were perhaps not the most experienced speakers. It didn't matter at all since they had lots of cool experiences to tell about what works and what doesn't work when building serious systems with agile methods. 

Dave Thomas could have skipped his slides altogether and just told us lots of anecdotes from his immense experience in the business. It was an entertaining and opinionated talk with harsh comments about lots of things. For example what is the point of building big enterprise OO whatnot systems when most of them actually are simple CRUD systems? Isn't objects kind of overkill in all these cases? Or the joke about agile mentors: they are just unemployed smalltalk developers. A great ending to a good day of interesting talks.

Finally I managed to run 7.5 kms and I am really proud of myself!

Monday, October 05, 2009

1st day of JAOO

I am at JAOO and this is the report of the first day. The venue is really great, well organized and with friendly staff that makes everything run smoothly. For me it is the first time at the conference and I have had no problem at all getting around. A nice and straight-forward approach to evaluation is the red, yellow and green cards you put in a box when exiting a talk. An easy way for everyone to give feedback. I figure just a small percentage actually fills in the kind of serious evaluation forms that are the standard.

The starting keynote of the day by Barry Boehm was called Scaling up Agility : The Architected Agile Approach. I realize that this man is quite a legend and it sure is an honor to listen to a man that has such huge experiences behind him. The rather fragmented talk was about the problems of scaling up agile methods. Again I sent a silent prayer to the gods that they may enlighten IT presenters in presentation zen. Lots of strange graphs and tables in very small font made it hard to follow the talk. The question raised in the talk is definitely interesting. As project complexity increases in different directions the need for formality increases too. How do we address this? This need is different in different projects. One important thing to take into account is that the people making up a team and the organizations they belong to may be the biggest restriction on a project. The numbers of developers needed and their current skill set has a huge impact on a projects success. I never really got a good answer to the question from Barry but then I might have been a bit tired from the late flight yesterday.... The best answer I have seen yet is Alistair Cockburns work on the crystal method which sadly no one seems to be using. I would rather have seen crystal getting the position that Scrum has these days. Isn't it a bit typical that the lightweight method that focuses on management is the one that gets chosen when agile goes mainstream. What I miss A LOT in Scrum is the focus on the craftsmanship of coding that is emphasized in eXtreme Programming and in Crystal. With scrum it is perfectly valid to be agile without going test driven. The effects on the produced software unfortunately speaks for itself.

Michael Feathers had a really cool talk about working effectively with legacy code. I haven't read his book but I have followed his blog for a while and I really like his views on coding. We talk most about new code bases, new techniques etc and are not that interested in the old stuff that makes up the vast majority of the combined code bases. Yet this is the code that we probably will spend a lot of time changing and making right. The focus Feathers is putting on this subject is surely needed. I may blog a bit more about this talk later on when thoughts have settled.

(Legacy code always make me think of the big ball of mud - true and ironic.)

The creator, Rich Hickey, of the new programming language Clojure gave us an introduction to the language. It was truly refreshing to see this fundamentally different approach to languages as compared with Java/C#. Clojure is a Lisp with all that comes with that. Lisp is very old yet one of the most elegant languages there is. Now I am not language guy so I will spare you a detailed description of Clojure. Instead - lets just say that it is functional, dynamically typed and compiled, highly concurrent and runs on top of the JVM. Read more.....

After lunch I made a bit of a mistake. Instead of listening to all sorts of interesting talks I decided to give the semantic web a second chance. Not that the talks were any bad - it is just that I have been hoping for change in this area for some time and it never really seems to take off. First out was Brian McBride with a talk called Linked data and after him Eric Gordon Prud'hommeaux with a talk called the Semantic web. Both talks were a bit too technical and failed to communicate the vision of the semantic web to me. (Admittedly I was a bit tired after lunch and not enough sleep.) I have been really curious about where the efforts around the semantic web will lead us and so far the answer seems to be nowhere. Brian said something about the impossible task of creating an upfront model for the semantic web and that it rather is something that will grow over the years. Different concrete applications will arise and drive its acceptance further. I agree that this is the only way forward but it makes me a bit sad since it probably means that it will never come to areas where there are no competitive advantage of embracing it.

Hardy arrived and he really wanted to see the legendary Barry Boehm so since I didn't have a good alternative to come up with I accompanied him to that lecture which essentially was a replay of the keynote. No news there.

The day was perfectly ended with a couple of beers at Sidewalk next to the nice canal and then the party in Ridehuset. Carlsbergs Ale on tap is really nice.

Avoid Dock icon for Java processes on Mac OS

Hi again,

in the previous post I forgot to mention one thing. Ever noticed the useless java bean icon in your Dock when running java processes? Here is how you control their behavior.

If you want to avoid them completely (like for services, eg Tomcat or JBoss) you can just pass the java.awt.property to the JVM. Something like

java -D java.awt.headless=true ...

Just find the right way of doing this in your startup script or in case you are using launchd add it to your plist file.

In the case you actually want to have an icon, but want to have something which actually represents your application you can use the following JVM options:

java -Xdock:name=MyApp -Xdock:icon=/path/to/custom/icon.png ...

Now, I better get ready for JAOO. Currently I am on the ferry between Varberg and Grenå and I have seen a calmer whaether :(

Will also meet Fredrik at JAOO. I am sure there will be more about this conference here shortly.

--Hardy

Java programs as daemons on Mac OS X

For a while now I am running a local instance of Nexus (Sonatype's maven proxy) and Hudson (continuous integration engine ) on my MacBook. the benefits might not be so obvious initially, but I think as developer you should familiar with the tools supporting your work, even if these tools might be provided to you by some system admin. Besides, it is sometimes quite nice to trigger a clean build of the software you are working on on your own machine while still working on your local copy.

Anyways, initially I started Nexus and Hudson (which runs in a servlet container) manually when I booted my notebook. Obviously I wanted to automate this. Coming from the Linux world I tried to find the directory /etc/init.d. Anyone who has done the same will know that this was a futile search. It became quite quickly clear to me that Mac uses a different approach for service configuration.

A search on the internet first led me down the path of StartupItems, but some more research showed the better way of doing this is to use the services of the launchd deamon. The are system and user specific services, configured in /System/Library/LaunchAgents and ~/System/Library/LaunchAgents respectively. The configuration uses Mac's plist xml format. Since I am not really used to these plist files I had a quick check on the net. surely there must be some sort of frontend to this. And yes, there is - Lingon. I am not sure how active development is on this project, but the version I downloaded did everything I wanted. The interface it quite intuitive, so there is no point to go into too much detail. Instead here comes the plist file Lingon created to for me to run Tomcat as service:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Tomcat Startup Script -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.apache.jakarta.tomcat</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/opt/java/tomcat/bin/catalina.sh</string>
<string>run</string>
</array>
<key>ServiceDescription</key>
<string>Tomcat Server</string>
<key>StandardOutPath</key>
<string>/opt/java/tomcat/log/log.stdout</string>
<key>StandardErrorPath</key>
<string>/opt/java/tomcat/log.stderror</string>
<key>EnvironmentVariables</key>
<dict>
<key>JAVA_HOME</key>
<string>/System/Library/Frameworks/JavaVM.framework/Home</string>
</dict>
</dict>
</plist>

Easy, no?