1 2 Previous Next 16 Replies Latest reply on Oct 14, 2004 7:59 AM by kevinconner Go to original post
      • 15. Re: Why lack of 'before' and 'after' advice types is bad..

         

        "KevinConner" wrote:
        ....
        Think of my solution as the PrintWriter that surrounds the Writer ;-)


        E-e :/
        It is not correct type of comparition. But thanks for sample. Let's have a closer look at it, by first showing present state of JBossAOP API

        public void MyAspect
         extends KevinConnersNiceSolution //or/and additional configuration
        {
        
         Object firstAdviceBefore(...) //@@before
         Object firstAdviceAfter(...) //@@after
        }
        
        // and try to imagine that this class has only one! write method
        
        public java.io.Writer {
        void write(char[] cbuf)
         //Write an array of characters.
        abstract void close()
         //Close the stream, flushing it first.
        abstract void flush()
         //Flush the stream.
        }
        
        


        But true and useful Writer looks little different - it has write(String) method! (just like number of other methods which don't give you additional funcionallity but help you using other code)

        public java.io.Writer {
         void write(String str)
         //Write a string.
         void write(String str, int off, int len)
         //Write a portion of a string.void write(char[] cbuf)
        ...
        }
        
        // and the way I try to persuade you to
        
        public void MyAspect
        {
        
         @before Object firstPersistenceAdvice(...)
         @after Object secondAdviceAfter(...)
        
         Object standardAroundAdvice(..)...
        }
        


        And I'm sure you don't use this writer.write("Open your eyes") and System.out.println("And keep them opened") and you've written several emails to Sun complaining about Java API too big in this case

        ;)

        Yeah, nice to be on the second side of the mirror...

        Regards,
        Tomasz Nazar



        • 16. Re: Why lack of 'before' and 'after' advice types is bad..
          kevinconner

           

          It is not correct type of comparition.

          The comparison relates to the additional functionality that PrintWriter.println provides in and above that provided by Writer.write.

          In this case it is simple, just adding the correct eol characters for the platform, but it is an example of additional functionality that detracts from the intent of Writer.

          In the before/aspect case the before/aspect functionality detracts from the intent of the invocation.

          and you've written several emails to Sun complaining about Java API too big in this case


          I haven't written them but I do happen to think that it contains a lot of bloat :-). I also think that it has useful functionality missing but I choose to get this from thirdparty libraries.

          Yeah, nice to be on the second side of the mirror...


          We both appear to agree that this functionality is useful, the disagreement is whether it should be included in the core framework or as a contributed aspect (in this case).

          Kev

          1 2 Previous Next