AOP - AspectS

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

AOP - AspectS

Osvaldo Aufiero-4
Andy, Blair,
I was trying to port AspectS (from VW and Squeak versions) but I ran through
some problems.

The thing is that I need to implement MethodWrappers, so I need a few
things:
-Compiler to return an instance of another class rather than CompiledMethod
-Being able to add an instance variable to that class. Or any other way (I
tried using basicAt: self size but it did not worked very well for me) to
have a block inside a compiled method, or some code to execute. I need some
advice with this, or a patch... I don´t know, please help me.

I think it should be great to ship AOP with D6, don't you??

regards, and thanks for your help

Osvaldo

PS: next steps to port are Seaside
PS2: I already ported SmallMock from adaptive software. All tests are
running, so it will be released pretty soon.


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Udo Schneider
Osvaldo Aufiero wrote:
> The thing is that I need to implement MethodWrappers, so I need a few
> things:
Did you try the MethodWrappers package available here:
http://www.smalltalking.net/Goodies/Dolphin/

> -Compiler to return an instance of another class rather than CompiledMethod
I needed something similar for my inline assembler. My approach was to
wrap MyClass>>compile: and MyClass>>compile:categories:package:flags:.
These methods call the super class' method (which in uses the Standard
Compiler) and changes the result to my own Method subclass (and/or
perform some additional actions).

Hope this helps.

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Osvaldo Aufiero-4
Yes, I tried that goody, but it compiles a before and after method.
I would have to create a new subclass for each wrapper... I think that if OA
helps, we can have great AOP in Dolphin.


"Udo Schneider" <[hidden email]> escribió en el mensaje
news:[hidden email]...
> Osvaldo Aufiero wrote:
> > The thing is that I need to implement MethodWrappers, so I need a few
> > things:
> Did you try the MethodWrappers package available here:
> http://www.smalltalking.net/Goodies/Dolphin/
>
> > -Compiler to return an instance of another class rather than
CompiledMethod

> I needed something similar for my inline assembler. My approach was to
> wrap MyClass>>compile: and MyClass>>compile:categories:package:flags:.
> These methods call the super class' method (which in uses the Standard
> Compiler) and changes the result to my own Method subclass (and/or
> perform some additional actions).
>
> Hope this helps.
>
> CU,
>
> Udo


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Sean Malloy-11
> Yes, I tried that goody, but it compiles a before and after method.
> I would have to create a new subclass for each wrapper... I think that if
> OA
> helps, we can have great AOP in Dolphin.

I know this may just sound extremely ignorant of me.. But doesn't the
Smalltalk meta protocol represent an implementation of AOP anyway?


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Esteban A. Maringolo-2
Sean Malloy escribió:
>>Yes, I tried that goody, but it compiles a before and after method.
>>I would have to create a new subclass for each wrapper...
 >>I think that if OA helps, we can have great AOP in Dolphin.

> I know this may just sound extremely ignorant of me.. But doesn't the
> Smalltalk meta protocol represent an implementation of AOP anyway?

I have the same impression. Perhaps I don't understand AOP.
To me, by now, is a buzz in the no-smalltalk world.

Best regards

--
Esteban


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Osvaldo Aufiero-4
People,
AOP is great (and it is greater in ST), because it lets you modify and
extend your system during runtime, without making it dirty. For example, you
can have different Aspects for your system, like Persistence, Security,
Logging, etc
And you can install and uninstall them whenever you want.
If you want to understand further, take a look at AspectS either for Squeak
or its port for VW.
http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/


"Esteban A. Maringolo" <[hidden email]> escribió en el mensaje
news:[hidden email]...

> Sean Malloy escribió:
> >>Yes, I tried that goody, but it compiles a before and after method.
> >>I would have to create a new subclass for each wrapper...
>  >>I think that if OA helps, we can have great AOP in Dolphin.
>
> > I know this may just sound extremely ignorant of me.. But doesn't the
> > Smalltalk meta protocol represent an implementation of AOP anyway?
>
> I have the same impression. Perhaps I don't understand AOP.
> To me, by now, is a buzz in the no-smalltalk world.
>
> Best regards
>
> --
> Esteban
>


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Schwab,Wilhelm K
Hello all,

> People,
> AOP is great (and it is greater in ST), because it lets you modify and
> extend your system during runtime, without making it dirty. For example, you
> can have different Aspects for your system, like Persistence, Security,
> Logging, etc
> And you can install and uninstall them whenever you want.

With tongue only partly in cheek: "Gee, they kinda sound like objects!"


> If you want to understand further, take a look at AspectS either for Squeak
> or its port for VW.
> http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/

 From the page: "WARNING: Incorrectly using AspectS may result in an
inconsistent image that can't be trusted anymore. Therefore, before
experimenting with AspectS, please save and backup your image."

Granted, the same can be said of abuse of any Smalltalk image, but there
is something to be said for adding behavior to objects by means of
methods, instead of adding behavior to methods.  I might not be so
skeptical if it were not for just having seen a demo on Tweak at STS.
Either I (and others in the room) didn't get it, or it's scary stuff
that appears to be at least loosely related to AOP.  Add the origins in
Java and one starts to wonder whether it is indeed a capability that we
already had in a cleaner way???  Comments?

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Chris Uppal-3
Bill,

> I might not be so
> skeptical if it were not for just having seen a demo on Tweak at STS.
> Either I (and others in the room) didn't get it, or it's scary stuff [...]

Ok, I'll bite -- what is Tweak and how is it scary ?


> that appears to be at least loosely related to AOP.  Add the origins in
> Java and one starts to wonder whether it is indeed a capability that we
> already had in a cleaner way???

<Grin/>

As far as I can see it came out of Xerox PARC, and was mostly (depending on
your perspective) based around List/CLOS or special-purpose languages.  The
early papers are (I think) very interesting, and can be found at:

    http://www2.parc.com/csl/groups/sda/publications/

In particular the paper simply called "Aspect-Oriented Programming", by
Kiczales, Lamping, Mendhekar, et al.

IMO, the current flavours of AOP, such as AspectJ, don't come anywhere near
realising the promise of those early papers -- in fact I have a hard time
seeing enough similarity to justify using the name AOP.  But that may just be
my ignorance -- I haven't paid much attention to the Java-based AOP stuff (it
generates very little excitement in Java community, as far as I can tell).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Schwab,Wilhelm K
Chris,

>>I might not be so
>>skeptical if it were not for just having seen a demo on Tweak at STS.
>>Either I (and others in the room) didn't get it, or it's scary stuff [...]
>
>
> Ok, I'll bite -- what is Tweak and how is it scary ?

Tweak is a cleanup/replacement for Morphic.  It is scary due to
"annotations" that replace things like trigger wiring with
primitive-looking directives swallowed by the compiler and stuck away in
dictionaries that are then integrated by tools to give the appearance of
instance variables.

On the latter, one could argue that they are like Morphic's extensions,
which are sparse storage designed to make life easier on the garbage
collector, so it's not all bad.  However, the compiler extensions give
me the creeps.



> As far as I can see it came out of Xerox PARC, and was mostly (depending on
> your perspective) based around List/CLOS or special-purpose languages.  The
> early papers are (I think) very interesting, and can be found at:
>
>     http://www2.parc.com/csl/groups/sda/publications/
>
> In particular the paper simply called "Aspect-Oriented Programming", by
> Kiczales, Lamping, Mendhekar, et al.

Thanks.


> IMO, the current flavours of AOP, such as AspectJ, don't come anywhere near
> realising the promise of those early papers -- in fact I have a hard time
> seeing enough similarity to justify using the name AOP.  But that may just be
> my ignorance -- I haven't paid much attention to the Java-based AOP stuff (it
> generates very little excitement in Java community, as far as I can tell).

That explains a lot.  In fact, if the Java guys don't like it too much,
maybe I should give it another look :)

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Blair McGlashan
In reply to this post by Osvaldo Aufiero-4
"Osvaldo Aufiero" <[hidden email]> wrote in message
news:[hidden email]...
> Andy, Blair,
> I was trying to port AspectS (from VW and Squeak versions) but I ran
> through
> some problems.
>
> The thing is that I need to implement MethodWrappers, so I need a few
> things:
> -Compiler to return an instance of another class rather than
> CompiledMethod

You can do this in at least two ways:

1) by replacing the default instance of CompilerLibrary with an instance of
a new subclass that overrides the compilation methods and creates your new
subtype of CompiledMethod by copying over information from the
CompiledMethod created by the compiler.
2) update the VM well-known object registry to include the CompiledMethod
subclas in place of CompiledMethod, i.e. 'VMLibrary default registryAt:
#CompiledMethod put: MyCompiledMethod'
3) Some combination of (1) and (2)...

> -Being able to add an instance variable to that class. Or any other way (I
> tried using basicAt: self size but it did not worked very well for me) to
> have a block inside a compiled method, or some code to execute. I need
> some
> advice with this, or a patch... I don´t know, please help me.

The VM does not support the addition of extra named instance variables to
CompiledMethod objects. It is not likely we will change this in Dolphin X6
just to support AspectS I'm afraid. You can however add extra indexed
instance variables (i.e. extend the literal frame).

>
> I think it should be great to ship AOP with D6, don't you??

Not really. I remember seeing Kiczales (sp?) give a keynote at Oopsla about
it some years ago, and it didn't sound like a very good idea to me. Maybe
I'm missing something but all that weaving seems more likely to result in a
tangled mess than a working program that one can understand and debug.

>
> regards, and thanks for your help
>
> Osvaldo
>
> PS: next steps to port are Seaside

Isn't there one of these already (done by Steve Waring)?

> PS2: I already ported SmallMock from adaptive software. All tests are
> running, so it will be released pretty soon.

No idea what that is, but great :-)

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: AOP - AspectS

Osvaldo Aufiero-4
Hi Blair, thanks for answering,

"Blair McGlashan" <[hidden email]> escribió en el mensaje
news:[hidden email]...

> "Osvaldo Aufiero" <[hidden email]> wrote in message
> news:[hidden email]...
> > The thing is that I need to implement MethodWrappers, so I need a few
> > things:
> > -Compiler to return an instance of another class rather than
> > CompiledMethod
>
> You can do this in at least two ways:
>
> 1) by replacing the default instance of CompilerLibrary with an instance
of
> a new subclass that overrides the compilation methods and creates your new
> subtype of CompiledMethod by copying over information from the
> CompiledMethod created by the compiler.
> 2) update the VM well-known object registry to include the CompiledMethod
> subclas in place of CompiledMethod, i.e. 'VMLibrary default registryAt:
> #CompiledMethod put: MyCompiledMethod'
> 3) Some combination of (1) and (2)...

Great, I will give it a try.

> > -Being able to add an instance variable to that class. Or any other way
(I
> > tried using basicAt: self size but it did not worked very well for me)
to
> > have a block inside a compiled method, or some code to execute. I need
> > some
> > advice with this, or a patch... I don´t know, please help me.
>
> The VM does not support the addition of extra named instance variables to
> CompiledMethod objects. It is not likely we will change this in Dolphin X6
> just to support AspectS I'm afraid. You can however add extra indexed
> instance variables (i.e. extend the literal frame).

How can I do that? sending #basicAt: ? I can store any object I want there?

> >
> > I think it should be great to ship AOP with D6, don't you??
>
> Not really. I remember seeing Kiczales (sp?) give a keynote at Oopsla
about
> it some years ago, and it didn't sound like a very good idea to me. Maybe
> I'm missing something but all that weaving seems more likely to result in
a
> tangled mess than a working program that one can understand and debug.

But you don't need to care about weaving.... the weaving is complicated if
you are using java, or c++, it is very simple if you are using ST, you just
replace an object with another one.
>
> >
> > regards, and thanks for your help
> >
> > Osvaldo
> >
> > PS: next steps to port are Seaside
>
> Isn't there one of these already (done by Steve Waring)?
Yes, i will grab that version and upgrade it (seaside has improved a lot)

>
> > PS2: I already ported SmallMock from adaptive software. All tests are
> > running, so it will be released pretty soon.
>
> No idea what that is, but great :-)

These are MockObjects for Smalltalk. With this you don't need to form a
complex object structure for unit tests, so this way you can do real unit
tests.
MockObjects are "fake" objects.
http://www.adaptionsoft.com/smallmock.html

> Regards

Regards
>
> Blair

Osvaldo
>