[erlang-questions] If you are homesick for object.selector

Steve Strong steve@REDACTED
Mon Jan 28 20:00:53 CET 2013


Lol, excellent :)

Sent from my iPhone

On 28 Jan 2013, at 17:16, Evan Miller <emmiller@REDACTED> wrote:

> On Mon, Jan 28, 2013 at 7:18 AM, Robert Virding
> <robert.virding@REDACTED> wrote:
>> There was an even better one mentioned in the test:
>> 
>> if(hasrating)
>> {
>>    thechkbox = currRating[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children(2).children(0).children(0)
>>    thechkbox.disabled = false;
>> }
>> 
>> :-)
> 
> From my understanding of the Law of Demeter, a proper rewrite would look like:
> 
> if (hasrating)
> {
>   thechkbox = currRating[0].firstChildOfFirstChildOfThirdChildOfParentOfParentOfParentOfParentOfParentOfParent();
>   thechkbox.disabled = false;
> }
> 
> --
> Evan Miller
> http://www.evanmiller.org/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list