Solved

What structure should file saving take?

Posted on 2007-11-16
6
183 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 22
allswap challenge 6 99
servlet doXXX methods 3 51
printf performancy 11 44
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

831 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