IntelliJ Live Templates for Eclipse

Migrating to Eclipse has been interesting having used it for a little over a week now. I’m definitely not as productive in it yet, and there are features (or plugins) that win some points, but others that lose dismally. I’m still reserving my judgement for a few more weeks and probably should wait until I pair with an Eclipse super user. Til then though, I’ve missed some of the common IntelliJ Live Templates (equating to Eclipse Templates), so here‘s a file for those that want them (for use with Eclipse 3.1.1). Import them under Window -> Preferences -> Java -> Editor -> Templates (no, I’m not kidding). I’m building up a list of key mappings as well, but that will take a little bit longer.

Anything that saves me from typing is awesome. Enjoy!

Issues With Eclipse

I’ve always been an avid IntelliJ user, even when I was forced to use JBuilder and JDeveloper quite some time ago. I’ve been trying to give Eclipse a fair go, and despite having to change the way that I think, the transition hasn’t been too bad. I’m perhaps suffering a little bit more RSI (a consequence of having to press CTRL-SHIFT a lot more combined with my bad habit of always using the left hand side for CTRL and SHIFT), but other than that, most things are about learning different keystrokes.

I’m not a big believer in saying that IntelliJ is better than Eclipse because I haven’t used Eclipse in anger as much, so I’m still open to giving it a fair go. There are a few things that I do miss that I haven’t been able to find, so if someone can knows about them, or can suggest (yet another) plugin to fix, then I’ll be happy to try it out.

My current list includes:

  • ALT-F8 also known as Expression Evaluation (both code fragment mode and expression mode) – Since I’m a lot faster when I use the keyboard over the mouse, I like to use this feature of IntelliJ rather than setting watches and inspecting values. It’s easier for me to add a break point, debug, fire this up and then evaluate at runtime to my heart’s content. I can easily focus on working out the values of the things I care, the state of things to come, and blocks of code to see if I change code, what the effects would be. Better yet, a lot of the normal IDE features are available in this mode, including code completion, normal import options (ALT-ENTER) and the rest of niceities IntelliJ offers. The closest thing I have found is the “Evaluate Expression” in Eclipse but it seems to be constrainted to static values in code. (The closest thing for Rubyists is the IRB)
  • CTRL-SHIFT-ALT-N also known as Symbol Search – I find this feature is most useful, for when you are new to a code base (you can easily find which class it belongs to) and in finding a specific test case that is failing. I don’t really use this that much if I’m familiar with the code base as there are faster ways of navigating, but it is really useful in the right circumstances. I haven’t been able to find any alternative
  • CTRL-SHIFT-10 (inside a test method) also known as the execution of a single test method – When I have a test method fail inside a test class, my first instinct is to go and run that test in the IDE to see if I can replicate it. IntelliJ makes that easy by understanding the context where you are – if your cursor is inside a test method it will run that single test instead of the entire suite. The best that I have seen so far is for someone to run a test suite, stop it and then right click and run the single test (no shortcut key!)
  • CTRL-ALT-L (autoformat) – Although there are pretty code formatters for Eclipse, I love the fact that I can use the same shortcut in IntelliJ and get the same result, be it Java, XML, HTML or even Javascript! Better yet it can be run over an entire directory without having to touch the mouse.

When a space is not a space

I only found today that Unicode (not just HTML) also has the concept of a non-breaking space character. If you ever find something that looks like ' ' but never quite equalling ' ' then I suggest you look at their char value. 32 is the normal space character, 160 is the non-breaking space one. A few other interesting notes:

  • A non breaking space is not considered white space (in java)
  • A non breaking space is considered white space (in .Net)
  • Space is part of the normal BASIC_LATIN Unicode Block, No Break space is part of LATIN_1_SUPPLEMENT

Evolving An Agile Architecture

Last week I heard that the project I just rolled off was a huge success, both for our UK office (in terms of significant wins and growth), as well as the development team (for the freedom of both process and technology choices). When I started work on the project, I was working with Joe Walnes, and one of the project’s foundation principles was about making technology and process decisions that helped to reduce the build time (and therefore delivery time). I have been on, and heard about, many other projects that end up with several staged builds, leading to the average developer build of around an hour. When I left, we had a sub-minute build (including end to end testing) and a deployable application with a dependency on only Java 5 and Ant (but okay, it’s not a huge system yet).

I’m posting this entry so that somewhere I hope that someone learns something which they apply in optimising their own build (or even sharing their strategies) to make their projects even more agile. What follows is a list of some of the more significant decisions we made, and more importantly, why we made them. Read more “Evolving An Agile Architecture”

Learning a new Language

All the projects I have ever worked on have never been technically difficult (in fact I think that most of them in the world are not). The biggest challenge I find is learning the language that all the people who work daily on the project speak in. To put this in context, after rolling onto my newest project, my biggest problem has been trying to understand what it is exactly that everyone speaks of because, to me, it almost seems like a completely different language. There are certain patterns that I am trying to use to come up to speed quicker. I am sure that there are established learning patterns, but I thought it might be useful to share some of the ones that I use.

Decode the Acronyms – Most languages have an abbreviation for extremely repetitive terms that are important to people in the domain. Decoding acronyms helps with the next pattern of Defining the Vocabulary.

Define the Vocabulary – Think of the ubiquitous language from Eric Evans’ Domain Driven Design and simply put, is used to translate special terms people involved with the domain into something a person who does not know anything about the domain can relate to. Fortunately for me, the Vocabulary on my current assignment has been documented pretty well. I find that repeating them in daily conversations with people who know about the domain (and can correct me) is a useful technique for truly understanding what they mean.

Adopt the Grammar – Common words are especially dangerous on a new project because they are things you assume mean one thing but when put together in a special way or in a different context, can mean something totally different. Adopting the grammar is a lot more readily accomplished once you have learned the vocabulary.

Discover the History – New languages emerge because once they are understood, they can be a more effective communications mechanism for operating in the same context. Discovering the history is about finding out where the vocabulary and terms come from, and why they are used in the way that they are. These factors can come from many sources including technical, political, environment or just conventional.