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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Object Model Design

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi All,

I have an Object Model Design question and would like to brainstorm with you guys.

Users can View/Add/Delete a list of Security Instrument(with unique key) from GUI. I would like to construct an Object Model so that it will perform a diff action between Retrieved List and Modified List of Instrument Objects once user hit the save button from GUI, and the Model should return how many records that I should delete/insert or Do Nothing. For example, the list might contain Google, CITI and Microsoft originally, and then the user modified the list so that CITI was removed and GE was added.
What's the best way to implement such Data Model ? Should I override the Comparable Object and Implement my diff logc in there ?

Please let me know you thoughts, thanks.


Cheers,


Transistor
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I don't think you need to implement Comparable.
In my opion, overrides equals() hashCode(), then all you need is a utility, which could tell what is the difference between retrieved set and the modified set.
 
YuenLian Wu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
So under what kind of circumstances should I should Comparable Object?
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
YuenLian,

Comparable is really most useful when there is the concept of a greater-than/less-than/equals between two objects of a class.

John.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Do not cross-post the same question in multiple forums.
Lets continue the discussion in this thread.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic