Re: Prevalence and Web Applications

Paul Bennett <[email protected]> Tue, 18 Dec 2012 13:47:10 -0500
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
In our system (which is a bit different from a normal Prevayler application, since we do everything generically), an edit form is bound to an edit buffer object, which
is then submitted via an immutable edit transaction. This contains enough information to update the target object from the buffer.

-pb

On Dec 17, 2012, at 5:39 PM, Elmar Weber wrote:

> Hi Paul,
> 
> using the Command as an UI Binding was also an option I thought about, 
> only a small theoretical problem I had with it was, that by my 
> understanding a command should be immutable after creation!?
> 
> But yeah, so basically a different object is used for the UI bindings 
> than the business object, using the command to do this reduces the 
> mappings and puts the validation for an operation into the same place 
> (where it belongs).
> 
> I'm evaluating this currently with Scala, I think a meta programming 
> facility for a generic solution will come with the next version, 
> currently this could be solved via traits in an easier way.
> 
> Thanks & ciao,
> Elmar
> 
> On 17.12.2012 14:28, Paul Bennett wrote:
>> Prevayler is built around the idea that all transformations on
>> business objects are done by transactions - real objects that are
>> submitted to Prevayler for execution. These contain all information
>> needed to execute the transformation.
>> Therefore, a web screen is often bound to a (new) transaction object,
>> not a domain object. For an edit operation, this will often be the
>> set of editable fields for the domain type, so often looks like a
>> domain object - but it is not. It will also contain a domain
>> reference to the object (to avoid the baptism problem) and should
>> also contain consistency logic - e.g for an edit operation, a check
>> that the object being edited has not been changed by someone else
>> after this edit operation was started (and the object read), but
>> before it was committed. This is directly analogous to multi-version
>> concurrency control in a conventional database
>> 
>> This can often be implemented generically, especially in a language
>> that provides good meta-programming protocols (Groovy, Ruby,
>> Smalltalk etc.). This removes the need for a specific edit
>> transaction for each domain type
>> 
>> Hope this helps,
>> 
>> Paul Bennett
>> 
>> On Dec 15, 2012, at 7:13 PM, Elmar Weber wrote:
>> 
>>> Hi,
>>> 
>>> I've a question how people use Prevalence or prevayler in web
>>> applications. Here is a simple scenario and then the question where
>>> my problem is:
>>> 
>>> A simple multi user application to edit a shared data pool, e.g. a
>>> customer management system where users can search for customers and
>>> then edit single objects in a multi page form.
>>> 
>>> How do you handle modifications to customer objects in the UI part
>>> of the web application? Your typical Java web framework binds the
>>> UI fields to your object and updates it continuously (e.g. via ajax
>>> requests) until the user saves the changes and persists the
>>> object.
>>> 
>>> The way I see it, it is not possible to do this with prevalence,
>>> i.e. I cannot use the object I received from a query for a customer
>>> in the UI because any changes would be saved in a snapshot since it
>>> is the same instance. I either have to create a copy of the
>>> persisted object or have a different set of objects for my UI. Both
>>> solutions seem like a workaround to me.
>>> 
>>> When solving this with classical ORM persistance, e.g. Hibernate
>>> and a database, its easy to use the same objects and don't worry
>>> about modifications until an explicit commit on the transaction.
>>> 
>>> How do you solve this with web applications using prevalence?
>>> 
>>> Thanks & ciao, elm
>>> 
>>> ------------------------------------------------------------------------------
>>> 
>>> 
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>>> Remotely access PCs and mobile devices and provide instant support
>>> Improve your efficiency, and focus on delivering more value-add
>>> services Discover what IT Professionals Know. Rescue delivers
>>> http://p.sf.net/sfu/logmein_12329d2d
>>> _______________________________________________ To unsubscribe go
>>> to the end of this page:
>>> http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
>>> _______________________________________________ "Databases in
>>> Memoriam" -- http://www.prevayler.org
>> 
>> -pb
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> 
>> 
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add
>> services Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________ To unsubscribe go to
>> the end of this page:
>> http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
>> _______________________________________________ "Databases in
>> Memoriam" -- http://www.prevayler.org
>> 
> 
> 
> -- 
> "Religion und Familie sind die beiden größten Feinde des Fortschritts."
> (André Gide (1869 - 1951), französischer Schriftsteller)
> 
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org

-pb



------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org