Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Warning return

Sorry for insisting on this topic. I really believe this is something we could take a look at more carefully. Since the subject deviated since the original message, I think it is best to start a new conversation.

I believe warnings give to IDE a good oportunity to improve code measurement and interaction with programmer.

I have seen strings-based programming failing many times. So my suggestion is to change the return type to Object or a new interface. So warning declaration could be both:

declare warning : bad() : new WarningMessage(9, "Something bad is coded here.");

or

declare warning : bad() : "Something bad is coded here.";

Message handlers could then do reflection to find from which class the message return is. A simple message handler could simply call .toString() to print results as current implementation does.

This feature can, for example, create reports to measure how many directs calls exist to file IO within all classes.

Also, it would be possible to report how many calls to deprecated methods exist inside the code. So one could get a legacy code and, in face of a new release of libs and without much effort, create an aspect that can measure its quality.


From: "Wes Isberg" <wes@xxxxxxxxxxxxxx>
Reply-To: aspectj-users@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Describing the chattyness
Date: Sat, 30 Sep 2006 12:38:49 -0700

This is an interesting problem area but one not directly in
the domain of AOP.

While declare error/warning can pick out specific
staticly-determinable join point, pointcut languages aren't
typically set up to make assertions across join points or
about missing join points (e.g., you should implement this
method or have a constructor that takes this argument), so
things like JQuery are better suited to that.  However,
those are often limited to static analysis, and the runtime
capabilities of AOP can augment those systems.  For
example, it's a common aspect to track a use pattern like
(open stream, use stream, close stream) where the stream
might be opened, used, and closed by different components.
 AOP is good at detecting that the stream was not closed
and who was supposed to.


On the question of the warning level, the user can encode a
particular level in the message, e.g.,

  declare warning : bad() : "09 bad thing";

Not the best, but...

Also, the message handlers are pluggable so you can set up
programmer support at build time by installing a message
handler that does something special when given your special
messages (e.g., counting up an overall "score" for a
program given all the messages).

hth - Wes

On Sat, 30 Sep 2006 20:36:59 +0900
 "matsui akira" <akira_in_tokyo@xxxxxxxxxxx> wrote:
> I believe this use points to an interesting application
> for AOP. Warnings could be used to measure code. In this
> case, the number of communication with a certain layer
> could be counted by a tool that attaches to the IDE in
> use and give the programmer a quantification about the
> code.
>
> I already had a similar problem before. I had to create
> advices to tell programmers about choices that could
> reflect in bad execution performance. Programmers could
> have a tool that give them an overal report about code
> quality so that this could guide their development.
> Warnings could be classified according to it severity.
>
> As a sugestion, warning declaration could be changed
> optionally to the following:
>
> declare warning (10, WARNING_CLASS) : within({Business});
>
> where 10 is the severity and WARNING_CLASS is an
> enumeration item.
>
> >From: "Wes" <wes@xxxxxxxxxxxxxx>
> >Reply-To: wes@xxxxxxxxxxxxxx, aspectj-users@xxxxxxxxxxx
> >To: aspectj-users@xxxxxxxxxxx
> >Subject: Re: [aspectj-users] Describing the chattyness
> >Date: Thu, 28 Sep 2006 10:57:59 -0700
> >
> >
> >Calls from Business:
> >
> >   declare warning : within({Business}) && call({Dao}) :
> "business ->
> DAO";
> >   where {Business} and {Dao} depend on your system.
> >
> >Similarly, callbacks from DAO:
> >
> >   declare warning : within({Dao}) && call({Business}) :
> "DAO ->
> Business";
> >
> >For a runtime accounting, use advice to log the same
> pointcuts.
> >
> >Is that what you were looking for? ("reference count"
> typically means
> >the number of references to a particular object.)
> >
> >(See also JDepends.)
> >
> >Wes
> >
> >btw, search didn't turn up any relevant definition of
> "AMOF"
> >
> > > ------------Original Message------------
> > > From: Thomas SMETS - disposable add
> <duvelbier-tsmets@xxxxxxxxx>
> > > To: aspectj-users@xxxxxxxxxxx
> > > Date: Thu, Sep-28-2006 10:50 AM
> > > Subject: [aspectj-users] Describing the chattyness
> > >
> > >
> > > Dear,
> > >
> > > I was wondering how I could do a reference count...
> > > AMOF, I would like to measure the level of chattyness
> in my code :
> > >
> > >
> > >         Service Layer <--> Business Layer <--> Dao
> <--> DB
> > >
> > >
> > > If I can forbid the Service to talk directly to the
> Dao, I woundered if
> > > I could also point the places where the Business was
> chatting too much
> > > with the DAO's (hence the DB).
> > >
> > > Any hint into this would be appreciated !
> > >
> > > \T,
> > >
> > >
> > > --  Any fool can write code that a computer can
> understand.
> > > Good programmers write code that humans can
> understand.
> > >
> > > Martin Fowler
> > >
> > > T. : +32 (0)2 742 05 94
> > > M. : +32 (0)497 44 68 12
> > > @  : duvelbier-tsmets@xxxxxxxxx
> > > Do you skype too ... (tsmets) ?
> > >
> > >
> > >
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > >
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > >
> >
> >_______________________________________________
> >aspectj-users mailing list
> >aspectj-users@xxxxxxxxxxx
> >https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_________________________________________________________________
> あなたのPCの健康状態を無料でチェック・維持します
http://safety.live.com/
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_________________________________________________________________
au版メッセンジャーEZアプリ新登場!いますぐ無料ダウンロード! http://promotion.live.jp/messenger/mobile.htm


Back to the top