Can I rewrite all spec examples from self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ). to the more explicit form: listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
Since UIPainter, example aren't needed :p Another way, than i like, is create a method for a model. Class>>listModel listModel ifNil: [ listModel := self instantiate: ListModel. and options ]. ^ listModel And do nothing in initializeWidgets 2013/9/21 Camillo Bruni <camillobruni@gmail.com>
Can I rewrite all spec examples from
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
to the more explicit form:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
-- Best regards, Douaille Erwan <douaille.erwan@gmail.com>
On 2013-09-21, at 14:35, Erwan Douaille <douailleerwan@gmail.com> wrote:
Since UIPainter, example aren't needed :p
Another way, than i like, is create a method for a model.
Class>>listModel listModel ifNil: [ listModel := self instantiate: ListModel. and options ]. ^ listModel
And do nothing in initializeWidgets
yeah I saw that you did that for the InspectorToolbar and I like this approach since you group all the settings for a specific widget in a single method. I remember vaguely that the UI framework under NetBeans did these kind of methods in Java...
On Sep 21, 2013, at 7:35 PM, Erwan Douaille <douailleerwan@gmail.com> wrote:
Since UIPainter, example aren't needed :p
euhhhhhhhh :P Ben
Another way, than i like, is create a method for a model.
Class>>listModel listModel ifNil: [ listModel := self instantiate: ListModel. and options ]. ^ listModel
And do nothing in initializeWidgets
2013/9/21 Camillo Bruni <camillobruni@gmail.com> Can I rewrite all spec examples from
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
to the more explicit form:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
-- Best regards,
Douaille Erwan <douaille.erwan@gmail.com>
What should be done is to first create some methods on ComposableModel like instantiateListModel, instantiateTextModel, etc so you hide at maximum the implementation details, and then you can do a more generic "self instantiate: MethodBrowser." The first version of Spec was like this:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
But then you find out there is always the same pattern, so Johan and I decided to introduce a way to encapsulate this. Then of course, do whatever you want :P Ben On Sep 21, 2013, at 7:29 PM, Camillo Bruni <camillobruni@gmail.com> wrote:
Can I rewrite all spec examples from
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
to the more explicit form:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
On 2013-09-21, at 16:11, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:
What should be done is to first create some methods on ComposableModel like instantiateListModel, instantiateTextModel, etc so you hide at maximum the implementation details, and then you can do a more generic "self instantiate: MethodBrowser."
The first version of Spec was like this:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
But then you find out there is always the same pattern, so Johan and I decided to introduce a way to encapsulate this.
Then of course, do whatever you want :P
actually true, something short like newButton / newList / newText ?
Yes, something like this :) Ben On Sep 21, 2013, at 9:17 PM, Camillo Bruni <camillobruni@gmail.com> wrote:
On 2013-09-21, at 16:11, Benjamin <benjamin.vanryseghem.pharo@gmail.com> wrote:
What should be done is to first create some methods on ComposableModel like instantiateListModel, instantiateTextModel, etc so you hide at maximum the implementation details, and then you can do a more generic "self instantiate: MethodBrowser."
The first version of Spec was like this:
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
But then you find out there is always the same pattern, so Johan and I decided to introduce a way to encapsulate this.
Then of course, do whatever you want :P
actually true, something short like newButton / newList / newText ?
participants (3)
-
Benjamin -
Camillo Bruni -
Erwan Douaille