Abstraction Builder

Building simple and elegant programming abstractions

Schema Driven Web Service Client Development on Android, Part 2: eBay Search App

| Comments

This is the second part of my schema driven web service client development on Android series, in part one, I introduced the blueprint of scheam driven development on Android, then I created a web service client proxy for eBay Finding API and built a minimum App as demo. In this second part, I will continue to create a functional eBay search app on Android by leveraging the proxy created in part one.

There is a good post showing how to integrate Android Application with the eBay API, the author did a very good job, the steps are shown in great detail, this is definitely the recommended reading if you want to develop eBay API based application on Android, however, the author created the application with much low-level passing and plumbing code, there are at least three problems with such approach:
1. The effort to create such simple application is nontrival, this is enough to scare away average developers.
2. The application is hard to maintain, whenever eBay changes some API interface, much effort is needed to rewrite and debug the json parsing code.
3. The application is hard to scale, if more functions and more API calls are needed, much effort is needed to write additional parsing and calling code.

I’ve created a similar application without much effort, I just leveraged the proxy code base created in part one of this series and focused my effort on writing some application logic and UI code. In fact, since I don’t get troubled in backend parsing and plumbing code, I can write far less code than the above mentioned author, this is the power of scheam driven or proxy driven development, below is the main UI of the finished application.

I won’t post much code here since this is a typical andorid application and the code of the whole application is quite self explanatory, you can download the whole application here

Let me drop a few notes about this application here:

  1. The application uses the FindItemsByKeywords request processor built in part 1, and the API call follows the same paradigm shown in part 1.
  2. This is a typical eBay search application, there is only one main activity which extends ListActivity, user input a search keyword and click search, the application calls the FindItemsByKeywords request processor with asynchronous callback specified, inside the callback, UI is updated by populating the list view with search result items, not much code in the main activity.
  3. Droidfu WebImageView component is used to shown ebay item gallary thumbnail image, note, I removed the cache part of the component to minimize the code base, in real application, image cache is required for better performance.
  4. I’ve added a dynamic sliding with pagination feature which makes the applciation look cool and friendly.
  5. Before you run the application, please don’t forget to fill your APP NAME in the AppNameAuthenticationProvider class.

With the eBay Finding API proxy as SDK and the sample app as template, it’s not hard for you to create a more functional eBay Finding App on Android, I am looking forward that someone will build one, and let me know when you build one.

Let me reinterate three main highhights of scheam driven development on Android:

  1. Development effort is minimized, focus on application and UI logic instead of low level plumbling code.
  2. Easy to maintain and scale, whenever the schema changes, resynchronize the proxy with the new schema and update application and UI logic accordingly, no manual xml parsing and debugging anymore.
  3. Better quality and reliability, code generation and component resue foster better software quality and reliability.

Update 1 (2.23.2013)

The eBay Search App has been enhanced to show how to mix API calls in one App:

  1. Search eBay using eBay Finding FindItemsByKeywords API.
  2. Show item details using eBay Shopping GetSingleItem API.
  3. Add item to watch list using eBay Trading AddToWatchList API

below is the item details UI:

Now with eBay Finding/Shopping/Trading API proxy as SDK and the demo app as template, you may create whatever eBay application you can think of, just let loose your imagination!

You can get the whole source of the enhanced App here, Note, before you run the App, please fill in your eBay AppId and auth token in the ConfigFactory class.

Comments