Twitter github

Tic-Tac-Toe Everywhere

Wayne blogged about something really important this morning. The new Eclipse Runtime project is going to be cool because I see it bringing down traditional walls around development:

What do I mean by this? As an example, if you look at three types of developers: web, desktop and embedded… these were three completely different types of jobs that required completely different skills. So if your company was working on a project in any of these fields, you had to hire in these particular fields of expertise. These walls are starting to come down with the spread of Java, Eclipse and OSGi. Let me give you a picture of what I mean through a silly example I wrote awhile ago:

Tic-Tac-Toe on the Desktop (RCP):

Tic-Tac-Toe on the Web (RAP):

Tic-Tac-Toe on the Embedded Device (eRCP) via Emulator:

What are you looking at here? Basically the same application (~90% shared code) running on three different environments:

  • The Desktop via RCP
  • The Web Browser via the RAP project
  • The Embedded Device via the eRCP project

Since people reading my blog are mostly interested in code, here are the 5 plug-ins that comprise this work:

  • Core Model Code (i.e., can run everywhere)
    • org.eclipse.examples.ttt.core (~300 LOC)
    • org.eclipse.examples.ttt.core.tests (~100 LOC)
  • Core UI Code
    • org.eclipse.examples.ttt.common.ui (~150 LOC)
  • Embedded Specific Code
    • org.eclipse.examples.ttt.ercp.ui (~20 LOC)
  • Browser Specific Code
    • org.eclipse.examples.ttt.rap.ui (~20 LOC)

As you can see, the majority of the core logic is contained in the core plug-in that drives the TTT board. This core logic is used by all the other plug-ins. The common.ui plug-in defines the basic view, buttons and other reusable UI pieces. The ercp.ui and rap.ui plug-ins define the specific extensions needed to get the client working within the respective environments. These are usually really simple things like defining a simple extension point so eRCP or RAP is aware of your existence. In this extension you would simply build your UI reusing the components in the common.ui plug-in. Cool huh? The possibilities of saving time on development especially if your project targets multiple environments are awesome. This has been the main pitch of the RAP project for awhile… to “single-source” your RCP / RAP applications from a common source.

I plan on contributing this code to the Eclipse examples project once Wayne gets things moving.

How about we work together to bring down some of these “walls” and enable more symmetry amongst the different types of development we do.