<div dir="ltr">In fact, for that case sending #remove: is just enough.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 14, 2024 at 10:24 AM Andres Valloud via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Speaking of duplicated code, does category understand findFirst:? <br>
Because if so...<br>
<br>
        | index |<br>
        index := aCategory findFirst: [:x | aName = x].<br>
        index = 0 ifTrue: [^blockToValue value].<br>
        aCategory removeAt: index.<br>
        ^aName<br>
<br>
On 9/13/24 4:47 PM, Damián Ortiz via Cuis-dev wrote:<br>
> Hello,<br>
> <br>
> I am Damian, a student in my second year of computer degree in <br>
> Universidad de Buenos Aires. Right now I am taking a class called <br>
> "Software engineering" whose professor is Hernan Wilkinson and we use <br>
> cuis university.<br>
> <br>
> While I was doing my homework which is about getting repeated code out, <br>
> I got a problem when I had repeated code in which the only instance <br>
> variables that changed were the ones called: active and suspended. I <br>
> decided to parametrize that code in another method in which both <br>
> suspended and active were replaced by category, and category was a <br>
> parameter. So the previous code was replaced by two lines, one calling <br>
> the method with active, and the other with suspended.<br>
> <br>
> However, you can not extract that variable as an argument. So I had to <br>
> do it manually, change all active and suspended, one by one.<br>
> <br>
> I think the fact of being able to parametrize a variable as an argument, <br>
> and also be able to parametrize it as an argument that already exists <br>
> (When it asks you for the name of the label, it detects if there is <br>
> already an argument called by that, it is parametrized as that already- <br>
> existed parameter).<br>
> <br>
> I would like you to tell me what you think about this change, and maybe <br>
> give me a hint to try to implement it. I do think this would help to <br>
> extract different-named objects/variables as a single parameter, and <br>
> also extract variables as parameters.<br>
> <br>
> Thank you for reading.<br>
> <br>
> I attach the code I talk about here (The given and the desired ones)<br>
> <br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></strong></span></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div style="font-size:12.8px"><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div><div style="font-size:12.8px"><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div>