Monday, February 12, 2007

TagSEA 0.5

As Chris mentioned, there are a few projects associated with tagging in Eclipse. We have just released version 0.5 of our project, TagSEA.

Update Site:

Like many other Eclipse projects, TagSEA is both an extensible framework as well as a set of exemplary tools. It provides basic tagging infrastructure for Eclipse, as well as concrete implementations for Java Tagging and Resource Tagging. TagSEA uses a concept from wayfinding known as waypoints. A waypoint is a particular location you wish to mark. TagSEA allows you to add tags, metadata and a comment to this waypoint.

Why did we do this? Good question :) We hypothesized that through the use of marking locations in code (or XML, or PDE Forms, or Workbench layout, etc...) , and providing mechanisms to return to these locations, developers could more easily navigate to “common” hot-spots or share interesting places with others. What do you think? Of course this is very new and we are just starting out, but we have all sorts of ideas of where tags could be useful:

  • EMF generated code that users are likely to customize
  • Places in the GEF framework that “should” be extended for normal operation
  • Plugin and manifest files
  • Mylar tasks
  • Images and other resources for future retrieval
  • SWT Snippets or other sample code
  • JUnit test cases

TagSEA currently supports hierarchical tags, a tag view, waypoint view and tag refactoring. As I mentioned, we have concrete implementations for Java and Resource files (Web URL and breakpoints are on the way). Where should we go next?

We have a long talk planned at EclipseCon (here) and we are currently throwing around the idea of holding a BoF on IDE's and tagging.

Monday, February 05, 2007

Eclipse Modeling Project and OCL

Anyone who believes that modeling at Eclipse is limited to EMF and possibly GMF, really should checkout the Eclipse (Top Level) Modeling Project (EMP). Ed Merks and Rich Gronback have done an excellent job of bringing together all of the Eclipse modeling work under one umbrella. A quick count reveals over 25 components to this project (including EMF and GMF).

Why should you use this technology? Of course if you are focusing on SWT extensions or device drivers this may not be the technology for you. But if you are writing an application (rich client or otherwise) that uses a data model, leveraging the EMP may save you a ton of time.

Recently (for part of my PhD) I needed a data model with a lot of data. I created a model (using EMF) for National Hockey League statistics. I created a class for Player, Team, PlayerYearlyStats, etc... The stats had attributes such as goals, assists, PIM (penalty minutes), etc... Using EMF I hit “Generate” and I had a fully working Java application that allowed me to create players, edit statistics and save all the data to an XML file (not bad for 10 minutes work). From here I populated the data with all the NHL stats from 1917 (no, I did not do this by hand!).

Next I decided to checkout a few other modeling components. In particular, I looked at the Object Constraint Language. OCL allows you to specify constraints on your Object Model in a platform (language) independent way. For example, I can say that if a player earned 200 points in a season, then the player must be Wayne Gretzky (self.points > 200 implies = 'Wayne Gretzky'). While this record may never be broken, I would probably use OCL to specify more “predictable” constraints such as 2 players on the same team can't have the same jersey number, etc...
OCL can also be used to query your data. Christian Damus (the author of OCL for Eclipse) has provided great examples to help you get up and running. Once installed, the OCL examples will generate a simple interpreter plugin that extends the Eclipse Console. Using the OCL interpreter plugin you can write OCL queries. For example, I can write:

Player.allInstances()->select( p | p.yearlyStats.goals->sum() > 800)

To select all the players who goals each year sum up to a total greater than 800. If I change this to 700 goals I get 6 players. I will leave that result as an exercise for the reader