• Post Reply Bookmark Topic Watch Topic
  • New Topic

Vectors of vectors vs vectors of beans for storing data, advantages and disavantages  RSS feed

 
Rafa Moreno
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm updating a system, it's not my design. I found a lot (really a lot!!!) of vectors of vectors and I need to go to a list of constants to know about the data based on the vectors indexes, my question is what are the advantages of using vectors of vectors over vectors of beans.


Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing really; Vectors of Vectors allows you to change properties of the collection without altering the code much, but it sounds like dreadful design to me. Perhaps someone has tried to get Java to behave like a scripting language? Also, why are you using Vectors at all? Do you need the synchronization?
 
Rafa Moreno
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't need synchronization, the application is a point of sale and the data stored in memory are the header and detail of the invoices (well and the discounts, customers details, products, etc, mostly all in vectors of vectors inside beans that give me a headache every time I need to find some info ), one example is the invoice itself, the header data is detailed at bean level, but the detail is a vector of vectors. I want to change it to a more object oriented app, what do you think could be a good design?

thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In theory, yes. I'm being a bit cautious here however since I don't have the whole picture of your requirements and I'm assumign no one would deliberately introduce what on the surface sounds like a deradful bit of design without some sort of justification.

One thing that comes to mind: do you know all the fields an invoice detail will contain, or is this changeable? If you don't this perhaps explains the less OO approach.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!