Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Persistant State

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Could you please explain what a Persistant State means.
Thank You .................
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The concept of persisting state is simply to somehow remember the state of something for later retrieval and use.
For example, the JavaServer Faces framework has as one of its features the ability to persist the state of a GUI beyond a single interaction with a user. In other words, if you're working with a GUI of some app that uses JavaServer Faces, this framework allows the developer to program the app such that it will remember changes you, the user, have created to the GUI.
Another contrived example might involve my bank account. When I use an ATM, it retrieves the state of my bank account (which is always some balance below what I want it to be) and allows me to change it in various ways. When I've finished with my account manipulations, the ATM and the banking system persist (remember) the new state of my account for later use.
If you're having trouble understanding how this concept applies to a particular situation, perhaps you could explain a bit about the context that you're trying to understanding these things in.
 
Igor Ko
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example you save input strings in your program into ArrayList.
After this you close the program, and run again.
Oopps - you check the ArrayList and see that now it's empty.
You can create some special version of List that save somehow
data into disk (file, database), and have code to restore the data
at time of creation instance of the List.
Now after restart the program - you can see saved in previous
session, strings.
Now the object is persistent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic