Skip to main content
  • Log in
  • Manage Cookies
Eclipse Foundation
Download
  • Projects
  • Working Groups
  • Members
  • Community
    • Marketplace
    • Events
    • Planet Eclipse
    • Newsletter
    • Videos
    • Blogs
  • Participate
    • Report a Bug
    • Forums
    • Mailing Lists
    • Wiki
    • IRC
    • Research
  • Eclipse IDE
    • Download
    • Learn More
    • Documentation
    • Getting Started / Support
    • How to Contribute
    • IDE and Tools
    • Newcomer Forum
  • More
      • Community

      • Marketplace
      • Events
      • Planet Eclipse
      • Newsletter
      • Videos
      • Blogs
      • Participate

      • Report a Bug
      • Forums
      • Mailing Lists
      • Wiki
      • IRC
      • Research
      • Eclipse IDE

      • Download
      • Learn More
      • Documentation
      • Getting Started / Support
      • How to Contribute
      • IDE and Tools
      • Newcomer Forum
  1. Home
  2. Blogs
  3. Wayne Beaton's blog
  4. I got a little bored on the plane

I got a little bored on the plane

Thursday, November 3, 2005 - 17:53 by Wayne Beaton

I’m in Miami today. It’s very nice here, though the locals have informed me that “it’s winter”. Thus far, I have resisted an urge to let them know that they don’t know cold.

On the flight to Miami, I wanted to work on the EBay RCP application that I’ve been tinkering with, but without Internet access to their sandbox, it’s impossible to test anything. I’m a frequent tester. If I go more than about 20 minutes without running something, I start to shake. It’s not pretty, so something needed to be done.

The problem was one that I created. In my haste to get something running, I tied all my code directly into the EBay APIs. Tight coupling makes me itch; it’s refactoring time.

I decided to remove any notion of EBay from the main application plug-in. In it’s place, I built a few generic interfaces and an extension-point. I updated all my view code to make use of the generic interfaces exclusively. The extension point allows other plug-in to contribute an “auction provider”. I moved all the EBay-specific code into a new plug-in that includes an “auction provider” extension. The implementation of the auction provider conforms to the set of generic interfaces defined in the main plug-in. When the main plug-in loads, it looks for “auction provider” extensions and grabs the first one it finds. It instantiates the class defined by the plug-in and uses the result to actually interface with EBay. All very nicely decoupled.

I then built a third plug-in that also extends “auction provider”. This plug-in’s auction provider is totally bogus. It works entirely in-memory from pre-defined data that is hardcoded into its implementation.

The basic idea is that I can use either of my provider plug-ins. If I want to actually access the EBay sandbox, I use the EBay provider. If I’m just testing some user interface stuff and either can’t access the sandbox or don’t want to, I can use the bogus provider. The bogus provider works brilliantly on the plane. Technically speaking, I can actually use both plug-ins, but since my code only cares about the first extension it finds, one of those plug-ins will be ignored. I have nothing in my code that makes predicting which one will win easy, so I just try to avoid the situation.

I also created two separate run configurations: one for each provider. I can run the configuration I want simply by selecting the appropriate entry from the run or debug menu.

Decoupling is good. My next step is to refactor what I’ve been calling the “main plug-in” (I used a better name, really) to separate the definitions of my views from the application. That way, the views will be more easily reusable should I want to include my EBay code in another application.

Tags: 
Uncategorized
Source: 
https://waynebeaton.wordpress.com/2005/11/03/i-got-a-little-bored-on-the-plane/
  • Wayne Beaton's blog
  • Sign in to post comments.

Eclipse Foundation Blogs

  • Ian Skerrett (857 posts)
  • Wayne Beaton (796 posts)
  • Mike Milinkovich (286 posts)
  • Benjamin Cabé (131 posts)
  • Ivar Grimstad (97 posts)
  • Tanja Obradovic (38 posts)
  • Thabang Mashologu (31 posts)
  • Christopher Guindon (15 posts)
  • Roxanne Joncas (14 posts)
  • Paul Buck (11 posts)
  • Frédéric Desbiens (11 posts)
  • Mikaël Barbero (9 posts)
  • Jameka Woodberry (9 posts)
  • Hudson Kelly (8 posts)
  • Brian King (6 posts)
  • Denis Roy (5 posts)
  • Gabriela Motroc (4 posts)
  • Gael Blondelle (3 posts)
  • Shabnam Mayel (3 posts)
  • Shanda Giacomoni (1 posts)
  • Paul White (1 posts)
  • Jacob Harris (1 posts)
  • Stephanie Swart (1 posts)
  • Michael Plagge (1 posts)
  • Sharon Corbett (1 posts)

Recent blog posts

  • Member Case Study: itemis Builds Its Automotive Industry Business
  • Why I’m Running for the OSI Board of Directors
  • Welcome jadeva GmbH to the Jakarta EE Working Group!
  • Credentials leaked on GitHub
  • Hashtag Jakarta EE #61
  • Eclipse Cloud DevTools Community Update - February 2021
  • Hashtag Jakarta EE #60
  • The 2021 Eclipse Community Newsletter Calendar
  • Hashtag Jakarta EE #59
  • Jakarta EE Marketing and Branding Committee Levels-Up with New Members
More

Eclipse Foundation

  • About Us
  • Contact Us
  • Donate
  • Members
  • Governance
  • Code of Conduct
  • Logo and Artwork
  • Board of Directors

Legal

  • Privacy Policy
  • Terms of Use
  • Copyright Agent
  • Eclipse Public License
  • Legal Resources

Useful Links

  • Report a Bug
  • Documentation
  • How to Contribute
  • Mailing Lists
  • Forums
  • Marketplace

Other

  • IDE and Tools
  • Projects
  • Working Groups
  • Research@Eclipse
  • Report a Vulnerability
  • Service Status

Copyright © Eclipse Foundation. All Rights Reserved.

Back to the top