Search

Aparna Chaudhary Blog

My Blog about Java, and Open Source

Month

February 2009

Beauty of Spring Batch

Spring source community is coming up with spring batch 2.0 in Q2-2009. Spring batch is the first java based framework for batch processing. I think the decades of experience of Accenture in enterprise batch processing really helped for defining the use cases.

Most of the batch applications need to process high volume business critical transactional data. While doing so some set of non functional requirements (NFR) are sort of mandatory in such applications. These NFRs include performance, scalability, restartability, repeatability. I worked with couple of investment banks and my experience says that such batch applications are developed based on either Messaging model or Multi-threading model. Lot of efforts and time is spent by architects, developers and testers in building this robust infrastructure for batch processing. Also we cannot overlook the cost involved. Whenever you move across projects, you end up creating your own batch processing framework. Sigh!!

Some nice features that are introduced in Spring Batch 2.0 are conditional step execution, finer metadata access control and chunk based processing. To perform chunk based processing, we need to configure the commit-interval in a step. The transaction is committed after number of items specified in commit-interval are processed.

<step id="step1" job-repository="jobRepository" transaction-manager="transactionManager">
      <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"/>
</step>

Given the features provided and use cases handled by Spring batch, it can prove to be the de-facto framework for enterprise batch applications.

Mate vs Cairngorm

I’ve recently been comparing frameworks for Flex event handling. We are already using Mate in one of our projects. I encountered couple of problems in the usage and thought of exploring other frameworks available on the shelf.

Here are some Pros and Cons of both the frameworks:

Mate:

Pros:

  • Tag based event driven Flex framework
  • Declarative way of Event management
  • Custom Events are inherited from default Flash event; no framework code in the application
  • Uses the event-bubbling to catch the events with the EventMap without defining a bunch of wiring code

Cons:

  • State changes are to be notified explicitly to all the associated views by making use of property injection
  • Application can fail silently when you inadvertently misspell the name of the event parameter; compiler checking on tags in EventMap is missing
  • Chances of bloated MXML file since the Event dispatch logic is composed into the MXML

Cairngorm:

Pros:

  • Singleton Model – Uses Observer pattern to refresh all associated views on state change
  • Command Pattern – Clearly defines the Unit of Work. Reduces chances of bloated MXML files
  • Introduction of Business Delegate can expedite development process in projects with different teams for Client and Server implementation. Delegate can be mocked by the client development team to return dummy data.

Cons:

  • Makes codebase bit verbose
  • Custom events are inherited from CairngormEvent which introduces tight coupling between the application and the framework code

As per me, Cairngorm is more suitable for enterprise application development with huge development teams. Use of command pattern can really expedite the development process. Mate on the other hand is more suitable for small applications. However, I would expect one improvement in Mate to add compiler checking on tags in EventMap. Sometimes it really sucks when you realise there are some typos only at the runtime when you application breaks.

References:

http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html

http://mate.asfusion.com/

Blog at WordPress.com.

Up ↑