[Cuis-dev] added push down to single subclass refactor option

Hernán Wilkinson hernan.wilkinson at 10pines.com
Mon May 29 12:57:23 PDT 2023


Hi Paolo,
 I just uploaded your code.
 I made a few changes:
1) Made PushDownMethod a superclass of PushDownMethodToOneSubclass (your
code) and PushDownMethodToSubclasses
2) Renamed the appliers
3) Refactored the tests. There were tests in your code that did not apply
to this refactoring.
4) Based on Christian Haider comment, if applying the change is not a
refactoring, it will warn the user

Thank you for your suggestions!
I hope you liked how it ended up being and let me know any questions you
may have.

Cheers!
Hernan

On Thu, May 25, 2023 at 11:33 AM Paolo Belforte <pbelforte2003 at gmail.com>
wrote:

> Hi, I made the changes suggested and added the tests to the package, hope
> it works this time!
> The classes and related names changed to "PushDownMethodToSubclass..." and
> the applier now is responsible to ask for the subclass name.
> Also, thanks for the information about refactoring, I thought any changes
> to code was considered a refactor.
>
> Thanks, Paolo.
>
> El mié, 24 may 2023 a las 18:23, Hernán Wilkinson (<
> hernan.wilkinson at 10pines.com>) escribió:
>
>> Hi Paolo,
>>  thanks for this change set, it is a useful one and you did a great job
>> for a new smalltalker!!
>>  There are some changes to be done before merging it.
>> 1) The refactoring implementation, PushDownToMethod in your case, should
>> not interact with the user, therefore it should not ask to witch subclass
>> move the method to, it should not do: StringRequestMorph request: ....
>>  The refactoring class should receive in its instance creation message
>> all the necessary objects to do its job, in this case it should receive the
>> subclass to pushdown the method to.
>> 2) It should be the applier the one asking for the subclass to push down
>> the method to
>> 3) There are no tests for the refactoring and we want all refactoring to
>> be tested. Please write the corresponding tests that should be part of the
>> package BaseImageTests.pck.st  This package is not automatically loaded
>> in Cuis, you have to load it yourself (unless you are using
>> CuisUniversity who has the tests loaded).
>> PushDownToMethod should receive the class from which to push down the
>> method, the method to push down and the subclass to push down the method
>> to. There you have many things to test, like is the method implemented in
>> the class from where to push it down? Is the subclass really a subclass of
>> the class that implements the method? And then you have all the assertions
>> of the pushdown method refactoring. Look at PushDownMethod class>>#for:
>>
>> BTW, PushDownToMethod is not a good name for this refactoring. I would
>> call it PushDownMethoToSubclass.
>>
>> Let me know if you have questions.
>> I'll wait for all these changes to integrate it!
>>
>> Cheers
>> Hernan
>>
>> PS: BTW, it is Smalltalk (lowercase t) not SmallTalk ... just a minor
>> thing to have in mind :-)
>>
>> On Tue, May 23, 2023 at 6:02 AM Christian Haider via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> this is not a refactoring, since it changes the behavior of the system.
>>> See Code refactoring - Wikipedia
>>> <https://en.wikipedia.org/wiki/Code_refactoring> .
>>>
>>> Everything is fine when you call it a code transformation. But, please,
>>> don’t shift the meaning of “refactoring”.
>>>
>>>
>>>
>>> Happy hacking and have fun with Smalltalk,
>>>
>>> Christian
>>>
>>>
>>>
>>> *Von:* Cuis-dev <cuis-dev-bounces at lists.cuis.st> *Im Auftrag von *Paolo
>>> Belforte via Cuis-dev
>>> *Gesendet:* Dienstag, 23. Mai 2023 04:41
>>> *An:* cuis-dev at lists.cuis.st
>>> *Cc:* Paolo Belforte <pbelforte2003 at gmail.com>
>>> *Betreff:* [Cuis-dev] added push down to single subclass refactor option
>>>
>>>
>>>
>>> Hello everyone,
>>>
>>> I'm still new to SmallTalk, but I've made a change to the base image of
>>> Cuis, adding this new refactor option as I find it very useful.
>>> When you click this refactor, a "StringRequestMorph" asks for a name to
>>> pass the desired method to a single subclass. You can find this option just
>>> down the "push down" refactor, it's the "push down to".
>>>
>>>
>>> Thanks,
>>> Paolo.
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>>
>> --
>>
>> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
>> *Phone: +54-011*-4893-2057
>> *Twitter: @HernanWilkinson*
>> *site: http://www.10Pines.com <http://www.10pines.com/>*
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina
>>
>

-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230529/635a8884/attachment.htm>


More information about the Cuis-dev mailing list