[Cuis-dev] Would like to contribute

Andres Valloud ten at smallinteger.com
Sat Sep 14 06:23:10 PDT 2024


Speaking of duplicated code, does category understand findFirst:? 
Because if so...

	| index |
	index := aCategory findFirst: [:x | aName = x].
	index = 0 ifTrue: [^blockToValue value].
	aCategory removeAt: index.
	^aName

On 9/13/24 4:47 PM, Damián Ortiz via Cuis-dev wrote:
> Hello,
> 
> I am Damian, a student in my second year of computer degree in 
> Universidad de Buenos Aires. Right now I am taking a class called 
> "Software engineering" whose professor is Hernan Wilkinson and we use 
> cuis university.
> 
> While I was doing my homework which is about getting repeated code out, 
> I got a problem when I had repeated code in which the only instance 
> variables that changed were the ones called: active and suspended. I 
> decided to parametrize that code in another method in which both 
> suspended and active were replaced by category, and category was a 
> parameter. So the previous code was replaced by two lines, one calling 
> the method with active, and the other with suspended.
> 
> However, you can not extract that variable as an argument. So I had to 
> do it manually, change all active and suspended, one by one.
> 
> I think the fact of being able to parametrize a variable as an argument, 
> and also be able to parametrize it as an argument that already exists 
> (When it asks you for the name of the label, it detects if there is 
> already an argument called by that, it is parametrized as that already- 
> existed parameter).
> 
> I would like you to tell me what you think about this change, and maybe 
> give me a hint to try to implement it. I do think this would help to 
> extract different-named objects/variables as a single parameter, and 
> also extract variables as parameters.
> 
> Thank you for reading.
> 
> I attach the code I talk about here (The given and the desired ones)
> 



More information about the Cuis-dev mailing list