Optimizing #isRestful

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Optimizing #isRestful

Reza Razavi
Hi Lukas, all,

#isRestful is called by PRContext >> urlOn:, typically via the
PRMenuRenderer (so, upon every page refresh), which delegates to the
current Command, which, in the case of PRViewCommand, delegates in
turn to its 'viewComponent'.

To avoid creating an instance of the #viewComponentClass just to
check if its #isRestful, would it make sense to:
1) Move to the class side the four occurrences of #isRestful
implementation in the PRViewComponent hierarchy, and then
2) Change the code in PRViewCommand to delegate to #viewComponentClass?

Regards,
Reza

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Optimizing #isRestful

Lukas Renggli
Sorry for not replying earlier. That sounds like a good idea. I don't
see anybody depending on the instance-side implementation.

Lukas

On 10 August 2010 23:41, Reza Razavi <[hidden email]> wrote:

> Hi Lukas, all,
>
> #isRestful is called by PRContext >> urlOn:, typically via the
> PRMenuRenderer (so, upon every page refresh), which delegates to the current
> Command, which, in the case of PRViewCommand, delegates in turn to its
> 'viewComponent'.
>
> To avoid creating an instance of the #viewComponentClass just to check if
> its #isRestful, would it make sense to:
> 1) Move to the class side the four occurrences of #isRestful implementation
> in the PRViewComponent hierarchy, and then
> 2) Change the code in PRViewCommand to delegate to #viewComponentClass?
>
> Regards,
> Reza
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Optimizing #isRestful

Reza Razavi
At 08:53 18/08/2010, Lukas Renggli wrote:
>I don't see anybody depending on the instance-side implementation.

Thanks for your response Lukas.
I'll propose a patch asap.

Regards,
Reza

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Optimizing #isRestful

Lukas Renggli
I already committed  a patch :-)

On 18 August 2010 09:28, Reza Razavi <[hidden email]> wrote:

> At 08:53 18/08/2010, Lukas Renggli wrote:
>>
>> I don't see anybody depending on the instance-side implementation.
>
> Thanks for your response Lukas.
> I'll propose a patch asap.
>
> Regards,
> Reza
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Optimizing #isRestful

Lukas Renggli
Name: Pier-Seaside-lr.489
Author: lr
Time: 18 August 2010, 9:20:02 am
UUID: 4b4b1ed3-369e-4a1b-93cd-bc3dc0374ddd
Ancestors: Pier-Seaside-lr.488

- moved #isRestful to class-side

Also Seaside needs a patch to work with the latest Pier:

Name: Seaside-Core-lr.656
Author: lr
Time: 18 August 2010, 9:19:12 am
UUID: 8571f819-9d9b-4fbd-bf2f-0e612da035cf
Ancestors: Seaside-Core-pmm.655

- re-added #hasCookieInContext:, it is required by other software

On 18 August 2010 09:29, Lukas Renggli <[hidden email]> wrote:

> I already committed  a patch :-)
>
> On 18 August 2010 09:28, Reza Razavi <[hidden email]> wrote:
>> At 08:53 18/08/2010, Lukas Renggli wrote:
>>>
>>> I don't see anybody depending on the instance-side implementation.
>>
>> Thanks for your response Lukas.
>> I'll propose a patch asap.
>>
>> Regards,
>> Reza
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Optimizing PRViewCommand >> label

Reza Razavi
In reply to this post by Lukas Renggli
At 09:29 18/08/2010, Lukas Renggli wrote:
I already committed  a patch :-)

Impressive; thanks!

Just in case you would still have some time to devote, a similar case is "PRViewCommand >> label", which is in particular often called by "WAAnchorTag >> goto:"

An alternative would be:
PRViewCommand >> label
        ^ self viewComponentClass labelIn: self context

Which would imply for example:
PRDefaultView class >> labelIn: aContext
        ^ aContext structure title

And eventually:
PRDefaultView >> label
        ^ self class labelIn: sel context

In the "worth" case, the class would instantiate itself to compute its label.

That could though break the plug-ins that depend on the current behavior.

Regards,
Reza
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki