• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question on design  RSS feed

Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one important Question on Vectors.
1.I c that most of them using 2 dimensional array for Data storage. Iam using Vectors for storing entire Db ,storing flight info , origin, destination details for combo boxes, then for storing search results.
Is there any issue with Vectors or i have to think abt better Data structure or 2 dimensional array is preferrable?
2. For Quering, iam planning to store the data in Vector on the Server. loop thru it for my queries get the record nos. Then connect to file for getting latest seat information.
i think this design will reduce IO reads, performance will be good.
another soln is pass the data to client. let client browse the vector for record nos. pass the record nos to server. server will browse the file to get the new seats.
second approach reduces the work load for server, reduces network traffic but makes client as fat client.
I prefer approach 1. someone pls comment on this design.
Mark Spritzler
Posts: 17309
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I started my assignment I used Vectors and Hashtables, since I knew them really well. But those are from the old version of Collection use. There is a new Collections API that will do alot better job.
Vectors are automatically Synchronized, which can have a performance hit.
Changing from Vector to ArrayList will help, and keep your learning curve low, becuase ArrayList is very much like Vector with a lot of the same Method names and signatures.
Instead of Hashtable use HashSet.
As far as the design. That's a tough question, in that if you have a good argument for your design, and are sure you can do whatever you want. But, I think that keeping the data in a Vector, or in any other class than what is already there is redundancy. All the work for the Data will be done by the server, if you use Remote Objects. This will reduce network traffic. the client stays Thin, and we are all happy
The Data, DataInfo, FieldInfo classed handle all the storage of the data for you, and provide enough access for you to do searches on the server side, and only pass an array of DataInfo classes for your client. You can have your custom JTableModel have a method that accepts DataInfo[] and put them into columns and rows of the JTable, it is really pretty easy.
Hope that helps you down a road. a good road
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!