Solved

What structure should file saving take?

Posted on 2007-11-16
6
182 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
Comment Utility
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
Comment Utility
(if you are transmitting it, XML would be better as you can define a schema)
0
 
LVL 2

Author Comment

by:amacfarl
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 35

Expert Comment

by:TimYates
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now