Re: Work on Release 2.6: Maven Archetype and Tutorial Examples
Naveen Chawla <[email protected]> Sun, 20 Jan 2013 03:21:07 +0000
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <CAGs7EcW9CvNHr4zJR_=yjH7XEAYXMW-pBrVmHijM5gYLJXvBJw@mail.gmail.com> |
I'd also prefer the word "prevalentObject" (& "Prevalent Object") in the
JavaDocs/manual/source code because "prevalentSystem" doesn't seem as
specific to me.
I'd like the manual to occupy as few words as possible and be entirely
after the "What is Prevayler?" paragraph on the Prevayler home page itself
(Heading logo -> What is Prevayler? -> Code examples & guide -> Links). I'd
like the manual's code examples to not go beyond a simple class with a
boolean. It can be explained or just implied by the context that it scales
to any & every complexity:
"What is Prevayler?
<omitted> ... is the simplest and fastest way to provide ACID persistence
for your "plain old Java objects".
Code examples & guide
To persist an instance of
class MyData implements Serializable{
boolean on = false;
}
create a Prevayler for it:
Prevayer<MyData> prevayler = PrevaylerFactory.createPrevayler(new MyData());
and ensure any changes to it are done via the prevalentObject variable in
Transactions:
//create a Transaction class
class SwitchOn extends Transaction<MyData>{
public void executeOn(MyData prevalentObject, Date date){
//perform changes to prevalentObject here
prevalentObject.on = true;
}
}
//execute the Transaction:
prevayler.execute(new SwitchOn());
To pass arguments to a Transaction:
//create a Transaction class with one or more instance members
class Switch extends Transaction<MyData>{
boolean on;
public Switch(boolean on){
this.on = on;
}
public void executeOn(MyData prevalentObject, Date date){
prevalentObject.on = this.on;
}
}
//execute the Transaction
prevayler.execute(new Switch(false)); //can be "false" or "true"
To perform a Transaction with a query:
//create a TransactionWithQuery class
class SwitchOnAndGetPrevious extends TransactionWithQuery<MyData, Boolean>{
public Boolean executeOn(MyData prevalentObject, Date date){
boolean previous = prevalentObject.on;
prevalentObject.on = true;
return previous;
}
}
//perform the TransactionWithQuery
boolean previous = prevayler.execute(new SwitchOnAndGetPrevious());
<Taking a snapshot when it would speed up recovery>
etc."
Also I think there should be a straight .jar download for people who don't
use Maven.
The javadocs should only show the public API, not any internal classes, in
my opinion.
On 19 January 2013 14:34, Klaus Wuestefeld <[email protected]> wrote:
> Naveen, I agree with all you said.
>
> On Fri, Jan 18, 2013 at 10:47 PM, Naveen Chawla <[email protected]>
> wrote:
> > If included, e105 should come before e103 as it's more basic.
> >
> > If "Entity" is changed to "Person", "Root" should be changed to "Club".
> >
> > I've always disliked the "baptism/initiation problem" description. First
> of
> > all, it's not really a "problem", it's just the knowledge that nothing
> > outside the "prevalentSystem" variable can reference anything in the
> > Prevalent Object upon recovery execution, so I remember it by 3 simple
> > words:
> >
> > "Stick to "prevalentSystem" ".
> >
> > That's all the user has to do.
> >
> > Both the "baptism/initiation problem" and e105 are derived from this very
> > simple principle, and so should probably say so.
> >
> > I don't like it being described as a "common problem". It's not common or
> > even likely if the manual articulates "stick to "prevalentSystem" ".
> >
> >
> ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > MVPs and experts. SALE $99.99 this month only -- learn more at:
> > http://p.sf.net/sfu/learnmore_122912
> > _______________________________________________
> > To unsubscribe go to the end of this page:
> > http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> > _______________________________________________
> > "Databases in Memoriam" -- http://www.prevayler.org
> >
>
>
>
> --
> Valeu, Klaus.
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> To unsubscribe go to the end of this page:
> http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org