Solved

What structure should file saving take?

Posted on 2007-11-16
6
187 Views
Last Modified: 2010-03-30
I am currently developing a standalone application that will have the following structure:

File
General Information
         - Group 1
      - Table 1
      - Table 2
      - Notes
                   > Group A
                 -Table
                 -Notes
                 -Pictures
        - Group 3
      - Table 1
      - Table 2
      - Notes
         - Group 4
      - Table 1
      - Table 2
      - Notes

(note – there can be up to 30 groups)

At the moment all the above are all stored as arrays, vectors, variables etc..  

The application will have functionality to import specific elements – e.g. Table 1 in File 1 being imported/reused in File 2.

I have developed database applications in the past and the nature of this application does not lend to a DB.  Any thoughts on the best way to “SAVE” this information?  I.e. Text File, Custom File etc?

Thanks
Angus

0
Comment
Question by:amacfarl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 20298000
As it's a tree structure, it would tend to lend itself to XML or JSON or some other tree structure based format in my opinion...

Especially if more than one application is going to need this file or you are going to be transmitting this file across the network to another service
0
 
LVL 35

Expert Comment

by:TimYates
ID: 20298007
(if you are transmitting it, XML would be better as you can define a schema)
0
 
LVL 2

Author Comment

by:amacfarl
ID: 20298058
Sorry... misunderstanding.  It is not a tree structure, the structure above is purely to illustrate the object hierarchy.  eg. Group1 is a class that contains several tables, pictures, and other classes which also contain tables, pictures etc..

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:TimYates
ID: 20298104
Yeah, so that can be thought of logically as a tree of objects...

ie:

Group 1 contains tables
    each table contains other objects

etc...

Or am I missing the point entirely?  (it's very possible as it's a Friday, and my head is swimming with work-based javascript at the moment) ;-)
0
 
LVL 2

Author Comment

by:amacfarl
ID: 20299000
Thanks Tim for getting back to me.  

My thoughts on using XML or JSON is that it requires effort to create a file structure and parse it and load it etc. etc.  it is also something that is readiable and editable by notepad which causes a problem.  The tool that I am developing is going to be used by IT professionals and they will start playing with the contents of the file outside the program - thus it means that further effort will be required to develop validation etc.. etc.

A few years ago (in the 90's :-)) I developed a program that simply saved the objects directly.  I recall having a method that I simply past it the object and it saved it.  Serialiazation i think.  If so, what are your views?

Thanks
Angus

P.S  Bring on the weekend.... sitting in an Airport lounge about to take my 6th flight this week.... only one more after this!!!!!

0
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 20299433
The only worry I have with serialization is that it is not guaranteed to work over different versions of your application unless you're careful

It can be handled by being careful with changing your core classes, but if it goes wrong it's hard to fix as the serialized files are binary...

A framework like XStream* may help here

http://xstream.codehaus.org/

It serializes java objects to XML, so gives you all the ease of serialisation, but with all the hackableness of xml ;-)

Tim
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question