My Ubuntu Eclipse Development Environment

I spent some time a few months ago getting my development environment set up just right for development. I think I’ve got it cracked now so thought I’d share :)

Ubuntu 9.10

First up, put Ubuntu 9.10 on your box. I’ve learnt to love Ubuntu for development as it has a few things about it that make things smooth when developing. Proper multiple desktop support is the killer for me.

List of Simple Things to Install

Gnome-do

I press my ‘windows’ key and space, up pops gnome do. I then type what program I want and it launches. No more searching for programs in a start menu.

MS fonts

Most web sites use specific fonts that aren’t available in the default Ubuntu install. As a result they look a bit rubbish in many cases. Add MS fonts to solve this.

Echofon

Twitter in my browser. Just a personal taste thing.

Download status bar (firefox)

No need to have a downloads window that gets pushed behind your browser and forgotten about.

F.lux

Automatically changes the colour temperature of your monitor in the evening/very early morning. Much easier on the eyes. Link

Compiz

Allow configuration of lots of things about how things are displayed. You will also need the settings manager.

sudo aptitude install compizconfig-settings-manager

I add this setting under window decoration:

Decoration windows: !state=maxvert

This hides the title bar on any maximised screens, giving you back a bit more screen real estate.

Wmctrl

Window management tool that I have a very particular setup for. It allows me to hit my windows key and a number on the numpad and move windows around. E.g. win+4 will make a window take up the left half of the monitor.

sudo aptitude install wmctrl
sudo aptitude install compizconfig-settings-manager

Open the compiz settings manager. Then inside general settings open up commands.

Tip: enter a line into a terminal and change it for doing small tweaks.

I used the following settings for a 1680×1050 monitor. It’s not perfect but it’s pretty damn good :-)

Maximized:
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
 
Left Side:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,2,0,833,1050
Right Side:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,849,0,831,1050
Top:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,0,0,1680,472
Bottom:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,0,525,1680,525
 
Top-Left:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,2,0,831,472
Bottom-Left:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,0,525,831,472
Top-Right:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,849,0,831,472
Bottom-Right:
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz;wmctrl -r :ACTIVE: -e 1,849,525,831,472
Fix bug in Nautilus for home folder link

https://bugs.edge.launchpad.net/do/+bug/290136/comments/48

Minor Tweak to Firefox

I move the toolbar (with the address and buttons) up alongside the menu. The net effect is one less row at the top of Firefox and more focus on web pages.

Wine 1.2 (beta)

Needed for…

Spotify

Music. ’nuff said ;-)

Mozilla Prism

I use this to put gmail on to it’s own workspace so that I don’t get distracted when looking up things in the web browser.

Eclipse

Vanilla Eclipse doesn’t work perfectly in a vanilla Ubuntu install. Buttons sometimes don’t response. A fix is here

That’s it

This is what I’m running now and I find I’m far more productive in this environment than any previous setup of mine. It’s particularly neat on laptops where vertical screen estate can be a premium.

Why val and var rock

When discussing val and var in Scala they are often seen as the alternative to Java’s more long winded way of declaring variables, e.g.

Employee bob = new Employee("Bob");
vs
var bob = new Employee("Bob")

The latter is clearly more succinct and has less repetition. This is normally where the discussion ends and we declare Scala the winner.

However, Scala gives you more than this added brevity. By forcing every single variable declaration to use val or var you are forced to make a design decision.

Scala forces a conscious decision about mutability of variables

In Scala, every time you define a variable you make a decision as to whether a variable is to be immutable or not.

Java has the option of adding the final keyword to variable declarations. However, you must remember to do this every single time and it is also more effort (not much, but let’s face it, we’re lazy ;-)). As a result, final is omitted from many places where it could be used.

With Scala, it’s far easier to remember to make things immutable.

So, why do we care about this?

Making local variables immutable can increase code quality

Immutable local variables are:

  • Easier to debug: if a variable is initialised to a value at the start of a method then it will be the same value at the end. It’s one less thing you have to worry about
  • Easier to maintain: someone new to the code cannot accidentally change the value of the variable (at least not without taking the effort to change it from a val to a var)
  • Easier to test: if something can’t change during a method call then you don’t have as much to consider when testing

And that is why I think val and var rock :)