Friday, May 25, 2012

Monday, April 9, 2012

Universal answer about optimization

When reading through questions on related to optimization ("is X faster than Y"), I often want to reply with the same answer, regardless of what the question was about:

When optimizing you should always follow these steps:
  • Don't optimize until you have a nice, clean, and working version of your code.
  • When you have a version which is nice and clean, decide if it is fast enough.
  • If it isn't fast enough, measure its performance. This step is important for two reasons. If you don't measure you won't (1) know the impact of any optimizations you make and (2) know where to optimize.
  • Optimize the hottest part of your code.
  • Measure again. This is just as important as measuring before. If the optimization didn't not improve things, revert it. Remember, the code without the optimization was clean, nice, and working.

Thursday, April 5, 2012

Google+ Message megafail

I usually like Google and their products, but what on earth went through their minds when they decided to add functionality to Google+ which is not available on the web? I'm of course talking about "Huddle" aka "Google+ Messenger", which Google decided should only be available on mobile devices. Some collective design meltdown? Aliens inflitrating the usability testing department? I don't know.

Several times I've gotten notifications on my phone -- bear in mind that messenger and regular notifications look more or less identical -- and when I log in to G+ on my desktop, the conversation is nowhere to be found.

Not only is this a bad design decision for messenger, it causes the entire G+ to be less useful for me, since I suddenly have two devices I have to check in order not to miss things people send to me. This is annoying enough with both G+, Facebook, Twitter, and all other things I use to communicate with people.

Tuesday, April 3, 2012

EclipseCon 2012

Last week was the time to go to EclipseCon again. For me it was the fourth time which almost puts me in the "veteran" category, but not really. This year EclipseCon was held in Reston, Virginia. I supposed they listened to all the feedback from people who where fed up with the somewhat dull place Santa Clara (no restaurants or shops anywhere nearby), and from all the Europeans who had to travel 9 timezones.

As usual, there was lots of socializing, photographing, beer-drinking, eating, talking about programming, watching cool demos, listening to talks about programming, listening to keynotes, and watching people holding invisible things in their hands. You can even spot me in one of the photos. I'm usually not that blurry.

The major theme this year was Eclipse e4, the new Eclipse Platform on which this year's release train (Juno) is being released on. Eclipse e4 was conceived 4 years ago at EclipseCon 2008 (coincidentally the first EclipseCon I attended). Back at that time it was all up-in-the-blue ideas for how to make an Eclipse Platform which would meet the needs for the Eclipse ecosystem (plugin developer, RCP developers, users, etc). Eclipse 4.x brings two "new" technologies to the table: EMF and Dependency Injection.


Monday was (as usual) tutorial-day (also referred to "day 0"). The first tutorial for me was DSLs for Java Developer with Xtext. Xtext has been one of the hot Eclipse topics for the last couple of years. It allows you to easily create your own (domain specific) language such that much of the IDE tooling you are normally used to is implemented automatically. By writing a grammar, Xtext will automatically generate an editor for you with support for auto-completion, syntax coloring, etc. I haven't attended any Xtext tutorial at previous EclipseCon, so I was glad to be able to get into this one.

For the afternoon tutorial I was unsure which one I should choose. There were several interesting ones, but in the end I went with Building Eclipse plugins and RCP applications with Tycho. Tycho (together with Maven and Nexus) is gaining traction in the Eclipse community, so I wanted to learn more about Tycho to see if this is something that we want to investigate. We are currently using Buckminster for building, but there are some parts of the workflow which Tycho/Maven seems to be better at. For example, Maven has a more complete command-line interface where you can build everything out of the box using "mvn clean install", whereas Buckminster in practise requires you to have a wrapper (ant) script to handle the long command lines. I will probably test Tycho/Maven one a smaller project to get a feeling of how it applies to our environment.


Tuesday was the start of the "real" conference. First out was Alex Russell's keynote The Web Platform is the Past, Present, and Future. Good keynote on the topic of the web as a successful platform despite its lack of technical merits. After the keynote, people scattered to go to various talks. I went to The Eclipse 4 Application Platform explained, which was a good overview of how to use the new Eclipse 4.x platform. It covered areas such as dependency injection, the context hierarchy and the application model.

Spraying - a quick way to create Graphititalked about a DSL (implemented using Xtext, of course) used to create graphical editors on top of the GEF framework. GEF is a useful tool to create graphical editors (WindowBuilder, for example, is implemented using GEF), but it is also pretty repetitive and cumbersome to program. Graphiti/Spray makes this easier by using Xtext and Xtend2 to describe the editor concisely.

One of the best talks of the conference was Eclipse SDK's Greatest Hits: The First Ten Years. It described several implementation details and algorithms that Eclipse is built on. Incremental builds, the efficient delta-tree handling, JDT compiler improvements, and design principles such as "when designing functionality, always ask if someone wants to do it differently" (i.e. extension points).

Last talk on tuesday was 3MF: EMF to the infinity... and beyond. It covered three different use cases which EMF cannot handle well today. The first one was to handle multiple versions of the same Ecore model at the same time. The solution to this is to identify the EPackage using the URI and a version. The second use case was to separate the interfaces from the implementation. Currently there is a static reference in the package interface to the implementation class. This can be solved using dependency injection instead. The third use case was to allow using other OSGi containers. Not sure what the conclusion was on that, though.

Tuesday was also the day for the CDT Summit, where several members of the CDT development team get together and discuss topics related to CDT. This was not in the official conference schedule. There were a lot of things discussed here, see the link above for more details.


The keynote on wednesday was Building a Plug-and-Play Application Development Platform for the Car of the Future. TJ Giuli talked about Ford's application platform and how to use it to program "smart cars". Some cool ideas, but very Ford-specific which made it kind of boring.

After the keynote I decided to attend an informational session on Common Build Infrastructure. This is an initiative to create a set of "standards" for how to build Eclipse software, such that building Eclipse projects becomes really easy (for any Eclipse developer), and also to enable third-parties to build the Eclipse platform. Being interested in how to build software in general, this was a good session to attend.

Next talk I attended was Language Tooling in Orion. Orion is an Eclipse-based IDE running inside a browser. It is primarily used for JavaScript development. Interesting to see how well the web works even for complicated applications such as an IDE, although using it for compiler-heavy languages such as C++ is probably not very useful.

After lunch I attended Experiences from porting a commercial RCP application to Eclipse 4.x. This was a good talk describing how FindOut Technologies went about porting one of their RCP applications to Eclipse 4.x, and lessons they learned.

Building GUIs with WindowBuilder was a "filler" talk for me, since I've used WindowBuilder quite a bit before, but there were no other interesting talks in that slot. I learned a bit as well, like how to create widget factories, and how to use databinding to bind properties of custom widgets.

Migrating to Git: Let's Git this party started described how the Eclipse projects migrated 10 years of CVS history into 25 Git repositories. Challenges, changing the build process, trimming repositories, helping committers making the transition, and so on. The advice at the end of the talk was "Read", "Test migration", and "Communicate".

Final talk on wednesday was Xcore: Ecore meets Xtext. This was a talk by Ed Merks (one of the authors of the EMF book) about a DSL frontend to Ecore using Xtext. The talk covered several aspects of Xcore (writing EOperations using Xbase, compilation to Java, exporting Ecore to Xcore, etc). Xcore seems like it will become a really crucial part of EMF. Unfortunately is only available for Eclipse 3.8/4.2.


The keynote was The Future of ALM: Developing in the Social Code Graph by Mik Kersten, project lead for the Mylyn project. He talked about how open source ALM tools changes the way (open source) developers cooperate. A good speaker and a topic which was very relevant to a large part of the audience probably made this the best keynote this year.

Debugging in 2012 was a talk about the Chronon Debugger, a trace-based debugger which allows you to jump to any point in time and inspect the program contents. The demo was impressive. It would be neat to be able to include Chronon support in a product allowing customers to send bugreports with a complete program trace, but the size of the trace file (~50 MB for a non-trivial program) probably makes that difficult.

Eclipse Xtend - A Language Made for Java Developers described the features of Xtend, a cool new language which is designed to integrated very closely with Java, but bridge some of the language defects in Java. It compiles to Java source code, which means that you can use it completely transparently as a replacement for Java.

Eclipse 4 meets CDO: now you see it, and so do they was a talk that I did not attend, but I thought I would mention it anyway. CDO provides a way to synchronize EMF models across machines, and since Eclipse 4 is built on top of EMF, combining these two technologies allows users to use the same application instance from different machines (using different host environments, and even different localization settings). Nice proof-of-concept talk.

Eclipse 4.2 - Tips on API best practises for a 3.x plugin running on both platforms was a good, although somewhat unstructured, talk about how to maintain plugins which are supposed to run on both the 3.x and 4.x.

The last talk I attended was Xtext - Best Practises. This was a kind of extension to the monday tutorial, where Sebastian Zarnekow covered a bunch of guidelines on how to create your DSL, things like "favor syntatic predicates before backtracking", and "try to avoid follow-up errors".

Last session on thursday was the closing ceremony with the project lead panel, useless statistics, and a few other things.


On friday i hooked up with a fellow geocacher and went to Washington, DC, for some geocaching. The result was 12 virtual caches and 2 earth caches before I had to leave for the airport to catch the flight back to Sweden.


There were a couple of themes this year:
  • Eclipse 4: Since this year's Eclipse Platform release (Juno) will be based on Eclipse 4, there were many talks which related to this in one way or another.
  • Xtext: DSL tooling is still a hot topic; several new cases of DSL built on top of Xtext was presented this year (Spray/Graphiti, Dart, DESAGN, protobuf-dt, Xcore)
  • Agile/ALM: Being co-located with the Agile ALM Connect conference, there was many talks related to Agile and various ALM tools.
EclipseCon would not be the nice conference it is without the social stuff inbetween. I made several new friends, and got the opportunity to talk to several people behind the technologies that we use.