Meaningless Drivel is fun!*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Cart vs Order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Cart vs Order" Watch "Cart vs Order" New topic
Author

Cart vs Order

fahd helwani
Ranch Hand

Joined: Jul 18, 2006
Posts: 63

Hi guys,

as I'm finalizing my assignment solution I got this doubt that I need some help clearing it.

I've got a SFSB that represents a shopping cart, and I've added an entity bean that represents an order. each of these two classes has its own relations to other objects, what I'm thinking about is if I can remove the shopping cart class and consider a shopping cart an instance of Order class that is not yet paid for (or persisted), and do the needed changes to the type of this class so it can be persisted, would you consider this as good condensed design approach?

I feel that keeping two classes for shopping cart and order is redundant to some extent: they both share similar qualities and functionalities, although also keeping them separate is a practice of separation of concerns.

what do you think guys?

SCJP 5 (80%), SCWCD 5 (85%), SCBCD 5 (80%), CAPM, SCEA/OCMJEA
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

What makes them the same? The fact that they share data? I can think of methods that would be different between the two. For example, you can't remove an item from an order or ship a shopping cart.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Yegor Bugayenko
Ranch Hand

Joined: Feb 11, 2011
Posts: 64
Fahd, I did exactly as you are saying. Class Order is JPA persistent, and is managed by stateless session bean. This mechanism is more scalable since SFSB are not as scalable as HTTPSession.


follow me at yegor256.com
fahd helwani
Ranch Hand

Joined: Jul 18, 2006
Posts: 63

thank you guys for your feedback,

I kept these two classes separate, that's cleaner than having these two as one class.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cart vs Order
 
Similar Threads
Ordered List
Storing pairs of objects
Current best practice for handling collections of EntityBeans
Any Solution to Break/Overlook the Session Variables ?
Problem using Browser Back or Refresh