Push Button Builds

8. September, 2011

A few days ago, kingargyle posted about “Push Button Builds.” The idea is that building a software should be as simple as triggering a light switch.

A good example are Maven (mvn install) or most automake builds (configure && make && make install). They usually just work and if they fail, they give you some context to work from.

A good negative example are Eclipse PDE builds: Often there is no build script. If there is a build script, it will fail with an obscure error message in an Ant script that was recursively called by about 100 other Ant scripts. Each Eclipse project uses PDE but each build has different prerequisites (which you must know). If the build uses p2 repositories, there is no way of telling whether two subsequent builds will produce the same result. Some projects try really hard to help newcomers to build their stuff with a recipe that needs 100+ easy steps. In four words: It’s a mess.

Or a surefire way to attract only the most dedicated committers because everyone else will be utterly demotivated very quickly (and you don’t want those, do you? 😉

So like Dave Carver, I would like to spread the idea. Make builds more simple. Here is an example and following Dave’s advice, I’m going to make the build script even more simple.

Why a script and not, say, a web site with instructions? Several reasons:

  1. A script will make you more dedicated. It’s easy to be sloppy with a README. With a script, at least the syntax will be right.
  2. When a README fails, you won’t really know what to do next. With a script, you have a very precise starting point for a bug report: “The setup script failed in line 15” vs. “Install with Maven … and which version?”
  3. Scripts can prepare the environment. Since you don’t want to make anyone angry, create a new directory and put everything in there. Download what you need, unpack it, configure it. If you can’t do it with a script, why should a newcomer fare better?
  4. Can’t download something? You can always print an error message with exact instructions: Go to website … download xxx, version yyy … put it here. In a script, you can say ‘echo “Put download into $build_dir”‘ Try that in a README.
  5. You can prove that a script works. Good luck trying that with a README.
  6. You can run scripts on a CI server to make sure they work.
  7. A script always needs an interpreter. Bash scripts run on Mac and Linux. What about Windows users? Well, 100% of the Windows users build OSS software from .msi files. The tiny rest has three options: a) Read the bash script, b) install Cygwin/MinGW, c) install Linux.

Eventually Windows Will Have Voice Recognition

8. September, 2011

At least for a couple of days until children start to run through the cube farms screaming at the top of their lungs: “Format C: Yes!”


Disabled Sharing

7. September, 2011

Until the German law has decided how to handle the illegal data transfer to sites like Facebook and Co., I’ve disabled the sharing options in my blog.

For those interested: German laws say that companies must not collect data about someone unless said data is necessary for a business transaction. Since you have no business with Facebook (Facebook’s business is selling your data to advertising companies), give your data (like that you visited my blog and liked it) to Facebook is illegal.

It would even be illegal if I asked for you permission before showing a like / +1 button since you have no way of knowing what happens with your data.

While this might seem excessive, it’s a law that has its roots from German’s past where the Nazi time where such data could kill you (for example if they suspected you to help Jews, listen to foreign radio, etc). Uncontrolled data collection gives someone uncontrolled power and there really is no telling how such data could be abused by a smart criminal.

People already lose jobs or don’t get them in the first place depending on the Facebook profile. Just imagine what could happen if someone who hates you, say your ex, gets a list of all your friends and starts to tell them the “truth” about you. Or if some overeager official who suspects you to be a criminal asks Facebook for all your data which includes a list of most web sites that you visited in the past 90 days.


No Software Can Be Better Than Its Worst Error Message

7. September, 2011

Kudos for this simple but oh so true proverb go to Stephan Herrmann.

Thank you.


Human-Readable File Sizes

6. September, 2011

Every now and then, you need to show a number to a human. In some cases, those numbers can range from very small to huge. File sizes are an example.

Here is a very short code sample how to get a nice file size for human consumption: How to convert byte size into human readable format in java?

Best of all: It’s four lines of code but it can handle SI and non-SI units.


Final Java Questions

3. September, 2011

Recently, I read a blog post which talked how “stupid” today’s developers are. As an example, “the interviewed candidates claims that they are very good at core java and saying that we can’t add/remove elements to an ArrayList which is declared as final.” (Are Frameworks Making Developers Dumb?)

Funny, right? But it got me thinking.

How important is it really that someone knows this? With over 60K points on stackoverflow, I’m one of the most knowledgeable software developers in the world but there was a moment, when my brain stumbled over the question. I rarely use final in my code. So how much value does this information have? How often do I need this every day? Once per week? Month? Year? How much damage can the wrong answer cause?

While I agree that sound knowledge helps a lot, I see team mates struggle much less. They don’t know as much as I do but there is a demotivating effect here: If you know too much, every simple question triggers a flood of thoughts: What can go wrong? Didn’t we encounter this already? What’s the best solution?

Sometimes, there are two “best” solutions and missing any further input, I can get stuck in a deadlock. Which way to go?

Or the solution to a problem triggers a new problem which in turn triggers a third. Suddenly, I’m caught in a maelstrom of dread which overwhelms me: Every possible way out just causes more trouble.

So for me, knowledge isn’t everything. Some people are “just” decent developers but that should not stop you to hire them. Here are some other, valuable factors:

  • How easily do they give up?
  • How well do they play as a team? That doesn’t mean everyone has to be a “team player” (whatever that might be). But strengths and weaknesses of each individual should compensate each other. One guys likes to talk a lot, let him handle customers. The other guy likes to work alone, give him the hard tasks that need a lot of time and concentration.
Most of all, make sure that every member of the team understands that a weak spot doesn’t make someone less valuable. It just makes them less valuable for certain tasks. If you can distribute the tasks just right, the team will be much stronger than one made up from the best developers in the world.

Restoring a Corrupted Workspace in Eclipse

2. September, 2011

When Eclipse is starting to act weird or completely refuses to start, the .metadata probably got corrupted. Now what? You could delete the .metadata directory and waste a couple of hours to restore the IDE to a useful state.

Here are some tips to speed up the process a lot:

  1. If Eclipse still works, export your preferences.
  2. Try to start Eclipse with -clean. That flushes some caches which might have become corrupted.
  3. Start Eclipse, wait for all builds and background activity to stop and then kill it using your OS’ tools. When Eclipse restarts, it will notice it has crashed and do some more cleanup / distrust more caches.
  4. Install the Bulk Import plugin to save list of projects and their state.
  5. Instead of deleting .metadata/, rename it.
  6. Restore the folder “.metadata/.plugins/org.eclipse.core.runtime/.settings” from the backup. This is basically the same as the preferences. Kudos to Tomas Kramar for figuring that one out.
  7. Restart Eclipse. You should get an empty workspace but all your preferences should be there.
  8. Use the buttons in the toolbar to restore all your projects.

Another useful plugin is the “save UI state” which saves the workspace layout and open editors after every change (based on the code here).

With a way to preserve your preferences, saving the project state the workspace layout, you should be able to quickly restore the IDE.

Related articles:

  • Eclipse Dance Steps – “Sometime Eclipse fails to work as expected. The following ‘dances’, in increasing order of desperation, may help. Remember to maintain a fixed grin throughout and try not to tread on your own toes.”

Finally: M$ Improves File Operations

1. September, 2011

Good things need time. Even if they hurt you every day. File operations (copy, move, delete) on Windows are such a pain.

The damn thing takes half an hour to found out how many files to delete and then deletes them in a couple of seconds. Or the old joke “How long will it take?” Or copying two folders with the same name over each other (computer experts call that “merging”).

Well, M$ listened (they always do – they just rarely care) and after only … calculating … 29 years, they’re going to fix it! Yay ^_^

PS: Linux does it this way since a couple of years. Not sure about Mac. So another thing that M$ reluctantly “invented” after everyone else had it for years.