Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread Vince Refiti
Hi

This brings up some questions I have been meaning to ask for some time. The 
sentence "When the Pharo image crashes (which will happen), there must be a way 
to automatically recover from this crash." appears in the Enterprise Pharo 
Book. 

Does this claim still apply? Is Pharo that unstable still?

If it is, what are the major causes in your own applications that crash it? I 
have run a few small, local, experimental Teapot, Seaside and other Pharo 
server apps and nothing crashed, but reading something like that makes me 
nervous about public-facing server apps in Pharo.

Vince

-Original Message-
From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
Pierce Ng
Sent: Friday, 11 October 2019 12:39 PM
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] Running a teapot instance remotely

EXTERNAL: Do not click links or open attachments if you do not recognize the 
sender.

On Thu, Oct 10, 2019 at 04:18:14PM -0400, sergio ruiz wrote:
> How are people keeping it running these days?

I used to use daemontools. These days I use Docker.

Pierce



Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread Pierce Ng
On Thu, Oct 10, 2019 at 04:18:14PM -0400, sergio ruiz wrote:
> How are people keeping it running these days?

I used to use daemontools. These days I use Docker.

Pierce



Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread Paul DeBruicker
I use daemontools. Some people use Monit.

Sven made these for Pharo4 on Ubuntu 14.04 when Pharo was only 32 bit:

https://github.com/svenvc/pharo-server-tools

I'm sure you could edit those scripts to work for 64bit Pharo 7/8 on 64 bit
linux



And there is this chapter about deploying apps to production

https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/DeploymentWeb/DeployForProduction.html



sergio_101 wrote
> This worked perfectly!
> 
> To keep this running, I am running it in tux, so it will keep running when
> I log out.
> 
> How are people keeping it running these days?
> 
> Thanks!
> 
> 
>> On Oct 10, 2019, at 3:46 PM, Tim Mackinnon 

> tim@

>  wrote:
>> 
>> Sergio - looking at the last time I did this, my run script did:
>> 
>> 
>> 
>> 
> 
> 
> peace,
> sergio
> photographer, journalist, visionary
> 
> Public Key: http://bit.ly/29z9fG0
> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
> @

> sergio_101@

> https://sergio101.com
> http://www.codeandmusic.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
> 
> 
> 
> signature.asc (849 bytes)
> http://forum.world.st/attachment/5105321/0/signature.asc;





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread sergio ruiz
This worked perfectly!

To keep this running, I am running it in tux, so it will keep running when I 
log out.

How are people keeping it running these days?

Thanks!


> On Oct 10, 2019, at 3:46 PM, Tim Mackinnon  wrote:
> 
> Sergio - looking at the last time I did this, my run script did:
> 
> 
> 
> 


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread Tim Mackinnon
Sergio - looking at the last time I did this, my run script did:




pharo /home/app/PagerDuty/PagerDuty.image --no-default-preferences run.st


This was using sysctrl (from memory - but this line was what was run.)

The run.st was

1
2
3
4
5
6
7
"Simple application run script"
Transcript cr; cr; nextPutAll: 'Resetting server...'.
WPPagerDutyApp startForProduction: 8080.
Transcript cr; nextPutAll: 'Complete.'.


If you want to see my build script and deploy pipeline it’s in this simple 
project:

https://gitlab.com/macta/WillowPagerDuty/blob/master/scripts/run.st


Tim

Sent from my iPhone

> On 10 Oct 2019, at 19:46, sergio ruiz  wrote:
> 
> Hi, all.
> 
> I am running my teapot instance remotely, but I’m not sure how to start it up.
> 
> Just for testing, I am trying this:
> 
> ./pharo LunchPicker.image eval "server := PickerServer serveOn: 3200. server 
> start” &
> 
> But no luck.
> 
> ideas?
> 
> Thanks!
> 
> 
> 
> peace,
> sergio
> photographer, journalist, visionary
> 
> Public Key: http://bit.ly/29z9fG0
> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
> @sergio_101@mastodon.social
> https://sergio101.com
> http://www.codeandmusic.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
> 


[Pharo-users] Running a teapot instance remotely

2019-10-10 Thread sergio ruiz
Hi, all.

I am running my teapot instance remotely, but I’m not sure how to start it up.

Just for testing, I am trying this:

./pharo LunchPicker.image eval "server := PickerServer serveOn: 3200. server 
start” &

But no luck.

ideas?

Thanks!



peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [Pharo-users] Deploy a Pharo 8 application remotely

2019-10-10 Thread sergio ruiz
This is PERFECT! thanks!



> On Oct 10, 2019, at 2:19 PM, Alistair Grant  wrote:
> 
> curl https://get.pharo.org/64/80+vm  | bash


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [Pharo-users] Deploy a Pharo 8 application remotely

2019-10-10 Thread Alistair Grant
Hi Sergio,

On Thu, 10 Oct 2019 at 20:14, sergio ruiz  wrote:
>
> Hey, all..
>
> I put together a quick REST interface to use internally here.
>
> It’s ready to launch to a production server, and I’m not sure how to set it 
> up on the remote server.
>
> The current zeroconf downloads and sets up a Pharo 7 instance.
>
> What I would like to do is set up Pharo 8 on the remote server, and just 
> replace the image and changes with mine, and start up the Teapot server  
> remotely.
>
> I usually just use rsync to update the remote image and changes files, but I 
> am not sure how to go about getting the correct setup to run the correct 
> (Pharo 8) interpreter remotely.
>
> I tried doing:
>
> curl https://get.pharo.org/64/80 | bash
>
> But this brings down only the changes and image files down.. no pharo-vm.

curl https://get.pharo.org/64/80+vm | bash

for the vm + image

curl https://get.pharo.org/64/vm80 | bash

for just the VM.

> will the pharo-vm that runs pharo 7 also run pharo 8?

Sometimes, but in general it is safer to assume that they're different.

HTH,
Alistair



[Pharo-users] Deploy a Pharo 8 application remotely

2019-10-10 Thread sergio ruiz
Hey, all..

I put together a quick REST interface to use internally here.

It’s ready to launch to a production server, and I’m not sure how to set it up 
on the remote server.

The current zeroconf downloads and sets up a Pharo 7 instance.

What I would like to do is set up Pharo 8 on the remote server, and just 
replace the image and changes with mine, and start up the Teapot server  
remotely.

I usually just use rsync to update the remote image and changes files, but I am 
not sure how to go about getting the correct setup to run the correct (Pharo 8) 
interpreter remotely.

I tried doing:

curl https://get.pharo.org/64/80 | bash

But this brings down only the changes and image files down.. no pharo-vm.

will the pharo-vm that runs pharo 7 also run pharo 8?

Thanks!


peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [Pharo-users] How to install stripe library on Pharo 7 64bit ?

2019-10-10 Thread Paul DeBruicker
Hi JAmes,


OK I updated the baseline several more times and it now loads into Pharo

Metacello new 
 baseline:'Stripe'; 
 repository: 'http://smalltalkhub.com/mc/pdebruic/Stripe/main';
 load:#('Dev') 






Pharo Smalltalk Users mailing list wrote
> Hi Paul,
> 
> Thanks for the update.  I tried your new code and it went futher than last
> time.  However the debugger shows up during cleanup and the entire image
> hangs.  I've attached a screenshot.
> 
> I also retested this with a completely fresh image using pharolauncher
> with
> the same results.
> 
> -James
> http://forum.world.st/file/t372299/stripe_install_on_Pharo_7.png; 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread PBKResearch
Hi Jonathan

 

If you are interested in OmniBase on Pharo, there was a port by Sebastian 
Sastre in about 2010, which was forked and updated by Esteban Lorenzano in June 
2018 (https://github.com/estebanlm/OmniBase). There were a few bugs in the 
port, which were sorted out by Matias Maretto, ma...@omeleon.de 
  and myself. I have all these corrections in my local 
repo, but they have never been ported back to Esteban’s github repo, because I 
don’t know how to do it. So do not use Esteban’s repo until updated.

Esteban’s port was for Pharo 6, and in the case of marco and me was only tried 
on 32 bits. If you decided to install on 64-bit Pharo 7, you would be on new 
territory. The only problems are likely to be interactions with the file 
system. As a quick test, I installed Omnibase and tests in 32-bit Pharo 7. One 
test (#testBTreeKeyLocking) was red, all the rest green – I have not yet traced 
the cause. 

The biggest problem is likely to be documentation. I have tried only the 
simplest uses, because that is all I can work out from the slide-show notes. 
Maybe someone else who has used it more extensively might still have fuller 
documentation – e.g. Bruno, who also contributed to this thread.

 

Peter Kenny

 

 

 

From: Pharo-users  On Behalf Of Jonathan 
van Alteren
Sent: 10 October 2019 11:39
To: Any question about pharo is welcome 
Subject: Re: [Pharo-users] voyage mongo and transactionality

 

Hi Peter, 

 

Thanks for your reply.

 

That sounds very interesting. For similar reasons, I tried to check out Magma. 
However, since I'm still a novice in Pharo/Smalltalk and it's not very well 
documented (and mostly refers to Squeak), it's quite painful to figure out how 
it works and how to get it going in Pharo. Not to mention actually using it in 
production for an 'enterprise' application for an actual customer... I haven't 
given that up yet, but currently don't have the time.

 

I will look into OmniBase. Anything you're willing to share about getting it up 
and running (in Pharo 7.0 64-bit) is greatly appreciated!

 

 

Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com  

On 9 Oct 2019, 20:34 +0200, PBKResearch mailto:pe...@pbkresearch.co.uk> >, wrote:



It may be irrelevant, but I have been playing recently with OmniBase, which is 
a fully object-oriented database system, now over 20 years old, but it still 
works very well for my uses. David Gorišek, the author, claims that it has ACID 
properties. From my reading, updates operate on a proxy object, which is not 
written to the database until an explicit commit is given. A second transaction 
accessing the same object will still see the original until the change is 
committed. What happens to a proxy which is never committed is not clear, but 
if Gorišek is right, the stored data can never be contaminated. I think a proxy 
in this sense is equivalent to a memento.

 

Thanks to Esteban Lorenzano, OmniBase is now available on Pharo. The code is 
ancient, there is no documentation and obviously no support, but it might be 
worth while for someone to try some software archaeology and put it to use. I 
have found it possible to create and maintain a small database of natural 
language information, and access is fairly quick and easy – and it’s all 
Smalltalk.

It claims to store all kinds of Smalltalk objects, except block closures, and 
skimming through the code it seems to incorporate a serializer similar to Fuel.

 

The only documentation I have found is a slideshow at  
 
https://www.slideshare.net/esug/omni-baseobjectdatabase. I have found out a few 
things about it, if anyone is interested.

 

Peter Kenny

 

 

From: Pharo-users <  
pharo-users-boun...@lists.pharo.org> On Behalf Of Norbert Hartl
Sent: 09 October 2019 18:08
To: Any question about pharo is welcome <  
pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] voyage mongo and transactionality

 

 


Am 09.10.2019 um 16:48 schrieb "  
jtuc...@objektfabrik.de" <  
jtuc...@objektfabrik.de>:

 

This is a tricky mine field. Sometimes you need a lot of business functionality 
in objects referenced in your objects that are currently in the editor. So I'm 
still to see a project in which the memento pattern really worked for more 
complex scenarios. How deep do you dive to have enough memento objects to 
provide the functionality needed. I guess you can do that with some sort of 
object-level transaction framework that automatically creates mementos of 
whatever object is being navigated to during some kind of processing-context. I 
guess slots could be of use here. But this is not trivial for general cases.

 

Yes it is tricky. You can have copies of business objects but 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi,

That clears up some things, and I understand how the 'cache' works now, thanks!

I did a little bit of research on the lifecycle of a Seaside session, but 
wasn't very successful. Largely because there is a lot of different/outdated 
documentation around, including class comments in Pharo, which has caused me to 
get lost 'in the woods'.

I haven't figured out exactly how the session expiration actually operates. The 
class comment of WASession mentions #defaultTimeoutSeconds or #expire, but both 
of these seem to be absent from Seaside. The WAExpirySession class only keeps 
some counters.

Can you perhaps point me in the right direction?

For example, which object manages the Seaside sessions and where can I find 
(and influence) the expiration behavior? How can I be sure that our WASession 
is properly cleaned up so it won't prevent domain model objects from being 
'released' from the weak dictionary that is used by the Voyage 'cache'?



Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 10 Oct 2019, 12:55 +0200, Norbert Hartl , wrote:
> Hi,
>
>
> Am 10.10.2019 um 11:48 schrieb Jonathan van Alteren 
> :
>
> > Hi Norbert,
> >
> > Thank you very much for your extensive answer.
> >
> > For starters, we would be happy to have an option available for the course 
> > grained handling that you mention. I'd be interested to hear if there are 
> > any options besides GemStone available to be used with Voyage/MongoDB.
>
> I think Gematone has a model that serves these use cases really well. In 
> Pharo there is not much that makes your life easy. But most of this problems 
> can be solved sufficiently kust not generically. Every use case has its 
> constraints and you can model a solution for it. The main problem in voyage 
> stays that the cache is per repository. We need to think along that line if a 
> session or request cannot get its private copy of the database object.
>
> > Your mention of the Mongo cache being a weak dictionary is very 
> > interesting, I did not know that (it doesn't seem to be documented). Yes, 
> > the Seaside sessions seem to be the path through which these objects remain 
> > referenced. When I inspect all instances of our session class, I see old 
> > session objects hanging around that still reference our root application 
> > component with the rendering tree containing various references to our 
> > domain model objects.
>
> You asked Esteban about the cache. I answer that here. Everybody stumbles 
> over the name cache and Esteban is reluctant to give it another name 
> The cache is only for establishing identity in the image. The basic thing 
> with objects in an external system is that its identity (location in the 
> heap) becomes an identity parameter like an id. So when you have externalized 
> objects and you load the object with the same id twice in the image you will 
> make sure that there will only be one object for it and the object from the 
> first query and from the second query are identical meaning comparing both 
> with == returns true. So the cache keeps the database reference and the 
> business object in a weak dictionary. If the object with the same id is 
> queried from the database it returns the object it already has. If the object 
> is not referenced anymore the entry will be removed from the cache. It is 
> nothing more than this.
> >
> > Can you tell me why the session objects don't get garbage collected?
> > Should we manually clean up our session object somehow?
> >
> I‘m not sure what you mean. If the session is not referenced than it just 
> means the garbage collector did not remove it. But this won‘t keep the cache 
> from removing the entry. But seaside sessions have an expiry time. So there 
> is a duration while seaside keeps referencing the session and therefor all 
> objects that are kept in the session are still connecte keeping the objects 
> in the voyage cache.
>
> > I must admit I'm a bit out of my comfort zone here, after working in Java 
> > for close to 20 years ;-) We explicitly don't want to use any relational 
> > databases for our own application (perhaps only for integrating with 
> > customer data). I still haven't fully integrated the conceptual differences 
> > in my mental model, about how to work with objects in an image based/object 
> > persistence environment.
> >
> > I did look into using a Voyage repository filter, which is mentioned (or 
> > buried deep I should say ;-)) in this post: 
> > https://pharoweekly.wordpress.com/2017/02/20/consortium-action-13-17-feb/. 
> > What if we were to use a dynamic variable like this for each session 
> > instance? Then at least each user will have her/his own cache. But that 
> > doesn't answer the need for a kind of rollback mechanism within the same 
> > Voyage cache/session. And then there is your comment about potentially 
> > having multiple copies of an identical object...
>
> As I told in my last mail. The session or 

Re: [Pharo-users] How to zip a WideString

2019-10-10 Thread Esteban Maringolo
On Wed, Oct 9, 2019 at 3:18 PM Sven Van Caekenberghe  wrote:
>
> Actually, thinking about the original use case, I now feel that it would be 
> best to remove #zipped/unzipped from String.

Please do. Cases like this teach us about the proper separation of concerns.

Regards,

--
Esteban



Re: [Pharo-users] How to zip a WideString

2019-10-10 Thread Sven Van Caekenberghe



> On 4 Oct 2019, at 06:36, Richard O'Keefe  wrote:
> 
> There is no need for
> a separate #utf8Encoded, that's what asByteArrayDo: *does*."

so #asByteArrayDo: produces UTF8 bytes, which is an encoding, so it seems 
fixed, IIUC.

But this is the Pharo mailing list and your are referring to a system nobody 
can see (I asked you this before), so it is very hard to understand (the 
context of) what you write.


Re: [Pharo-users] How to zip a WideString

2019-10-10 Thread Richard O'Keefe
One of the key concepts in astc's text handling is that all strings
use the same encoding.
So no, my system doesn't mix encoding/decoding with compression/decompression;
encoding and decoding are completely out of scope.
There is a *transformation format* issue, but not an encoding issue.
For example, having got aByteArray from somewhere,
   aString := SCSUDecoder decode: (ByteArray unzip: aByteArray)
uncompresses in one step (which knows nothing about encodings)
and decodes in another (which is admittedly the Simple Compression
Scheme for Unicode, but knows nothing of FLATE compression).
Similarly,
 aByteArray := (EightBitEncoder type: 'ISO-8859-1' encode: aString) zipped
separates encoding from compression.

On Thu, 10 Oct 2019 at 02:17, Sven Van Caekenberghe  wrote:
>
> Richard,
>
> Your implementation mixes zipping/unzipping and encoding/decoding, dictating 
> a single way to do so, if I understand it correctly.
>
> The composition with several messages allows for end users to choose their 
> own encoding format, depending on their own needs, which I think is more 
> flexible.
>
> Sven
>
> > On 4 Oct 2019, at 06:36, Richard O'Keefe  wrote:
> >
> > Here's how it would look in my library:
> >   compressed := original zipped.
> >  "There is currently one definition, in
> > AbstractStringOrByteArray, covering [ReadOnly]ByteArray,
> > [ReadOnly]String and its many subclasses,
> >   ByteBuffer,StringBuffer, Substring, [ReadOnly]ShortArray,
> > [ReadOnly]MappedByteArray, and some others.  This relies on
> >   _ asByteArraySize and _ asByteArrayDo: _.  There is no need for
> > a separate #utf8Encoded, that's what asByteArrayDo: *does*."
> >
> >  copy := original class unzip: compressed.
> >"This is a little trickier, but not hugely so.  There is no need
> > for special case code.   [ReadOnly][Mapped]ByteArray and ByteBuffer
> > are
> > sequences of bytes, Stringy things are Unicode, and
> > [ReadOnly]ShortArrays are treated as UTF16."
> >
> > As far as I can tell, this just works for the original use case.
> >
> > On Fri, 4 Oct 2019 at 11:42, PBKResearch  wrote:
> >>
> >> Richard
> >>
> >> I don't think so. The case being considered for my problem is the 
> >> compression of a ByteArray produced by applying #utf8Encoded to a 
> >> WideString, but it extends to any other form of ByteArray. If you 
> >> substitute ByteArray for SomeClass in your examples, I think you will see 
> >> why the chosen interface was used.
> >>
> >> Peter Kenny
> >>
> >>
> >> -Original Message-
> >> From: Pharo-users  On Behalf Of 
> >> Richard O'Keefe
> >> Sent: 03 October 2019 23:08
> >> To: Any question about pharo is welcome 
> >> Subject: Re: [Pharo-users] How to zip a WideString
> >>
> >> The interface should surely be
> >>   SomeClass
> >> methods for: 'compression'
> >>   zipped "return a byte array"
> >>
> >>class methods for: 'decompression'
> >>  unzip: aByteArray "return an instance of SomeClass"
> >>
> >>
> >
>
>



Re: [Pharo-users] [Pharo-dev] PhD starting in January/February 2020 on Advanced debugging with Pharo

2019-10-10 Thread ducasse
JB I think that this blog post is not yours. 
And this is not even ours. It is available. We just listed it here because it 
was available. 

Stef


> On 10 Oct 2019, at 14:57, jean baptiste arnaud  
> wrote:
> 
> It is really nice to put me as reference here, even if it is without my 
> consent. Whatever I will embrace the charge if someone is interested by 
> conduct a PhD with rmod I will be more than happy to share my experience 
> feedback with them. The good part, they are a lot of them and the bad part, 
> they are some of them. Feel free to contact me.
> But please the next time ask me before.
>  
> 
> 



Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Smalltalk
I have used OmniBase extensively long ago with Dolphin  Smalltalk (the 
Dolphin repository can be read & writen by Visual  Works too).


Even the Dolphin repository can be under Windows and Linux (using 
Samba). You can distribute instances ODBContainer through a LAN.


OmniBase use "multiversion concurrency control" to hold different 
version of the same object (in different transactions).


OmniBase is pretty cool but if need a lot of indexes (indexes on more 
than one inst var ) you have to solve the problem yourself using 
OmniBase b-trees.


regards

bruno

El 09/10/2019 a las 15:33, PBKResearch escribió:


It may be irrelevant, but I have been playing recently with OmniBase, 
which is a fully object-oriented database system, now over 20 years 
old, but it still works very well for my uses. David Gorišek, the 
author, claims that it has ACID properties. From my reading, updates 
operate on a proxy object, which is not written to the database until 
an explicit commit is given. A second transaction accessing the same 
object will still see the original until the change is committed. What 
happens to a proxy which is never committed is not clear, but if 
Gorišek is right, the stored data can never be contaminated. I think a 
proxy in this sense is equivalent to a memento.


Thanks to Esteban Lorenzano, OmniBase is now available on Pharo. The 
code is ancient, there is no documentation and obviously no support, 
but it might be worth while for someone to try some software 
archaeology and put it to use. I have found it possible to create and 
maintain a small database of natural language information, and access 
is fairly quick and easy – and it’s all Smalltalk.


It claims to store all kinds of Smalltalk objects, except block 
closures, and skimming through the code it seems to incorporate a 
serializer similar to Fuel.


The only documentation I have found is a slideshow at 
https://www.slideshare.net/esug/omni-baseobjectdatabase. I have found 
out a few things about it, if anyone is interested.


Peter Kenny

*From:*Pharo-users  *On Behalf Of 
*Norbert Hartl

*Sent:* 09 October 2019 18:08
*To:* Any question about pharo is welcome 
*Subject:* Re: [Pharo-users] voyage mongo and transactionality


Am 09.10.2019 um 16:48 schrieb "jtuc...@objektfabrik.de 
" >:


This is a tricky mine field. Sometimes you need a lot of business
functionality in objects referenced in your objects that are
currently in the editor. So I'm still to see a project in which
the memento pattern really worked for more complex scenarios. How
deep do you dive to have enough memento objects to provide the
functionality needed. I guess you can do that with some sort of
object-level transaction framework that automatically creates
mementos of whatever object is being navigated to during some kind
of processing-context. I guess slots could be of use here. But
this is not trivial for general cases.

Yes it is tricky. You can have copies of business objects but you have 
always references to the business objects not pointing to the copy.


And you need to know which objects should be tracked. In Gemstone IIRC 
it is easy as it is the time the object is copied from the stone to 
the gem it is registered in the current transaction. So you can check 
it and committing if it changed because you have to write it back. The 
important point here might be get noticed when a reference is 
acquired. In pharo it is not that easy but could be done if object 
would be reified and interceptable.


In my experience, this problem area makes for the other 70% of the
time spent on developing GUI or Web applications, besides the 60%
for GUI design and implementation and 25% business logic...

70% + 60% + 25% + 30% = 185%

sounds indeed very realistic if it comes to project planning. There 
is even a rule saying that for the first 90% of the project you need 
the first 90% of time and for the last 10% of the project you need the 
second 90% of time.


I'd be interested to learn about patterns to handle such more
complex things. We constantly travel back and forth between
implementing stuff in the GUI handlers (copying values to the GUI
classes that access themselves during GUI operations and push
values to the business objects when the users clicks on OK), using
mementos (which most of the times are nets of mementos that are
created manually - "we know what we'll touch in this Editor") and
operating on business objects directly and relying on the
persistence mechanism (Glorp in our case) and its rollback
behaviour. All three have lots of weaknesses and seem to have
their place nevertheless.

So this is a very interesting discussion and I think this is an
area that has not been solved yet.

I think it isn‘t solved and I find every piece of information about it 
very interesting.


Norbert


Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Norbert Hartl


> Am 10.10.2019 um 12:31 schrieb Jonathan van Alteren 
> :
> 
> Hah, those percentages feel very real to me at the moment :-S
> 
> Can you explain what GemStone IIRC means? (Novice speaking here :-)) If 
> GemStone solves this at the moment an object goes from Stone to Gem, perhaps 
> we can take that architecture as an example and somehow apply it locally 
> within the same image? What would be required for something like that? Just 
> thinking out loud here...
> 
IIRC means „if I remember correctly“ ;)
Gemstone as the name says is a combination of gem and stone. Stone is the 
database part in the system that manages the global heap. A gem is more or less 
what a pharo vm is. When a gem opens a transaction all used objects get copied 
from the stone in the gem heap. On committing  the transaction the gem writes 
back the data to the stone. This is very brief and mostly not exactly like that 
but gives the picture

Norbert
> 
> Kind regards,
> 
> Jonathan van Alteren
> 
> Founding Member | Object Guild
> jvalte...@objectguild.com
>> On 9 Oct 2019, 19:09 +0200, Norbert Hartl , wrote:
>> 
>> 
>> Am 09.10.2019 um 16:48 schrieb "jtuc...@objektfabrik.de" 
>> :
>> 
>>> 
>>> This is a tricky mine field. Sometimes you need a lot of business 
>>> functionality in objects referenced in your objects that are currently in 
>>> the editor. So I'm still to see a project in which the memento pattern 
>>> really worked for more complex scenarios. How deep do you dive to have 
>>> enough memento objects to provide the functionality needed. I guess you can 
>>> do that with some sort of object-level transaction framework that 
>>> automatically creates mementos of whatever object is being navigated to 
>>> during some kind of processing-context. I guess slots could be of use here. 
>>> But this is not trivial for general cases.
>> 
>> Yes it is tricky. You can have copies of business objects but you have 
>> always references to the business objects not pointing to the copy. 
>> And you need to know which objects should be tracked. In Gemstone IIRC it is 
>> easy as it is the time the object is copied from the stone to the gem it is 
>> registered in the current transaction. So you can check it and committing if 
>> it changed because you have to write it back. The important point here might 
>> be get noticed when a reference is acquired. In pharo it is not that easy 
>> but could be done if object would be reified and interceptable. 
>>> In my experience, this problem area makes for the other 70% of the time 
>>> spent on developing GUI or Web applications, besides the 60% for GUI design 
>>> and implementation and 25% business logic...
>>> 
>> 70% + 60% + 25% + 30% = 185%
>> 
>> sounds indeed very realistic if it comes to project planning. There is even 
>> a rule saying that for the first 90% of the project you need the first 90% 
>> of time and for the last 10% of the project you need the second 90% of time. 
>>> I'd be interested to learn about patterns to handle such more complex 
>>> things. We constantly travel back and forth between implementing stuff in 
>>> the GUI handlers (copying values to the GUI classes that access themselves 
>>> during GUI operations and push values to the business objects when the 
>>> users clicks on OK), using mementos (which most of the times are nets of 
>>> mementos that are created manually - "we know what we'll touch in this 
>>> Editor") and operating on business objects directly and relying on the 
>>> persistence mechanism (Glorp in our case) and its rollback behaviour. All 
>>> three have lots of weaknesses and seem to have their place nevertheless.
>>> 
>>> So this is a very interesting discussion and I think this is an area that 
>>> has not been solved yet.
>>> 
>> I think it isn‘t solved and I find every piece of information about it very 
>> interesting.
>> 
>> Norbert
>>> Joachim
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
 Am 09.10.19 um 16:25 schrieb James Foster:
 Thanks for the explanation. And, yes, this is an artifact of your design; 
 if you put intermediate values into domain objects then they will remain 
 in your domain objects to be seen later. From what you’ve described, I 
 don’t see how it would be any different in a non-image environment (Java, 
 C#, etc.), unless you re-read the entire object graph from the database. 
 As someone else mentioned, this would be a good place for the Memento 
 Pattern.
 
 James
 
> On Oct 9, 2019, at 1:59 AM, Jonathan van Alteren 
>  wrote:
> 
> Hi James,
> 
> I see how my explanation might be unclear.
> 
> We have a main form for the agenda and a subform for an item, which is 
> shown using Seaside call/answer. The save button of the subform is 
> clicked, which adds the item to the underlying agenda model object, but 
> the save button of the main form is not clicked by the user. The callback 
> for the main save 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Norbert Hartl
Hi,


> Am 10.10.2019 um 11:48 schrieb Jonathan van Alteren 
> :
> 
> Hi Norbert,
> 
> Thank you very much for your extensive answer.
> 
> For starters, we would be happy to have an option available for the course 
> grained handling that you mention. I'd be interested to hear if there are any 
> options besides GemStone available to be used with Voyage/MongoDB.

I think Gematone has a model that serves these use cases really well. In Pharo 
there is not much that makes your life easy. But most of this problems can be 
solved sufficiently kust not generically. Every use case has its constraints 
and you can model a solution for it. The main problem in voyage stays that the 
cache is per repository. We need to think along that line if a session or 
request cannot get its private copy of the database object.

> Your mention of the Mongo cache being a weak dictionary is very interesting, 
> I did not know that (it doesn't seem to be documented). Yes, the Seaside 
> sessions seem to be the path through which these objects remain referenced. 
> When I inspect all instances of our session class, I see old session objects 
> hanging around that still reference our root application component with the 
> rendering tree containing various references to our domain model objects.

You asked Esteban about the cache. I answer that here. Everybody stumbles over 
the name cache and Esteban is reluctant to give it another name 
The cache is only for establishing identity in the image. The basic thing with 
objects in an external system is that its identity (location in the heap) 
becomes an identity parameter like an id. So when you have externalized objects 
and you load the object with the same id twice in the image you will make sure 
that there will only be one object for it and the object from the first query 
and from the second query are identical meaning comparing both with == returns 
true. So the cache keeps the database reference and the business object in a 
weak dictionary. If the object with the same id is queried from the database it 
returns the object it already has. If the object is not referenced anymore the 
entry will be removed from the cache. It is nothing more than this.
> 
> Can you tell me why the session objects don't get garbage collected?
> Should we manually clean up our session object somehow?
> 
I‘m not sure what you mean. If the session is not referenced than it just means 
the garbage collector did not remove it. But this won‘t keep the cache from 
removing the entry. But seaside sessions have an expiry time. So there is a 
duration while seaside keeps referencing the session and therefor all objects 
that are kept in the session are still connecte keeping the objects in the 
voyage cache.

> I must admit I'm a bit out of my comfort zone here, after working in Java for 
> close to 20 years ;-) We explicitly don't want to use any relational 
> databases for our own application (perhaps only for integrating with customer 
> data). I still haven't fully integrated the conceptual differences in my 
> mental model, about how to work with objects in an image based/object 
> persistence environment.
> 
> I did look into using a Voyage repository filter, which is mentioned (or 
> buried deep I should say ;-)) in this post: 
> https://pharoweekly.wordpress.com/2017/02/20/consortium-action-13-17-feb/. 
> What if we were to use a dynamic variable like this for each session 
> instance? Then at least each user will have her/his own cache. But that 
> doesn't answer the need for a kind of rollback mechanism within the same 
> Voyage cache/session. And then there is your comment about potentially having 
> multiple copies of an identical object...

As I told in my last mail. The session or request based cache has also problems 
because if you attach an object you queried while in the session/request to 
somewhere more global you introduce subtle bugs. Maybe we need a two level 
cache, one that knows all objects referenced in the image and one that keeps 
the private copies based on the image based cache. This way we could know that 
multiple sessions/request are keeping a copy of the same object and we could 
determine merge conflicts. Need to think more about this
> 
> I wonder what patterns other Seaside 'enterprise' application developers are 
> using.
> 

> You are right, the term object transactionality doesn't make much sense ;-) 
> We are not using Magritte (and probably won't). I don't know much about 
> Magritte, but it feels like it might be incompatible with the behavioral, 
> 'pure' object approach that we want to use. However, I am interested to 
> investigate. Can you recommend any good documentation sources for learning 
> Magritte from an application architecture perspective?
> 
Magritte is a meta description of your objects. It is like having powerful 
annotation objects. These can be used to create different views on your model. 
There is the PhD paper of Lukas Renggli on the net and 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi Peter,

Thanks for your reply.

That sounds very interesting. For similar reasons, I tried to check out Magma. 
However, since I'm still a novice in Pharo/Smalltalk and it's not very well 
documented (and mostly refers to Squeak), it's quite painful to figure out how 
it works and how to get it going in Pharo. Not to mention actually using it in 
production for an 'enterprise' application for an actual customer... I haven't 
given that up yet, but currently don't have the time.

I will look into OmniBase. Anything you're willing to share about getting it up 
and running (in Pharo 7.0 64-bit) is greatly appreciated!


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 9 Oct 2019, 20:34 +0200, PBKResearch , wrote:
> It may be irrelevant, but I have been playing recently with OmniBase, which 
> is a fully object-oriented database system, now over 20 years old, but it 
> still works very well for my uses. David Gorišek, the author, claims that it 
> has ACID properties. From my reading, updates operate on a proxy object, 
> which is not written to the database until an explicit commit is given. A 
> second transaction accessing the same object will still see the original 
> until the change is committed. What happens to a proxy which is never 
> committed is not clear, but if Gorišek is right, the stored data can never be 
> contaminated. I think a proxy in this sense is equivalent to a memento.
>
> Thanks to Esteban Lorenzano, OmniBase is now available on Pharo. The code is 
> ancient, there is no documentation and obviously no support, but it might be 
> worth while for someone to try some software archaeology and put it to use. I 
> have found it possible to create and maintain a small database of natural 
> language information, and access is fairly quick and easy – and it’s all 
> Smalltalk.
> It claims to store all kinds of Smalltalk objects, except block closures, and 
> skimming through the code it seems to incorporate a serializer similar to 
> Fuel.
>
> The only documentation I have found is a slideshow at 
> https://www.slideshare.net/esug/omni-baseobjectdatabase. I have found out a 
> few things about it, if anyone is interested.
>
> Peter Kenny
>
>
> From: Pharo-users  On Behalf Of Norbert 
> Hartl
> Sent: 09 October 2019 18:08
> To: Any question about pharo is welcome 
> Subject: Re: [Pharo-users] voyage mongo and transactionality
>
>
>
> Am 09.10.2019 um 16:48 schrieb "jtuc...@objektfabrik.de" 
> :
> >
> > This is a tricky mine field. Sometimes you need a lot of business 
> > functionality in objects referenced in your objects that are currently in 
> > the editor. So I'm still to see a project in which the memento pattern 
> > really worked for more complex scenarios. How deep do you dive to have 
> > enough memento objects to provide the functionality needed. I guess you can 
> > do that with some sort of object-level transaction framework that 
> > automatically creates mementos of whatever object is being navigated to 
> > during some kind of processing-context. I guess slots could be of use here. 
> > But this is not trivial for general cases.
>
> Yes it is tricky. You can have copies of business objects but you have always 
> references to the business objects not pointing to the copy.
> And you need to know which objects should be tracked. In Gemstone IIRC it is 
> easy as it is the time the object is copied from the stone to the gem it is 
> registered in the current transaction. So you can check it and committing if 
> it changed because you have to write it back. The important point here might 
> be get noticed when a reference is acquired. In pharo it is not that easy but 
> could be done if object would be reified and interceptable.
> > In my experience, this problem area makes for the other 70% of the time 
> > spent on developing GUI or Web applications, besides the 60% for GUI design 
> > and implementation and 25% business logic...
> 70% + 60% + 25% + 30% = 185%
>
> sounds indeed very realistic if it comes to project planning. There is even 
> a rule saying that for the first 90% of the project you need the first 90% of 
> time and for the last 10% of the project you need the second 90% of time.
>
> > I'd be interested to learn about patterns to handle such more complex 
> > things. We constantly travel back and forth between implementing stuff in 
> > the GUI handlers (copying values to the GUI classes that access themselves 
> > during GUI operations and push values to the business objects when the 
> > users clicks on OK), using mementos (which most of the times are nets of 
> > mementos that are created manually - "we know what we'll touch in this 
> > Editor") and operating on business objects directly and relying on the 
> > persistence mechanism (Glorp in our case) and its rollback behaviour. All 
> > three have lots of weaknesses and seem to have their place nevertheless.
> > So this is a very interesting discussion and I 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hah, those percentages feel very real to me at the moment :-S

Can you explain what GemStone IIRC means? (Novice speaking here :-)) If 
GemStone solves this at the moment an object goes from Stone to Gem, perhaps we 
can take that architecture as an example and somehow apply it locally within 
the same image? What would be required for something like that? Just thinking 
out loud here...


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 9 Oct 2019, 19:09 +0200, Norbert Hartl , wrote:
>
>
> Am 09.10.2019 um 16:48 schrieb "jtuc...@objektfabrik.de" 
> :
>
> >
> > This is a tricky mine field. Sometimes you need a lot of business 
> > functionality in objects referenced in your objects that are currently in 
> > the editor. So I'm still to see a project in which the memento pattern 
> > really worked for more complex scenarios. How deep do you dive to have 
> > enough memento objects to provide the functionality needed. I guess you can 
> > do that with some sort of object-level transaction framework that 
> > automatically creates mementos of whatever object is being navigated to 
> > during some kind of processing-context. I guess slots could be of use here. 
> > But this is not trivial for general cases.
>
> Yes it is tricky. You can have copies of business objects but you have always 
> references to the business objects not pointing to the copy.
> And you need to know which objects should be tracked. In Gemstone IIRC it is 
> easy as it is the time the object is copied from the stone to the gem it is 
> registered in the current transaction. So you can check it and committing if 
> it changed because you have to write it back. The important point here might 
> be get noticed when a reference is acquired. In pharo it is not that easy but 
> could be done if object would be reified and interceptable.
> > In my experience, this problem area makes for the other 70% of the time 
> > spent on developing GUI or Web applications, besides the 60% for GUI design 
> > and implementation and 25% business logic...
> 70% + 60% + 25% + 30% = 185%
>
> sounds indeed very realistic if it comes to project planning. There is even 
> a rule saying that for the first 90% of the project you need the first 90% of 
> time and for the last 10% of the project you need the second 90% of time.
> > I'd be interested to learn about patterns to handle such more complex 
> > things. We constantly travel back and forth between implementing stuff in 
> > the GUI handlers (copying values to the GUI classes that access themselves 
> > during GUI operations and push values to the business objects when the 
> > users clicks on OK), using mementos (which most of the times are nets of 
> > mementos that are created manually - "we know what we'll touch in this 
> > Editor") and operating on business objects directly and relying on the 
> > persistence mechanism (Glorp in our case) and its rollback behaviour. All 
> > three have lots of weaknesses and seem to have their place nevertheless.
> > So this is a very interesting discussion and I think this is an area that 
> > has not been solved yet.
> I think it isn‘t solved and I find every piece of information about it very 
> interesting.
>
> Norbert
> > Joachim
> >
> >
> >
> >
> >
> >
> > Am 09.10.19 um 16:25 schrieb James Foster:
> > > Thanks for the explanation. And, yes, this is an artifact of your design; 
> > > if you put intermediate values into domain objects then they will remain 
> > > in your domain objects to be seen later. From what you’ve described, I 
> > > don’t see how it would be any different in a non-image environment (Java, 
> > > C#, etc.), unless you re-read the entire object graph from the database. 
> > > As someone else mentioned, this would be a good place for the Memento 
> > > Pattern.
> > >
> > > James
> > >
> > > > On Oct 9, 2019, at 1:59 AM, Jonathan van Alteren 
> > > >  wrote:
> > > >
> > > > Hi James,
> > > >
> > > > I see how my explanation might be unclear.
> > > >
> > > > We have a main form for the agenda and a subform for an item, which is 
> > > > shown using Seaside call/answer. The save button of the subform is 
> > > > clicked, which adds the item to the underlying agenda model object, but 
> > > > the save button of the main form is not clicked by the user. The 
> > > > callback for the main save button sends the save message to the agenda 
> > > > object, causing the database to be updated.
> > > >
> > > > So yes, the browser does submit the data on the subform, it's the main 
> > > > form component that doesn't receive the save button callback. I realize 
> > > > that this is in large part an issue with our design. However, the way 
> > > > object persistence seems to work in the image environment plays a large 
> > > > role.
> > > >
> > > >
> > > > Kind regards,
> > > >
> > > > Jonathan van Alteren
> > > >
> > > > Founding Member | Object Guild
> > > > jvalte...@objectguild.com
> > > > On 8 Oct 2019, 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi Joachim,

Thank you for your feedback.

It feels good to know we're not alone in this :-) Unfortunately, the things you 
describe are familiar to me. My business partner Dave West has a lot of 
experience with applying a behavioral, 'pure' object design approach. We're 
looking hard into simplifying these matters through the application of 
inversion of control and by making objects as autonomous as they can possible 
be. At the same time, we haven't found the pot of gold at the end of the 
rainbow yet ;-)

Nowadays, a fair amount of applications have a very direct way of handling user 
interactions and resulting state changes. For example, the settings of my 
Firefox browser doesn't have a save button anymore. Anything I change looks to 
be automatically persisted. Perhaps there is some value in that approach for 
'enterprise' applications as well, although I think there will remain a lot of 
use cases where an explicit save will be needed for whatever reason.

Let's keep talking about this. I need to do some research on the memento 
pattern first :-) If you have any information sources you can point me to, I 
would greatly appreciate that.


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 9 Oct 2019, 16:49 +0200, jtuc...@objektfabrik.de , 
wrote:
>
> This is a tricky mine field. Sometimes you need a lot of business 
> functionality in objects referenced in your objects that are currently in the 
> editor. So I'm still to see a project in which the memento pattern really 
> worked for more complex scenarios. How deep do you dive to have enough 
> memento objects to provide the functionality needed. I guess you can do that 
> with some sort of object-level transaction framework that automatically 
> creates mementos of whatever object is being navigated to during some kind of 
> processing-context. I guess slots could be of use here. But this is not 
> trivial for general cases.
> In my experience, this problem area makes for the other 70% of the time spent 
> on developing GUI or Web applications, besides the 60% for GUI design and 
> implementation and 25% business logic...
> I'd be interested to learn about patterns to handle such more complex things. 
> We constantly travel back and forth between implementing stuff in the GUI 
> handlers (copying values to the GUI classes that access themselves during GUI 
> operations and push values to the business objects when the users clicks on 
> OK), using mementos (which most of the times are nets of mementos that are 
> created manually - "we know what we'll touch in this Editor") and operating 
> on business objects directly and relying on the persistence mechanism (Glorp 
> in our case) and its rollback behaviour. All three have lots of weaknesses 
> and seem to have their place nevertheless.
> So this is a very interesting discussion and I think this is an area that has 
> not been solved yet.
>
> Joachim
>
>
>
>
>
>
> Am 09.10.19 um 16:25 schrieb James Foster:
> > Thanks for the explanation. And, yes, this is an artifact of your design; 
> > if you put intermediate values into domain objects then they will remain in 
> > your domain objects to be seen later. From what you’ve described, I don’t 
> > see how it would be any different in a non-image environment (Java, C#, 
> > etc.), unless you re-read the entire object graph from the database. As 
> > someone else mentioned, this would be a good place for the Memento Pattern.
> >
> > James
> >
> > > On Oct 9, 2019, at 1:59 AM, Jonathan van Alteren 
> > >  wrote:
> > >
> > > Hi James,
> > >
> > > I see how my explanation might be unclear.
> > >
> > > We have a main form for the agenda and a subform for an item, which is 
> > > shown using Seaside call/answer. The save button of the subform is 
> > > clicked, which adds the item to the underlying agenda model object, but 
> > > the save button of the main form is not clicked by the user. The callback 
> > > for the main save button sends the save message to the agenda object, 
> > > causing the database to be updated.
> > >
> > > So yes, the browser does submit the data on the subform, it's the main 
> > > form component that doesn't receive the save button callback. I realize 
> > > that this is in large part an issue with our design. However, the way 
> > > object persistence seems to work in the image environment plays a large 
> > > role.
> > >
> > >
> > > Kind regards,
> > >
> > > Jonathan van Alteren
> > >
> > > Founding Member | Object Guild
> > > jvalte...@objectguild.com
> > > On 8 Oct 2019, 15:41 +0200, James Foster , wrote:
> > > >
> > > > > On Oct 8, 2019, at 3:05 AM, Jonathan van Alteren 
> > > > >  wrote:
> > > > >
> > > > > We've encountered an issue where a user makes changes to an agenda, 
> > > > > but does not click the Save button. Instead, the user closes the 
> > > > > browser or uses the navigation to go to a different part of the 
> > > > > application. When navigating back to the 

Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi James,

Thank you for your feedback.

If I remember correctly, in Java a persistence framework like JPA/Hibernate 
would track 'dirty' objects somehow and handle caching together with 
transaction management. There might be some things we might apply from those 
frameworks in Pharo/Smalltalk. However, our challenge is that we don't have 
much time to look at this because we need it to develop customer applications 
;-)

I will look into the Memento Pattern, thanks!


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 9 Oct 2019, 16:26 +0200, James Foster , wrote:
> Thanks for the explanation. And, yes, this is an artifact of your design; if 
> you put intermediate values into domain objects then they will remain in your 
> domain objects to be seen later. From what you’ve described, I don’t see how 
> it would be any different in a non-image environment (Java, C#, etc.), unless 
> you re-read the entire object graph from the database. As someone else 
> mentioned, this would be a good place for the Memento Pattern.
>
> James
>
> > On Oct 9, 2019, at 1:59 AM, Jonathan van Alteren 
> >  wrote:
> >
> > Hi James,
> >
> > I see how my explanation might be unclear.
> >
> > We have a main form for the agenda and a subform for an item, which is 
> > shown using Seaside call/answer. The save button of the subform is clicked, 
> > which adds the item to the underlying agenda model object, but the save 
> > button of the main form is not clicked by the user. The callback for the 
> > main save button sends the save message to the agenda object, causing the 
> > database to be updated.
> >
> > So yes, the browser does submit the data on the subform, it's the main form 
> > component that doesn't receive the save button callback. I realize that 
> > this is in large part an issue with our design. However, the way object 
> > persistence seems to work in the image environment plays a large role.
> >
> >
> > Kind regards,
> >
> > Jonathan van Alteren
> >
> > Founding Member | Object Guild
> > jvalte...@objectguild.com
> > On 8 Oct 2019, 15:41 +0200, James Foster , wrote:
> > >
> > > > On Oct 8, 2019, at 3:05 AM, Jonathan van Alteren 
> > > >  wrote:
> > > >
> > > > We've encountered an issue where a user makes changes to an agenda, but 
> > > > does not click the Save button. Instead, the user closes the browser or 
> > > > uses the navigation to go to a different part of the application. When 
> > > > navigating back to the original agenda, the changes made previously 
> > > > (e.g. items added) are still being displayed, even though they were 
> > > > never explicitly saved.
> > >
> > > Here is what I don’t understand: how did the change get from the user’s 
> > > client agent (browser) to the server? If you make a change to a field in 
> > > a form and then close the browser, who sent the change to the server? If 
> > > you show the save domain value in a different location, with a 
> > > dynamically-generated id and name (so it isn’t cached in the browser), or 
> > > written to the Pharo Transcript, does the value still change? That is, 
> > > are you sure that the change is in the reflected in the Smalltalk image 
> > > and not just somehow cached in the browser?
> > >
> > > James
> > >
> > >
>


Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi Estaban,

Thanks for your feedback.

I agree that there might not be any real problem with Voyage. And yes, I think 
it was some kind of in-memory transaction handling that is was looking for.

Can you explain a bit more about how the cache in Voyage works and why it is 
the way it is?

The application in question doesn't have a lot of users, so changes are we 
could do without caching and still have good performance. I was used to working 
with JPA/Hibernate in Java, which doesn't seem to have the issue that we run 
into. Any idea why it works differently with Voyage/MongoDB? Is that because 
MongoDB doesn't support database transactions, hence missing a good trigger to 
flush the cache?

Making copies of domain model objects somehow 'feels wrong'. When I have a 
person in my CRM domain, I feel strongly that it should always ever be 
represented by 1 object instance of class Person.

The search continues... :-)


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 8 Oct 2019, 12:54 +0200, Esteban Lorenzano , wrote:
> Hi,
>
> That looks a lot more like a Seaside mishandling than a problem with Voyage 
> itself.
>
> > On 8 Oct 2019, at 12:05, Jonathan van Alteren  
> > wrote:
> >
> > Hello all,
> >
> > We are having some issues with using Voyage/Mongo for a customer project 
> > that I'd like to get your feedback on.
> >
> > The customer application is a form based business web application using 
> > Seaside with object persistence using Voyage with MongoDB on Pharo 7.0. The 
> > application is deployed on a dedicated Linux production server running 
> > MongoDB version 4.2.
> >
> > The application is used to manage meeting agendas and minutes. After 
> > opening the agenda view of a future meeting, the user can add an item to 
> > the agenda by clicking a button. This calls an item editor component which 
> > answers when a Save or Cancel button is clicked. The agenda view component 
> > itself also has a Save button, which performs a Voyage save of the object 
> > aggregate (agenda + items).
> >
> > We've encountered an issue where a user makes changes to an agenda, but 
> > does not click the Save button. Instead, the user closes the browser or 
> > uses the navigation to go to a different part of the application. When 
> > navigating back to the original agenda, the changes made previously (e.g. 
> > items added) are still being displayed, even though they were never 
> > explicitly saved.
> >
> > It does not matter if we select the agenda aggregate object instance using 
> > Voyage or access it in a different way. Changes to the state of the object 
> > are retained, even though a Voyage save was never sent to the agenda 
> > instance. The cause seems to be that the Voyage repository caches the 
> > object instance and thus on select, it returns an object that is in a 
> > different state than how it was persisted.
> >
> > This all seems to come down to object transactionality.
> >
> > We have a need to 'cancel' changes made to an object instance. Before 
> > working with Pharo/Smalltalk in a non-image based environment, I was used 
> > to do this by retrieving the original object from persistence again. This 
> > also allowed for a convenient way to detect changes to an object's state, 
> > which we are missing at the moment too.
>
> In Voyage, new objects are just persisted (hence they enter the cache) once 
> you do the first “save”.
> Retrieved objects are indeed in the cache, and since there is just one copy 
> for Pharo instance, if you do an update of a property (even if you do not 
> save), the cached instance will have the new attribute value, since there is 
> no in-memory transaction handling in Voyage.
>
> Which means: you need to handle it by your self. One solution is to work on a 
> copy and on “save” flush the changes before (it is easy to develop methods to 
> automatise this).
>
> Well, something like that :)
>
> >
> > We know that moving to GemStone can help us with these issues, but our 
> > current planning of customer projects does not allow us to do this within 
> > the next 3 months. And we really need to find a way to tackle these issues .
>
> Well, not really, you will still need to copy modified values, retrieve new 
> and apply your changes.
> Of course if you want to discard possible in-memory changes, yes, you can 
> cancel the transaction in gemstone… and you can also re-read the object in 
> Voyage (no special api for that, even if we could add it… you need to 
> re-execute a query for it).
>
> Esteban
>
> >
> >
> > Your feedback is greatly appreciated!
> >
> >
> >
> > Kind regards,
> >
> >
> > Jonathan van Alteren
> >
> > Founding Member | Object Guild
> > jvalte...@objectguild.com
> >
>
>


Re: [Pharo-users] voyage mongo and transactionality

2019-10-10 Thread Jonathan van Alteren
Hi Norbert,

Thank you very much for your extensive answer.

For starters, we would be happy to have an option available for the course 
grained handling that you mention. I'd be interested to hear if there are any 
options besides GemStone available to be used with Voyage/MongoDB.

Your mention of the Mongo cache being a weak dictionary is very interesting, I 
did not know that (it doesn't seem to be documented). Yes, the Seaside sessions 
seem to be the path through which these objects remain referenced. When I 
inspect all instances of our session class, I see old session objects hanging 
around that still reference our root application component with the rendering 
tree containing various references to our domain model objects.

Can you tell me why the session objects don't get garbage collected?
Should we manually clean up our session object somehow?

I must admit I'm a bit out of my comfort zone here, after working in Java for 
close to 20 years ;-) We explicitly don't want to use any relational databases 
for our own application (perhaps only for integrating with customer data). I 
still haven't fully integrated the conceptual differences in my mental model, 
about how to work with objects in an image based/object persistence environment.

I did look into using a Voyage repository filter, which is mentioned (or buried 
deep I should say ;-)) in this post: 
https://pharoweekly.wordpress.com/2017/02/20/consortium-action-13-17-feb/. What 
if we were to use a dynamic variable like this for each session instance? Then 
at least each user will have her/his own cache. But that doesn't answer the 
need for a kind of rollback mechanism within the same Voyage cache/session. And 
then there is your comment about potentially having multiple copies of an 
identical object...

I wonder what patterns other Seaside 'enterprise' application developers are 
using.

You are right, the term object transactionality doesn't make much sense ;-) We 
are not using Magritte (and probably won't). I don't know much about Magritte, 
but it feels like it might be incompatible with the behavioral, 'pure' object 
approach that we want to use. However, I am interested to investigate. Can you 
recommend any good documentation sources for learning Magritte from an 
application architecture perspective?

Also, I'm interested to hear more about the modification tracking approach you 
are working on. Please drop me a personal note if you are willing to 
collaborate on this.


Kind regards,

Jonathan van Alteren

Founding Member | Object Guild
jvalte...@objectguild.com
On 8 Oct 2019, 12:54 +0200, Norbert Hartl , wrote:
> Hi,
>
> > Am 08.10.2019 um 12:05 schrieb Jonathan van Alteren 
> > :
> >
> > Hello all,
> >
> > We are having some issues with using Voyage/Mongo for a customer project 
> > that I'd like to get your feedback on.
> >
> > The customer application is a form based business web application using 
> > Seaside with object persistence using Voyage with MongoDB on Pharo 7.0. The 
> > application is deployed on a dedicated Linux production server running 
> > MongoDB version 4.2.
> >
> > The application is used to manage meeting agendas and minutes. After 
> > opening the agenda view of a future meeting, the user can add an item to 
> > the agenda by clicking a button. This calls an item editor component which 
> > answers when a Save or Cancel button is clicked. The agenda view component 
> > itself also has a Save button, which performs a Voyage save of the object 
> > aggregate (agenda + items).
> >
> > We've encountered an issue where a user makes changes to an agenda, but 
> > does not click the Save button. Instead, the user closes the browser or 
> > uses the navigation to go to a different part of the application. When 
> > navigating back to the original agenda, the changes made previously (e.g. 
> > items added) are still being displayed, even though they were never 
> > explicitly saved.
> >
> > It does not matter if we select the agenda aggregate object instance using 
> > Voyage or access it in a different way. Changes to the state of the object 
> > are retained, even though a Voyage save was never sent to the agenda 
> > instance. The cause seems to be that the Voyage repository caches the 
> > object instance and thus on select, it returns an object that is in a 
> > different state than how it was persisted.
> >
> > This all seems to come down to object transactionality.
> >
> > We have a need to 'cancel' changes made to an object instance. Before 
> > working with Pharo/Smalltalk in a non-image based environment, I was used 
> > to do this by retrieving the original object from persistence again. This 
> > also allowed for a convenient way to detect changes to an object's state, 
> > which we are missing at the moment too.
> >
> > We know that moving to GemStone can help us with these issues, but our 
> > current planning of customer projects does not allow us to do this within 
> > the next 3 months. And we