Pharo-users
By thread
pharo-users@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
April 2014
- 76 participants
- 540 messages
Re: [Pharo-users] We need *you* for the upcoming Pharo's website
by Marcus Denker
On 25 Apr 2014, at 10:35, Damien Cassou <damien.cassou(a)gmail.com> wrote:
> Hi kilon,
>
> On Wed, Apr 23, 2014 at 9:32 PM, kilon alios <kilon.alios(a)gmail.com> wrote:
>> Well I tried, several times , but I am not happy with the end result. In any
>> case I am finished with this and since I promised to upload it here it is
>>
>> https://www.youtube.com/watch?v=Ol5ivaEATLQ
>
>
> I love it, really. It shows plenty of useful stuff. You English is
> clear to me even if I'm no native speaker so that's a great bonus.
>
> Marcus, can we add that to the Pharo channel on youtube?
>
I added it to the Pharo3 playlist:
https://www.youtube.com/channel/UCp3mNigANqkesFzdm058bvw
April 25, 2014
Re: [Pharo-users] glorp
by Norbert Hartl
Joachim,
thanks for your explanation. I appreciate that. I was thinking if it is a good idea to write my mail. Usually this ends in a holy war which I donât want. Comments inline.
Am 25.04.2014 um 09:02 schrieb jtuchel(a)objektfabrik.de:
> Norbert,
>
> you are right, I should have given an example of what I mean.
>
> So here is one:
>
> If you serialize an object graph to, say, json and store it in a NoSQL DB, you need to decide how "deep" you serialize your graph into one djson document and how to build up segments of your graph that need to be serialized separately, like for an equivalent of an 1:n relationship. Exanple: an Order contains OrderItems, each of which reference a Product. But the Product can be referenced from many OrderItems. So you need to "cut off" parts of your model to serialize them separately. And you need a way to save the "referenceâ.
You can do that in e.g. mongo as well. You just use on ObjectId as a field value or you use a DBRef. Btw. what you describe is not 1:n but m:n. An OrderItems can have n products and a Product can be in m OrderItems.
>
> One of the next questions then is "what if I delete a Product?". What happens to the OrderItems or InvoiceItems and so on?
If you just delete it the collections will have a stale reference. I think there is no universal answer to that even if it seems the removal in the collection is that universal answer. If it is about integrity you need one way to make it happen. Reestablishing of integrity can happen on write time or on read time.
What will happen in a SQL context? You canât delete an object that is pointed to by a foreign key. What does it help then? Not taking your business model into account you couldnât do anything more to find out where that reference is. That is probably the only point I wanted to make questioning your last mail. If we take that scenario you can only solve it if you take the problem one level higher (well, if you have cascading deletes you may ignore it). So these problems tend to end in the application logic. And that is what my experience tells me. Database ensured integrity isnât much of a help in many cases. So you solve the problems in the application logic (knowing which things reference what). Being there I see no big differences to using a NoSQL database. In NoSQL those features are just not there per se. You have to model it regarding your use case.
> None of these problems are unsolvable, but these problems need to be addressed either in your persistence framework on top of a NoSQl DB or in your application code. In Relational DBs, they've built solutions for these problems before you and I were born ;-) I am talking of foreign keys, referential integrities and normalization. To my knowledge, these have not yet found their standardized counterparts in NoSQL DBs. So NoSQL can be a good solution for many problems, but they can also be bad for many others.
Iâm questioning the use of each of those. As I said above I doubt there are many use cases where foreign keys are the best way to go. Btw. if you ever administrate a database and you have to recover after a crash then you might have a different view on foreign keys because they are able to make it close to impossible to load the data back. Referential integrity is either done by the database by foreign keys or in the application logic as I said above. The need for normalization is heavily use case depend. It is nothing good per se. So these are not good examples IMHO. Iâm wondering you didnât bring up the only good reason for SQL databases (for most). For me this is having atomic operations using transactions. This is the one case that can drive you nuts if try to model something with a NoSQL database to achieve it.
>
> I am not saying anything new here. This debate has been going on for decades already, and much more clever people than me have made good points for both sides over the years now.
Sure. But from time to time it is good to refresh the memory. And for me you are clever enough ;)
>
> You also asked for examples for problems you get from using Glorp.
>
> One of my biggest concerns is that it can be hard to model an m:n relationship where one or both sides of the relationship are abstract superclasses (or even concrete ones with multiple subclasses). It gets even harder when you want to be able to associate an object (like a Category or Tag) to "anything". This really is hard or involves some additional coding on top of the persistence framework.
>
> Glorp does miss one feature painfully: The ability to map classes with subclasses that spread over three or more "subtables" for the subclasses. This one is hard to explain: if you have a superclass "Vehicle" with two subclasses "FlyingVehicle" and "DrivingVehicle", both of which have subclasses, there is no support for a model which has tables on the "FlyingVehicle" or "DrivingVehicle" level. You must model your DB in a way that there are all attributes in a "Vehicle" table or in the "Car", "Train", "Spaceship" and "Kite" tables. This really is a pity and I don't think anybody is working on changing this any time soon.
>
Yep. Dealing with these cases I learned that Objects and SQL databases donât fit together and why ORM cannot work. I mean Glorp is really good at that by providing your use case with subclasses via virtual lookups. I donâ remember how it works. It was like a descriptor with candidate classes which lead to multiple lookups. I figured that out while talking to Alan 8 years ago. I think I managed it by using a three column m:n mapping table where you have the two ids and an identifier that gives a hint which subclass/table it is to look into. Anyway even if Glorp supported sublasses lookups it was a can of worms to open. I once changed a single thing in my glorp descriptions and then the login the web site took 1,5 minutes just because all the magic in Glorp produced 432 database lookups initiate by a single button click. You just try to force a schema (OO) onto a technology (SQL) that does not support this case at all. It is an entity relationship model where the entities are flat. Inheritance is not part of the solution.
So the summary would be: A lot of people making big efforts to forcing an object model into a technology that doesnât support it just because they want to have features like integrity you can establish in other ways. This is why I donât use SQL databases anymore until I have a use case that does benefit from it.
> Does this explain what I mean?
>
Yes and I hope I made point also very clear :)
Norbert
> Joachim
>
>
>
>
>
>
>
> Am 25.04.14 08:41, schrieb Norbert Hartl:
>>
>>
>> Am 25.04.2014 um 06:51 schrieb Joachim Tuchel <jtuchel(a)objektfabrik.de>:
>>
>>> Hi,
>>>
>>> We're using Glorp on VA ST for kontolino.de. It is an active project in the sense of somebody is taking care of bugs. The lead developer(s) work(s) for Cincom - and Cincom uses Glorp as supported component of CST. Instantiations also provides Glorp with VA ST and supports it. Glorp is very stable and is not moving fast, which is not a disadvantage for a production system. Features are being added and bugs are fixed.
>>>
>>> Re: Pharoers do NoSQL: judging from the discussions on this list and others, you have to be careful what you need. To me it seems many developers want features from relational DBs and hammer them into their applications with brute force. The first wow! soon gives room to a lot of problems that have been solved in relational DBs three decades ago.
>>>
>> I think such a statement should be based on an example.
>>
>>> But it is true that o/r mapping is not always fun. It can force you to make decisions about your model that look strange from the object perspective.
>>>
>> Agreed. And especially in the context of O/R I'm curious what will be your example to prove your point above.
>>
>> Couldn't resist,
>>
>> Norbert
>>> I'd either go full objects (gemstone, magma) or relational for my typical projects (business apps).
>>>
>>> Hth
>>>
>>> Joachim
>>>
>>> Clément Bera <bera.clement(a)gmail.com> schrieb:
>>>
>>> Hello,
>>>
>>> I think Glorp is used with DBXTalk for relational databases by multiple people.
>>>
>>> Usually, with Pharo, people use as a persistance layer either MongoDB with the frameworks MongoTalk/Voyage.
>>>
>>> Gemstone is also used quite often for large scale application but Gemstone is not free.
>>>
>>> Regards.
>>>
>>>
>>> 2014-04-23 20:34 GMT-07:00 Pablo R. Digonzelli <pdigonzelli(a)gmail.com>:
>>> Hi all, can someone tell me if glorp is active there ar is using glorp or other persistence framework in production projects?
>>>
>>> Tia
>>>
>>> Ing. Pablo Digonzelli
>>> Software Solutions
>>> IP-Solutiones SRL
>>> Metrotec SRL
>>> 25 de Mayo 521
>>> Email: pdigonzelli(a)softsargentina.com
>>> pdigonzelli(a)gmail.com
>>> Cel: 5493815982714
>>>
>>>
>
>
> --
> -----------------------------------------------------------------------
> Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de
> Fliederweg 1 http://www.objektfabrik.de
> D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
> Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
>
April 25, 2014
Re: [Pharo-users] We need *you* for the upcoming Pharo's website
by Damien Cassou
Hi kilon,
On Wed, Apr 23, 2014 at 9:32 PM, kilon alios <kilon.alios(a)gmail.com> wrote:
> Well I tried, several times , but I am not happy with the end result. In any
> case I am finished with this and since I promised to upload it here it is
>
> https://www.youtube.com/watch?v=Ol5ivaEATLQ
I love it, really. It shows plenty of useful stuff. You English is
clear to me even if I'm no native speaker so that's a great bonus.
Marcus, can we add that to the Pharo channel on youtube?
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill
April 25, 2014
Re: [Pharo-users] glorp
by jtuchel@objektfabrik.de
Norbert,
you are right, I should have given an example of what I mean.
So here is one:
If you serialize an object graph to, say, json and store it in a NoSQL
DB, you need to decide how "deep" you serialize your graph into one
djson document and how to build up segments of your graph that need to
be serialized separately, like for an equivalent of an 1:n relationship.
Exanple: an Order contains OrderItems, each of which reference a
Product. But the Product can be referenced from many OrderItems. So you
need to "cut off" parts of your model to serialize them separately. And
you need a way to save the "reference".
One of the next questions then is "what if I delete a Product?". What
happens to the OrderItems or InvoiceItems and so on?
None of these problems are unsolvable, but these problems need to be
addressed either in your persistence framework on top of a NoSQl DB or
in your application code. In Relational DBs, they've built solutions for
these problems before you and I were born ;-) I am talking of foreign
keys, referential integrities and normalization. To my knowledge, these
have not yet found their standardized counterparts in NoSQL DBs. So
NoSQL can be a good solution for many problems, but they can also be bad
for many others.
I am not saying anything new here. This debate has been going on for
decades already, and much more clever people than me have made good
points for both sides over the years now.
You also asked for examples for problems you get from using Glorp.
One of my biggest concerns is that it can be hard to model an m:n
relationship where one or both sides of the relationship are abstract
superclasses (or even concrete ones with multiple subclasses). It gets
even harder when you want to be able to associate an object (like a
Category or Tag) to "anything". This really is hard or involves some
additional coding on top of the persistence framework.
Glorp does miss one feature painfully: The ability to map classes with
subclasses that spread over three or more "subtables" for the
subclasses. This one is hard to explain: if you have a superclass
"Vehicle" with two subclasses "FlyingVehicle" and "DrivingVehicle", both
of which have subclasses, there is no support for a model which has
tables on the "FlyingVehicle" or "DrivingVehicle" level. You must model
your DB in a way that there are all attributes in a "Vehicle" table or
in the "Car", "Train", "Spaceship" and "Kite" tables. This really is a
pity and I don't think anybody is working on changing this any time soon.
Does this explain what I mean?
Joachim
Am 25.04.14 08:41, schrieb Norbert Hartl:
>
>
> Am 25.04.2014 um 06:51 schrieb Joachim Tuchel <jtuchel(a)objektfabrik.de
> <mailto:jtuchel@objektfabrik.de>>:
>
>> Hi,
>>
>> We're using Glorp on VA ST for kontolino.de <http://kontolino.de>. It
>> is an active project in the sense of somebody is taking care of bugs.
>> The lead developer(s) work(s) for Cincom - and Cincom uses Glorp as
>> supported component of CST. Instantiations also provides Glorp with
>> VA ST and supports it. Glorp is very stable and is not moving fast,
>> which is not a disadvantage for a production system. Features are
>> being added and bugs are fixed.
>>
>> Re: Pharoers do NoSQL: judging from the discussions on this list and
>> others, you have to be careful what you need. To me it seems many
>> developers want features from relational DBs and hammer them into
>> their applications with brute force. The first wow! soon gives room
>> to a lot of problems that have been solved in relational DBs three
>> decades ago.
>>
> I think such a statement should be based on an example.
>
>> But it is true that o/r mapping is not always fun. It can force you
>> to make decisions about your model that look strange from the object
>> perspective.
>>
> Agreed. And especially in the context of O/R I'm curious what will be
> your example to prove your point above.
>
> Couldn't resist,
>
> Norbert
>> I'd either go full objects (gemstone, magma) or relational for my
>> typical projects (business apps).
>>
>> Hth
>>
>> Joachim
>>
>> Clément Bera <bera.clement(a)gmail.com <mailto:bera.clement@gmail.com>>
>> schrieb:
>>
>> Hello,
>>
>> I think Glorp is used with DBXTalk for relational databases by
>> multiple people.
>>
>> Usually, with Pharo, people use as a persistance layer either MongoDB
>> with the frameworks MongoTalk/Voyage.
>>
>> Gemstone is also used quite often for large scale application but
>> Gemstone is not free.
>>
>> Regards.
>>
>>
>> 2014-04-23 20:34 GMT-07:00 Pablo R. Digonzelli <pdigonzelli(a)gmail.com
>> <mailto:pdigonzelli@gmail.com>>:
>>
>> Hi all, can someone tell me if glorp is active there ar is using
>> glorp or other persistence framework in production projects?
>>
>> Tia
>>
>> ****
>> ------------------------------------------------------------------------
>> *Ing. Pablo Digonzelli*
>> Software Solutions
>> IP-Solutiones SRL
>> Metrotec SRL
>> 25 de Mayo 521
>> Email: pdigonzelli(a)softsargentina.com
>> <mailto:pdigonzelli@softsargentina.com>
>> pdigonzelli(a)gmail.com <mailto:pdigonzelli@gmail.com>
>> Cel: 5493815982714
>>
>>
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
April 25, 2014
Re: [Pharo-users] glorp
by Norbert Hartl
> Am 25.04.2014 um 06:51 schrieb Joachim Tuchel <jtuchel(a)objektfabrik.de>:
>
> Hi,
>
> We're using Glorp on VA ST for kontolino.de. It is an active project in the sense of somebody is taking care of bugs. The lead developer(s) work(s) for Cincom - and Cincom uses Glorp as supported component of CST. Instantiations also provides Glorp with VA ST and supports it. Glorp is very stable and is not moving fast, which is not a disadvantage for a production system. Features are being added and bugs are fixed.
>
> Re: Pharoers do NoSQL: judging from the discussions on this list and others, you have to be careful what you need. To me it seems many developers want features from relational DBs and hammer them into their applications with brute force. The first wow! soon gives room to a lot of problems that have been solved in relational DBs three decades ago.
>
I think such a statement should be based on an example.
> But it is true that o/r mapping is not always fun. It can force you to make decisions about your model that look strange from the object perspective.
>
Agreed. And especially in the context of O/R I'm curious what will be your example to prove your point above.
Couldn't resist,
Norbert
> I'd either go full objects (gemstone, magma) or relational for my typical projects (business apps).
>
> Hth
>
> Joachim
>
> Clément Bera <bera.clement(a)gmail.com> schrieb:
>
> Hello,
>
> I think Glorp is used with DBXTalk for relational databases by multiple people.
>
> Usually, with Pharo, people use as a persistance layer either MongoDB with the frameworks MongoTalk/Voyage.
>
> Gemstone is also used quite often for large scale application but Gemstone is not free.
>
> Regards.
>
>
> 2014-04-23 20:34 GMT-07:00 Pablo R. Digonzelli <pdigonzelli(a)gmail.com>:
>> Hi all, can someone tell me if glorp is active there ar is using glorp or other persistence framework in production projects?
>>
>> Tia
>>
>> Ing. Pablo Digonzelli
>> Software Solutions
>> IP-Solutiones SRL
>> Metrotec SRL
>> 25 de Mayo 521
>> Email: pdigonzelli(a)softsargentina.com
>> pdigonzelli(a)gmail.com
>> Cel: 5493815982714
>>
>
April 25, 2014
Re: [Pharo-users] glorp
by Joachim Tuchel
Hi,
We're using Glorp on VA ST for kontolino.de. It is an active project in the sense of somebody is taking care of bugs. The lead developer(s) work(s) for Cincom - and Cincom uses Glorp as supported component of CST. Instantiations also provides Glorp with VA ST and supports it. Glorp is very stable and is not moving fast, which is not a disadvantage for a production system. Features are being added and bugs are fixed.
Re: Pharoers do NoSQL: judging from the discussions on this list and others, you have to be careful what you need. To me it seems many developers want features from relational DBs and hammer them into their applications with brute force. The first wow! soon gives room to a lot of problems that have been solved in relational DBs three decades ago.
But it is true that o/r mapping is not always fun. It can force you to make decisions about your model that look strange from the object perspective.
I'd either go full objects (gemstone, magma) or relational for my typical projects (business apps).
Hth
Joachim
Clément Bera <bera.clement(a)gmail.com> schrieb:
>Hello,
>
>I think Glorp is used with DBXTalk for relational databases by multiple
>people.
>
>Usually, with Pharo, people use as a persistance layer either MongoDB with
>the frameworks MongoTalk/Voyage.
>
>Gemstone is also used quite often for large scale application but Gemstone
>is not free.
>
>Regards.
>
>
>2014-04-23 20:34 GMT-07:00 Pablo R. Digonzelli <pdigonzelli(a)gmail.com>:
>
>> Hi all, can someone tell me if glorp is active there ar is using glorp or
>> other persistence framework in production projects?
>>
>> Tia
>>
>> ------------------------------
>> *Ing. Pablo Digonzelli*
>> Software Solutions
>> IP-Solutiones SRL
>> Metrotec SRL
>> 25 de Mayo 521
>> Email: pdigonzelli(a)softsargentina.com
>> pdigonzelli(a)gmail.com
>> Cel: 5493815982714
>>
>>
April 25, 2014
Dynamic example for spec
by Stephan Eggermont
While trying to understand spec, Iâve written an example of using dynamic specs.
https://github.com/StephanEggermont/documentation/blob/master/SpecDynamicEx…
A list of parties, where instances of different subclasses can be added.
Comments & improvements are welcome.
Stephan
!!Parties, a dynamic example
In an address book we find addresses of both people and organizations.
The generalization of both is called a party ('Analysis Patterns', Martin Fowler).
In this example we'll make an address book where we can add both persons and companies.
They will have different attributes.
We show how to do add them with a dynamic user interface, and minimize duplication.
!!! The party model
Create the abstract superclass ==Party==
[[[
Object subclass: #DOParty
instanceVariableNames: ''
classVariableNames: ''
category: 'Domain-Parties'
]]
A party responds to the ==fullName== message.
[[[
DOParty>fullName
^'Full name'
]]]
The subclasses are going to override this message.
Create a subclass for persons:
[[[
DOParty subclass: #DOPerson
instanceVariableNames: 'firstName lastName'
classVariableNames: ''
category: 'Domain-Parties'
]]]
Create accessors for ==firstName== and ==lastName==. We don't want to need to handle ==nil==
as a special case, so return the empty string if the instVars are nil.
[[[
DOPerson>firstName
^firstName ifNil: [ '' ]
DOPerson>firstName: aString
firstName := aString
DOPerson>lastName
^lastName ifNil: [ '' ]
DOPerson>lastName: aString
lastName := aString
]]]
We can now override the ==fullName==.
[[[
DOPerson>fullName
^self firstName, ' ', self lastName
]]]
Create a subclass for companies
[[[
DOParty subclass: #DOCompany
instanceVariableNames: 'companyName'
classVariableNames: ''
category: 'Domain-Parties'
]]]
And its accessors and the overridden method
[[[
DOCompany>companyName
^ companyName ifNil: ['']
DOCompany>companyName: anObject
companyName := anObject
DOCompany>fullName
^ self companyName
]]]
In this example we will simply keep all parties in the image.
We create a class to hold parties
[[[
Object subclass: #DOPartiesModel
instanceVariableNames: 'parties'
classVariableNames: ''
category: 'Domain-Parties'
]]]
And lazily initialize with a collection
[[[
DOPartiesModel>parties
^parties ifNil: [ parties := OrderedCollection new ]
DOPartiesModel>parties: aCollection
parties := aCollection
]]]
On the class side we add an instanceVariable ==default== as the singleton
and two methods to access and reset it.
[[[
DOPartiesModel class
instanceVariableNames: 'default'
DOPartiesModel>>default
^default ifNil: [ default := self new ]
DOPartiesModel>>reset
default := nil
]]]
!!! A dynamic editor
To edit a single party, we create a subclass of ==DynamicComposableModel==
[[[
DynamicComposableModel subclass: #DOPartyEditor
instanceVariableNames: 'partyClass'
classVariableNames: ''
category: 'Domain-Parties'
]]]
When we instantiate this editor, we'll tell it on what kind of party it operates and store that in the
==partyClass==. On the instance side we add accessors and on the class side we use that in a constructor.
A ==DynamicComposableModel== has a complex initialization proces, so we use a separate ==basicNew==
and ==initialize== to set the ==partyClass== early enough.
[[[
DOPartyEditor>partyClass: aPartyClass
partyClass := aPartyClass
DOPartyEditor>partyClass
^partyClass
DOPartyEditor>>on: aPartyClass
^self basicNew
partyClass: aPartyClass;
initialize;
yourself
]]]
This class has no ==defaultSpec==, as it is only created with a dynamic spec.
The editor is going to be a separate window. The window title is dependent of the class.
Party and subclasses define it at the class side.
[[[
DOParty>>title
"override in subclasses"
^'Party'
DOCompany>>title
^'Company'
DOPerson>>title
^'Person'
DOPartyEditor>title
^ partyClass title
]]]
The editor needs to know what fields need to be created. On the class side of the Party subclasses
we return an array of symbols representing the fields. This will do for the example, for a real
application with differnt kinds of fields Magritte descriptions are much more suitable.
[[[
DOParty>>fields
^self subclassResponsibility
DOCompany>>fields
^#(#companyName)
DOPerson>>fields
^#(#firstName #lastName)
]]]
Now we can initialize the widgets. ==instantiateModels== expects pairs of field names and field types
and adds them to the widgets dictionary.
They are then laid out in one column, given some default values and added in focus order.
[[[
DOPartyEditor>initializeWidgets
|models|
models := OrderedCollection new.
partyClass fields do: [ :field | models add: field; add: #TextInputFieldModel ].
self instantiateModels: models.
layout := SpecLayout composed
newColumn: [ :col |
partyClass fields do: [ :field |
col add: field height: self class inputTextHeight]];
yourself .
self widgets keysAndValuesDo: [ :key :value |
value autoAccept: true;
entryCompletion:nil;
ghostText: key.
self focusOrder add: value] .
]]]
The last thing needed is to calculate how large the window should be. It is going to be used
as a dialog with ok and cancel that take up a height of about three input fields.
[[[
DOPartyEditor>initialExtent
^ 300@(self class inputTextHeight*(3+partyClass fields size))
]]]
Now we can test the editor with ==(DOPartyEditor on: DOCompany) openDialogWithSpec== and
==(DOPartyEditor on: DOPerson) openDialogWithSpec==
!!! The adres book
We can now make the address book with a search field and buttons to add persons and companies.
Add a class
[[[
ComposableModel subclass: #DOPartiesList
instanceVariableNames: 'search addPerson addCompany list'
classVariableNames: ''
category: 'Domain-Parties'
]]]
As soon as something is typed in the search field, the list should show the list of parties
having a fullName containing the search term, ignoring case.
[[[
DOPartiesList>refreshItems
|searchString|
searchString := search text asLowercase.
list
items: (DOPartiesModel default parties select: [: each |
searchString isEmpty or: [each fullName asLowercase includesSubstring: searchString]]);
displayBlock: [ :each | each fullName].
]]]
We can now create the widgets and the default layout (class side)
[[[
DOPartiesList>initializeWidgets
search := self newTextInput.
search autoAccept: true;
entryCompletion:nil;
ghostText: 'Search'.
addPerson := self newButton.
addPerson label: '+Person'.
addCompany := self newButton.
addCompany label: '+Company'.
list := self newList.
self refreshItems.
self focusOrder
add: search;
add: addPerson;
add: addCompany;
add: list.
DOPartiesList>>defaultSpec
<spec: #default>
^SpecLayout composed
newColumn: [ :col |
col newRow: [:row |
row add: #search;
add: #addPerson;
add: #addCompany]
height: ComposableModel toolbarHeight;
add: #list];
yourself
]]]
]]]
When the user clicks on the ok button of the party editor, we need to create an instance of the right
subclass, read the field values out of the editor and assign them to the attributes of the new instance.
We do that using meta-programming (==perform:== and ==perform:with:==).
Then we add the instance to the model and need to refresh the list. Add a method setting the okAction
block of the editor.
[[[
DOPartyList>addPartyBlockIn: anEditor
anEditor okAction: [ |party|
party := anEditor model partyClass new.
anEditor model partyClass fields do: [ :field |
party perform: (field asMutator) with: (anEditor model perform: field) text ].
DOPartiesModel default parties add: party.
self refreshItems ].
]]]
Now we can initialize the presenter
[[[
DOPartyList>initializePresenter
search whenTextChanged: [ :class | self refreshItems ].
addPerson action: [ |edit|
edit := (DOPartyEditor on:DOPerson) openDialogWithSpec.
self addPartyBlockIn: edit].
addCompany action: [ |edit|
edit := (DOPartyEditor on: DOCompany) openDialogWithSpec.
self addPartyBlockIn: edit ]
]]]
Don't forget the accessors
[[[
DOPartyList>addCompany
^addCompany
DOPartyList>addPerson
^addPerson
DOPartyList>items: aCollection
list items: aCollection
DOPartyList>list
^list
DOPartyList>search
^search
]]]
protocol
[[[
DOPartyList>resetSelection
list resetSelection
DOPartyList>title
^ 'Parties'
]]]
and protocol-events
[[[
DOPartyList>whenAddCompanyClicked: aBlock
addCompany whenActionPerformedDo: aBlock
DOPartyList>whenAddPersonClicked: aBlock
addPerson whenActionPerformedDo: aBlock
DOPartyList>whenSelectedItemChanged: aBlock
list whenSelectedItemChanged: aBlock
]]]
This can be tested with ==DOPartiesList new openWithSpec==
April 24, 2014
Re: [Pharo-users] glorp
by Sergi Reyner
2014-04-24 17:58 GMT+01:00 James Foster <Smalltalk(a)jgfoster.net>:
> On Apr 23, 2014, at 9:02 PM, Clément Bera <bera.clement(a)gmail.com> wrote:
>
> Gemstone is also used quite often for large scale application but Gemstone
> is not free.
>
>
> GemStone/S 64 Bit is used for both large and small applications, and
> GemStone/S 64 Bit has a free for commercial use license available (see
> http://seaside.gemtalksystems.com/)
>
Then again, free is not the same as free ;-)
Cheers,
Sergi
April 24, 2014
Re: [Pharo-users] We need *you* for the upcoming Pharo's website
by kilon alios
Thank you, I am glad you guys enjoyed it.
This is my first screencast on Pharo so I was not so sure about myself.
Esteban I agree, though I would like to target newcomers to Pharo than
experienced Pharo coders. I will try to cut down my videos to smaller
sections, or I will offer a table of contents and maybe some easy
navigation so you dont have to watch 1 hour video if you dont want to to
get to the feature that interests you. I will have to investigate an
efficient way to do this.
On Thu, Apr 24, 2014 at 4:46 PM, Esteban A. Maringolo
<emaringolo(a)gmail.com>wrote:
> Kilon:
>
> As a general rule of thumb I'd prefer videos in smaller chunks or
> coordinated by a slideshow. Longer videos are always queued in the
> "watch later" playlist, which in my case have almost 10 hours of
> things to watch :D
>
> And if you feel willing to do more videos, do them!
> I don't like "screencasts by committee" (nor anything by committee),
> so the more the better, most of the times you can't measure beforehand
> the usefulness of these kind of things.
>
> Regards!
>
> Esteban A. Maringolo
>
>
> 2014-04-24 8:20 GMT-03:00 kilon alios <kilon.alios(a)gmail.com>:
> > Thank Esteban, when even a few people appreciate my effort it motivates
> me
> > to keep trying.
> >
> > My goal indeed was to introduce Pharo without going into depth to people
> > that are not experienced coders or not coders at all. I am now
> considering
> > doing a screencast explaining the basics of Pharo language with
> introduction
> > to IDE as well. Basic stuff, like how the language works, Object
> > orientation, Browser , Deubuger, Inspector etc.
> >
> > If I see interest I will do it, if not, so be it.
> >
> > I can even see myself do screencasts about, Morphic, Spec, Roassal,
> Athens,
> > Nativeboost and much more. But again it depends on how useful people
> find my
> > screencasts cause this experience is very new to me and I know I am no
> pro
> > on this department.
> >
> >
> > On Thu, Apr 24, 2014 at 11:40 AM, Esteban Lorenzano <estebanlm(a)gmail.com
> >
> > wrote:
> >>
> >> Hi,
> >>
> >> I really like it as an introduction of what pharo can do :)
> >>
> >> thanks!
> >> Esteban
> >>
> >> On 23 Apr 2014, at 21:32, kilon alios <kilon.alios(a)gmail.com> wrote:
> >>
> >> Well I tried, several times , but I am not happy with the end result. In
> >> any case I am finished with this and since I promised to upload it here
> it
> >> is
> >>
> >>
> >> https://www.youtube.com/watch?v=Ol5ivaEATLQ
> >>
> >> Sorry I cannot deliver something of better quality but thats the best I
> >> can do. If you don't like it, I wont blame you :D
> >>
> >>
> >>
> >> On Tue, Apr 22, 2014 at 3:14 PM, Damien Cassou <damien.cassou(a)gmail.com
> >
> >> wrote:
> >>>
> >>> On Mon, Apr 21, 2014 at 10:40 PM, kilon alios <kilon.alios(a)gmail.com>
> >>> wrote:
> >>> > I am still on vacations and the internet is very slow here. I will be
> >>> > able to upload something by the end of this weekend. My idea is to
> >>> > illustrate 6 points in 6-10 minutes that to my opinion make Pharo a
> >>> > very useful and fun choice.
> >>>
> >>>
> >>> please do. Even if you are late, we will evaluate your screencast and
> >>> maybe replace one that is already there. Or put it in a dedicated
> >>> section somewhere else. We desperately need good screencasts.
> >>>
> >>> Thanks for the offer
> >>>
> >>> --
> >>> Damien Cassou
> >>> http://damiencassou.seasidehosting.st
> >>>
> >>> "Success is the ability to go from one failure to another without
> >>> losing enthusiasm."
> >>> Winston Churchill
> >>>
> >>
> >>
> >
>
>
April 24, 2014
Re: [Pharo-users] glorp
by James Foster
On Apr 23, 2014, at 9:02 PM, Clément Bera <bera.clement(a)gmail.com> wrote:
> Gemstone is also used quite often for large scale application but Gemstone is not free.
GemStone/S 64 Bit is used for both large and small applications, and GemStone/S 64 Bit has a free for commercial use license available (see http://seaside.gemtalksystems.com/)
James
April 24, 2014