[Pharo-users] Use cases for methods with optional parameters

Esteban A. Maringolo emaringolo at gmail.com
Wed Jan 20 12:14:14 EST 2016

2016-01-20 14:01 GMT-03:00 Offray Vladimir Luna Cárdenas <offray at riseup.net>:
> Hi,
> As a newbie, without a clear idea of where to apply this specifically I can
> say that seems pretty interesting. I have methods with several parameters
> (may be product of my newbie code), but making them optional seems an idea
> worthy to explore.
> Cheers,

In a pure object oriented approach, if you have a lot of varying
parameters is a sign that you might need to reify the parameters as a
first class object, i.e. "SomethingParameters" class or similar, then
instead of passing 1...n objects that will work as parameters you only
pass one object, aSomethingParameters.

Of course it adds more friction to something that maybe the language
could provide, but in Smalltalk everything is explicit.

I would be interested in the use cases and how to deal with
"undefined" arguments, will they be nil or other kind of undefined


Esteban A. Maringolo

More information about the Pharo-users mailing list