slime rule to detect ajax requests that combine multiple primary callbacks

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

slime rule to detect ajax requests that combine multiple primary callbacks

Johan Brichau-2
Hi,

I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.

Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.

The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?

Any ideas are welcome.

cheers
Johan_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: slime rule to detect ajax requests that combine multiple primary callbacks

Lukas Renggli
Hi Johan,

The proposed rule seems to be very useful.

I would match all cascades with the pattern, and then in the action
block manually test if any of your selectors occurs more than once.

Cheers,
Lukas

On 1 September 2012 16:42, Johan Brichau <[hidden email]> wrote:

> Hi,
>
> I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
> When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.
>
> Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.
>
> The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?
>
> Any ideas are welcome.
>
> cheers
> Johan_______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: slime rule to detect ajax requests that combine multiple primary callbacks

Johan Brichau-2
Hi Lukas,

Thanks for the response. That indeed is a more scalable solution.
I don't seem to see a pattern to match cascades but perhaps it's sufficient to capture all statements that have a 'jQuery ajax' in there.

Simple enough. I will commit a new version soon.

cheers
Johan

On 01 Sep 2012, at 17:29, Lukas Renggli wrote:

> Hi Johan,
>
> The proposed rule seems to be very useful.
>
> I would match all cascades with the pattern, and then in the action
> block manually test if any of your selectors occurs more than once.
>
> Cheers,
> Lukas
>
> On 1 September 2012 16:42, Johan Brichau <[hidden email]> wrote:
>> Hi,
>>
>> I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
>> When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.
>>
>> Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.
>>
>> The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?
>>
>> Any ideas are welcome.
>>
>> cheers
>> Johan_______________________________________________
>> seaside-dev mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: slime rule to detect ajax requests that combine multiple primary callbacks

Paul DeBruicker
Should probably catch the set of valid ajax convenience methods which I
think includes

#ajax #post #get #getJson #getScript

See JQueryClass ajax protocol though there may be others




On 09/01/2012 08:47 AM, Johan Brichau wrote:

> Hi Lukas,
>
> Thanks for the response. That indeed is a more scalable solution.
> I don't seem to see a pattern to match cascades but perhaps it's sufficient to capture all statements that have a 'jQuery ajax' in there.
>
> Simple enough. I will commit a new version soon.
>
> cheers
> Johan
>
> On 01 Sep 2012, at 17:29, Lukas Renggli wrote:
>
>> Hi Johan,
>>
>> The proposed rule seems to be very useful.
>>
>> I would match all cascades with the pattern, and then in the action
>> block manually test if any of your selectors occurs more than once.
>>
>> Cheers,
>> Lukas
>>
>> On 1 September 2012 16:42, Johan Brichau <[hidden email]> wrote:
>>> Hi,
>>>
>>> I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
>>> When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.
>>>
>>> Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.
>>>
>>> The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?
>>>
>>> Any ideas are welcome.
>>>
>>> cheers
>>> Johan_______________________________________________
>>> seaside-dev mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>> _______________________________________________
>> seaside-dev mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: slime rule to detect ajax requests that combine multiple primary callbacks

Lukas Renggli
In reply to this post by Johan Brichau-2
This gives you all the cascades in the image:

    ``@receiver `@head: ``@headArgs; `;@rest: ``@restArgs

Or even simpler if you don't care about the inner structure of the cascade:

    `{ :node | node isCascade }

Lukas

On 1 September 2012 17:47, Johan Brichau <[hidden email]> wrote:

> Hi Lukas,
>
> Thanks for the response. That indeed is a more scalable solution.
> I don't seem to see a pattern to match cascades but perhaps it's sufficient to capture all statements that have a 'jQuery ajax' in there.
>
> Simple enough. I will commit a new version soon.
>
> cheers
> Johan
>
> On 01 Sep 2012, at 17:29, Lukas Renggli wrote:
>
>> Hi Johan,
>>
>> The proposed rule seems to be very useful.
>>
>> I would match all cascades with the pattern, and then in the action
>> block manually test if any of your selectors occurs more than once.
>>
>> Cheers,
>> Lukas
>>
>> On 1 September 2012 16:42, Johan Brichau <[hidden email]> wrote:
>>> Hi,
>>>
>>> I just committed a new Slime rule to find methods that combine multiple primary callbacks on a jQuery ajax object: WADoNotCombineMultiplePrimaryAjaxCallbacks
>>> When I was optimizing all my ajax requests to combine as much secondary callbacks as possible (as opposed to using onComplete:), I made some mistakes and decided a Slime rule would really help detect those mistakes.
>>>
>>> Unfortunately, I'm not a hero on the AST pattern spec and it seems a lot of work to complete the rule's detection patterns with all possible combinations of messages (in a cascade) to the JQAjax object. Therefore I thought I would ask some feedback on how to best do that.
>>>
>>> The problem is thus that you just want to find out if any message that implements a primary callback is sent more than once in a cascade. Maybe the patterns are not good for that and I should just use some metaprogram?
>>>
>>> Any ideas are welcome.
>>>
>>> cheers
>>> Johan_______________________________________________
>>> seaside-dev mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>> _______________________________________________
>> seaside-dev mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev