• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Service Locator and Transfer Object

 
Patrick Fong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have a question about the difference between SL and TO patterns. I'll grab the question word for word from the Whizlabs Exam Simulator.


Acme Inc decided to develop a swing application to access the central office data from branches all over the world. The central office would enter business data using this application and most branches would mostly read data over the network. The application would use EJB for accessing the enterprise data. One of the primary goals of the application is to provide faster response time at both the central and at the branch office.


The other goal is to reduce the application development time by developing the business and UI components in parallel without waiting for each other.


Ignore the second description, because that's easy - Business Delegate.

While analysing the question, I listed the key points -

  • read data
  • network access
  • EJB access
  • faster response time


  • Without the EJB access, I would be more inclined to pick TO over SL. But with the EJB and faster response time, I would pick SL.

    Can you pick out the differences over the two patterns? Are the two factors previously mentioned not the differences between SL and TO?

    From the core J2EE patterns site - the consequences for SL
  • Improves network performance
  • Improves client performance by caching



  • Cheers
    Patrick
     
    udaykumar maddigatla
    Ranch Hand
    Posts: 69
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Service locator will try to handle the complex look up kind of things and there is a possiblity to handle the look up exceptions.

    Transfer Objects are used to act as a duplicate copy of the model class(java beans or entiry beans).

    With the Transfer Objects we can improve response time but stale data will be there.

    With Service Locator we can improve the business logic by avoiding the complex look up data from Business Delegate.

    Simple trick find the answers on Desing Pattern questions.
    1)If we find terms called Network Traffic or response time or stale data----Look for Transfer Object option
    2)If we find terms called separation of lookup or JNDI realted terms or improve maintenance---Look for Service Locator.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic