Hi,

are there any best practices/idioms in regards to object configuration/building?

Let's say I want to configure a TwitterClient that requires a username and a password that is stored in a separate object TwitterConfiguration

a) the basic approach (either separate sends or via cascade, that is not relevant here)

client := TwitterClient new.
client configuration username: 'XX'.
client configuration password: 'YY'.


b) #in: ...

It feels a bit more organized as it basically groups related operations together.
Also maybe avoiding demeter a bit?

client := TwitterClient new.
client configuration in: [ :config |
config username: 'XX'.
config password: 'YY'.
].

c) custom #somethingDo: method that basically does #in:

Again, feels more organized. Additionally one could perform some validation afterwards (to make sure the credentials are ok or whatever).

client := TwitterClient new.
client configurationDo: [ :config |
config username: 'XX'.
config password: 'YY'
].

Any thoughts on this?

Thanks,
Peter