Bahman Movaqar wrote:
Hi all,
I'm writing a series of tutorials for Spec for beginners like myself and
I'd really appreciate any input on the material.
The first episode is done: http://www.bahmanm.com/blogs/spec-part-1-basics
Thanks Bahman. I like your writing style and theme. The code snippets
are well presented. What platform is your blog hosted on?
Some feedback...
-----------
Not sure if you should be prompting people to dirty the Spec package by
using example category Spec-Tutorial. Even though there is currently no
such a package, one day there might be. Perhaps using category
My-Spec-Tutorial would be better alternative.
----------------
> further radio buttons setup is done in setupTitleRadioButtons:
looks like it should lose the colon at the end of the method name
-------------
An alternative to the nested IF statements in MyFirstWindow>>userTitle...
If you extend RadioButtonGroup with...
RadioButtonGroup>>selected
^buttons detect: [:b | b state ].
and add instance variable 'radioButtonGroup' to MyFirstWindow
and in MyFirstWindow>>setupTitleRadioButtons do....
radioButtonGroup := RadioButtonGroup new
then you could have...
MyFirstWindow>>userTitle
^ radioButtonGroup selected label
Then again, for someone completely new to Smalltalk, the nested IF
statements might be more familiar. So perhaps leave that part as it is,
then describe how to refactor the code to be more 'Pharo' like. You
might say... "at the time I did this, the RadioButtonGroup class was
missing a method to return the selected button, but it was simple to
extend the library with the following...."
Note that I tested this on Pharo3, but I expect Pharo 2 would be the
same for this case.
cheers -ben