• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Cart vs Order

 
Ranch Hand
Posts: 75
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
fahd helwani
Ranch Hand
Posts: 75
Android Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you guys for your feedback,

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

 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic