• 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:
  • 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 Design Question

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • 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
 
author & internet detective
Posts: 42134
937
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
YuenLian,
Is that comparison logic the logic you would always use? If so, your approach sounds good. (I'd implement equals and hashCode for consistency.) If not, you would be better to use a Comparator that you pass into the list/map for one time use.

I notice you are in the performance forum and not the design forum. I'll move this for you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic