[Cuis-dev] Methods that return multiple values

Hernán Wilkinson hernan.wilkinson at 10pines.com
Wed Jun 28 07:33:44 PDT 2023


Really interesting thread!!
I like Nicolas' idea, that is what I would do, for sure those objects will
have an interesting and growing protocol as we use them and do not break
encapsulation... but there are always exceptions.
The problem I see with JSON style objects (btw, it is really a JavaScript
idiom) is that we end up with a bunch of unnamed concepts that make
communication in a team difficult and therefore maintainability, etc etc.
The JavaScript community is abusing of these capabilities and having many
many problems because of it.
Regarding your comment Luciano, I'd like to mention that I think that when
programming we are not only modeling "the problem domain" (math in your
case) but also the problems we have when programming, it is like a
meta-circular relationship, so having "software engineering" classes should
not be a problem from my point of view... but it is a balance, a trade-off
we have to always make.

Cheers!
Hernan.

On Wed, Jun 21, 2023 at 11:34 AM Luciano Notarfrancesco via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Yes, I do that sometimes, but in general I avoid creating extra classes,
> and in my math project I make an extra effort to avoid creating new classes
> for objects that are neither algebraic structures nor morphisms or elements
> of algebraic structures (since usually those things are software
> engineering artifacts and not actual mathematical things). Also, it doesn’t
> simplify the use of the multiple returned values if I still have to send
> messages to this new object to obtain them and assign them to variables. I
> like the json objects that they have in Bee, tho, they can be very handy
> sometimes.
>
> On Wed, 21 Jun 2023 at 15:59 Nicolás Papagna Maldonado <
> nicolas.papagna at gmail.com> wrote:
>
>> Interesting!
>>
>> For multiple-value returns, how about an object holding these values?
>> I know this might introduce many of these tiny objects, but I'm okay with
>> that!
>>
>> IIRC Leandro implemented a feature in Bee where you can return anonymous
>> objects.
>> Something along the lines of {foo: 1, bar:2}. Then you can do `result
>> foo`, etc.
>>
>> I'm more on keeping the syntax simple camp, but that is an interesting
>> idea too.
>>
>> Cheers,
>> Nico PM
>>
>> On Wed, Jun 21, 2023 at 10:54 AM Mariano Montone via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>
>>> El 21/6/23 a las 10:44, Luciano Notarfrancesco via Cuis-dev escribió:
>>> > Interesting, thanks for sharing!
>>> > Actually I think it’s the same thing I did
>>>
>>> Yes, I think you've implemented destructuring rather than multiple-value
>>> return, as your solution can be applied to other things than method call
>>> returns.
>>>
>>> This is something nice to have, makes code more readable.
>>>
>>>
>>>      Mariano
>>>
>>>
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>>
>> --
>>
>> Nicolás Papagna
>>
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230628/47d84f98/attachment.htm>


More information about the Cuis-dev mailing list