AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

simple persistence without databases

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
slothbear
Guest





PostPosted: Tue Mar 08, 2005 7:52 pm    Post subject: simple persistence without databases Reply with quote



I have a simple application that has been using standard serialization
for the save format. I have a small user community; no one has
complained about the save format breaking with each new version
(because I change class structure). But ... it is kind of
unprofessional and I would like to fix it.

A "real" database looks like overkill. Some of the smaller options
(M.A.O.S., db4o) look interesting, but they are still kind of
heavy/complicated for my little program (which is currently 88K).

My current plan is to save one big Map, which will contain an
assortment of smaller Maps with simple types. That will get rid of the
class structure dependency. Much of the data are already in Maps (of
simple types), so the save/load code will not have to do much juggling
of values.

Does that sound like a reasonable plan, or has my searching/researching
overlooked a more simple method?

thanks!

Back to top
Manuel J. Goyenechea
Guest





PostPosted: Tue Mar 08, 2005 10:08 pm    Post subject: Re: simple persistence without databases Reply with quote



You may want to take a look at Servertec Persistent Object Store (POS).
www.servertec.com/products/pos/pos.html

"slothbear" <farbot (AT) gmail (DOT) com> wrote

Quote:
I have a simple application that has been using standard serialization
for the save format. I have a small user community; no one has
complained about the save format breaking with each new version
(because I change class structure). But ... it is kind of
unprofessional and I would like to fix it.

A "real" database looks like overkill. Some of the smaller options
(M.A.O.S., db4o) look interesting, but they are still kind of
heavy/complicated for my little program (which is currently 88K).

My current plan is to save one big Map, which will contain an
assortment of smaller Maps with simple types. That will get rid of the
class structure dependency. Much of the data are already in Maps (of
simple types), so the save/load code will not have to do much juggling
of values.

Does that sound like a reasonable plan, or has my searching/researching
overlooked a more simple method?

thanks!




Back to top
dar7yl
Guest





PostPosted: Tue Mar 08, 2005 10:45 pm    Post subject: Re: simple persistence without databases Reply with quote



"slothbear" <farbot (AT) gmail (DOT) com> wrote

Quote:
I have a simple application that has been using standard serialization
for the save format. I have a small user community; no one has
complained about the save format breaking with each new version
(because I change class structure). But ... it is kind of
unprofessional and I would like to fix it.

A "real" database looks like overkill. Some of the smaller options
(M.A.O.S., db4o) look interesting, but they are still kind of
heavy/complicated for my little program (which is currently 88K).

It may seem like overkill now, but later, after you have used
databases for a while, you will wonder how you got along
without them.

Using databases does involve a learning curve. You have to
figure out SQL, jdbc, tables, columns, rowsets, user passwords
and logins, prepared statements, and other complications.

However, using a database can add a whole new dimension to your
application. For instance, you appear to be saving the application's
state in one "chunk" per user. With a relational database, that
state can be saved over a number of tables/rows. Only the portions
of the state that have been changed need be updated to the database.

I personally use MySQL. It is easy to install and maintain, and is
efficient in terms of computer resources used. It is fairly efficient for
small datasets, and has good performance for very large databases.

As an aside, I would discourage the use of serialization for external
state storage for precisely the reasons you have given - it is hard to
control revisioning. It is better to define an external storage format
(with provision for future expansion) and explicitly code for that
interface. (IMHO)

regards,
Dar7yl





Back to top
slothbear
Guest





PostPosted: Tue Mar 08, 2005 11:19 pm    Post subject: Re: simple persistence without databases Reply with quote

Thanks for the thoughts. I have been learning MySQL, but had not
thought to use it for this project so far (since it is a standalone
application for each person that uses it).

If I understand your idea of an external storage format -- that is
approximately what I was proposing by serializing a Map of Maps and
simple types -- although I suppose I could still get in trouble if the
definition of Map ever changed.

Back to top
Robert Klemme
Guest





PostPosted: Wed Mar 09, 2005 1:50 pm    Post subject: Re: simple persistence without databases Reply with quote


"slothbear" <farbot (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1110311527.226614.104670 (AT) f14g2000cwb (DOT) googlegroups.com...
Quote:
I have a simple application that has been using standard serialization
for the save format. I have a small user community; no one has
complained about the save format breaking with each new version
(because I change class structure). But ... it is kind of
unprofessional and I would like to fix it.

A "real" database looks like overkill. Some of the smaller options
(M.A.O.S., db4o) look interesting, but they are still kind of
heavy/complicated for my little program (which is currently 88K).

My current plan is to save one big Map, which will contain an
assortment of smaller Maps with simple types. That will get rid of the
class structure dependency. Much of the data are already in Maps (of
simple types), so the save/load code will not have to do much juggling
of values.

Does that sound like a reasonable plan, or has my searching/researching
overlooked a more simple method?

Yes, I think so. Please take a look at XML bean serialization. That way
it's human readable (well, sort of) but more important so, you can load
old configs with new classes. And as long as you just add members, you
don't have to do anything to read the old config. I guess it becomes more
complicate if you rename fields etc.

http://java.sun.com/products/jfc/tsc/articles/persistence4/

http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLDecoder.html

Kind regards

robert


Back to top
slothbear
Guest





PostPosted: Thu Mar 10, 2005 2:04 am    Post subject: Re: simple persistence without databases Reply with quote

Thank you for the information about XML bean serialization. That looks
very promising. I am finishing up the review of my data model, and am
still open to other ideas and suggestions.
<sb>

Back to top
ableofhighheart@gmail.com
Guest





PostPosted: Fri Mar 11, 2005 8:06 pm    Post subject: Re: simple persistence without databases Reply with quote

You might also wanna try XSream for xml serialization.
http://xstream.codehaus.org/

Doni Ocena

Back to top
slothbear
Guest





PostPosted: Sat Mar 12, 2005 5:07 am    Post subject: Re: simple persistence without databases Reply with quote

Wowwee..... XStream may be even better for me than XML beans ...
especially since my objects are not already coded as beans.

I just experienced the advantage of a human-readable format with my
brief test of XStream. Even though I used a small data set, I got over
600 lines of XML -- which did not seem right. A glance at the file
showed many copies of my 40-color palette -- which I had forgotten to
mark as static.

thanks tons!

Back to top
frebe
Guest





PostPosted: Sat Mar 12, 2005 6:08 am    Post subject: Re: simple persistence without databases Reply with quote

Hypersonic SQL (http://hsqldb.sourceforge.net) has a footprint of 260K.
I think that can be considered as acceptable in your case. (Rememeber
that java itself has a footprint > 10MB).

Fredrik Bertilsson
http://butler.sourceforge.net

Back to top
slothbear
Guest





PostPosted: Tue Mar 15, 2005 4:21 am    Post subject: Re: simple persistence without databases Reply with quote

I would like to do some fairly complex queries as my application
evolves ... and would like to offer query support to my users too.
Since SQL is such a standard, I will definitely look into using
Hypersonic SQL.

The footprint is an interesting topic. Some of my customers use my
product because they only have a dial-up connection, and 88K is easy to
download. They are frequently non-Windows users, and already have Java
as part of their OS. Another 260K should not break the bank though --
thanks for the suggestion.
<sb>

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.