Menu

My personal experiences with Java, Android and Linux.

Month: March 2015

Optional is a new type of Java 8. I saw it before with scala and was quite impressed. You know Tony Hoare’s “billion-dollar mistake”: the null reference. How many NullPointerExceptions have you yet? The type Optional wants to fix that. With Optional you won’t get any NullPointerExceptions anymore. But it is important to use Optional the right way. So don’t disappoint Hoare and take the chance to fix the billion-dollar mistake.

Return values

If you have a method with a result which sometimes may be empty, don’t return null. Even if you add a comment to your method. They will not always read it.

Avoid nested null checks

Sometimes you have several optional values in a row. Only if all optionals return a value, you want to return an http 200. Http 404 should be returned if somewhere in the chain there is no value. Again there is a complicated way:

In a previous post I already mentioned why the architecture of IBM RTC will never scale like git. As a developer you use an SCM and probably a project management tool on a daily basis. Even small annoying things make you feel bad and are time consuming. In this post I list some reasons why a move away from RTC to git will save real money for your organisation and make your work easier.

Maven integration

IBM RTC is not prepared to work with hierarchical structured projects. Maven is a widely used build and dependency management tool. In some cases it is important to have a hierarchical structure of your projects. Especially if you work with parent and child projects. Unfortunately RTC hinders you to check out parent and child projects in the same workspace. You can make it run but have to do some workarounds. There is also a good blog post about it by Mike MacDonagh (Working with Maven multi-module projects in RTC Jazz SCM with m2). He talks about RTC v3.x but it is basically the same as with v5.x.

There are no reasons why you couldn’t do it with git. git does not know anything about a project. It is not it’s business. RTC seams to manage things that it shouldn’t.

IDE integration

All current IDEs have git support in their basic versions. I don’t know of any Java-IDE which comes with IBM RTC integration out of the box. This means you have to install it manually. In case of Eclipse it means to download about 500 MB(!) of plugins. With every new version of Eclipse you have to wait for the new IBM plugin before you can use the new features. You got the same situation with Visual Studio, IntelliJ and NetBeans.

Comparing file versions between branches / streams

With git you can easily compare file versions from different releases in different branches. The history view shows all very clearly (image on the right side).

In IBM RTC you can’t do that. It is a recommendation from IBM to create a new stream for every release. At first sight it might look pretty but if you really work with it you see the disadvantages:

It is complicated to merge streams.

There is really no way to compare your file from one stream with another stream until you load both streams.

It is even impossible to see if the file changed in another branch.

Merging

Some people say the merging process of git was better than the one with IBM RTC. Maybe I will post a direct and detailed comparison between those two tools later.

Complicated commits / delivery

This is a quick comparison between the git way and the RTC way.

The git way

Either you use the console:

git pull
git commit -m 'your comment'
git push origin master

Or you use the awesome Git Staging view from Eclipse:

To commit and push there are only three steps:

Drag and drop the Files to your staging area

Add a comment

Click the Button “Commit and Push”

The RTC way

IBM RTC didn’t manage to create such a smooth view. Every action needs lots of server calls because you don’t have a local repository. They added a lot of asynchronous calls which lets your view update randomly. You sometimes wait for ages depending on how big your component, stream, change set or history is.

You need to do make at least five steps. It includes context menus, keyboard strokes and tree navigation:

check-in your changes (3 clicks)

Open the outgoing folder under your stream and find your newly created change set.

Either click on it once and press “F2” or wait a second and perform another click.

type your comment

Deliver (another 2 clicks)

Sometimes you have to answer some complicated questions about not checked-in changes.

Then some asynchronous tasks start running and mostly after a second or two everything is delivered.

Working offline

As you have no local repository every interaction with RTC requires a server call. It is not designed to work offline. Git always had that use case in mind.

Git ecosystem

Git is very popular, widely used and extendable with hooks and triggers. Therefore many open source projects emerged around it. Just a brief list:

github.com: “Social coding”. The most popular git repository. I social web ui with issue tracking and many other integrations.

gitblit: Github like open source server ready to host on your local infrastructure.