Slashdot Mirror


Aspect-Oriented Programming with AspectJ

Verity Stob writes "There is a turning point in the emergence of a programming methodology. It doesn't matter how big and popular the website is, nor how many papers have been published in the ACM journals or development magazines, nor even whether the first conferences have been a sell-out. A methodology hasn't made really made it until somebody has published a Proper Book. With Aspect-Oriented Programming with AspectJ author Ivan Kiselev is bidding to drag AOP into the mainstream. He is motivated, he says in his introduction, by the recollection of the 25 odd years it took for the object-oriented concept to spread from its Simula origins in frosty Norway to being the everyday tool of Joe Coder. He aims to prevent this delay happening to AOP." Read on for Verity Stob's review of Kiselev's book. Aspect-Oriented Programming with AspectJ author Ivan Kiselev pages 274 publisher SAMS rating Excellent reviewer Verity Stob ISBN 0672324105 summary Introduction to a new programming technique using an extension to Java

He has divided the book into four parts. Part I provides a brief sketch of AOP and introduces its concepts. AOP builds on OOP, asserting that we need a new programming entity called, wait for it, an aspect. Mr Kiselev's explanation of aspects reminded me of that bit in The Hitchhiker's Guide to the Galaxy when the planet Golgafrincham divided its population into A types (who were the leaders, the scientists and the great artists), the C types (who were the people who did all the actual making of things and doing of things), and the B types, who comprised everybody left over: telephone sanitizers, advertising account executives and hairdressers. As I understand Mr Kiselev, the AOP view of things is that objects and classes (A type thinkers) and low-level procedures and APIs (C type doers) can be nicely encapsulated using traditional components. But aspects, software's little hairdressers, get their fingers into everything, and until now there has been no way to encapsulate them. This of course is what AOP in general and specifically the AspectJ superset of the Java language set out to do.

AspectJ's eponymous aspects are constructs not unlike ordinary classes. Mr Kiselev has not resisted the temptation to make an aspect Hello World example, and it looks reassuringly so-whatish:

package intro;

import java.io.*;

public aspect HelloWorldA
{
public static void main(String args[])
{
System.out.println(Hello, world!);
}
}

Mr Kiselev then lays out his stall of New Things. A join point is any point in execution flow that AspectJ can identify and -- to get slightly ahead of ourselves -- execute some extra code. The most frequently used kind of join point being the call to a method. Pointcuts specify collections of join points; as a regular expression is to an instance of matched text, so a pointcut is to a matching join point. An advice (with horrid plural 'advices') is the code to be executed when a given pointcut is matched. If you are familiar with Eiffel's pre- and post-conditions, then you'll understand if I say that it is common for advices to run in the same way, topping and/or tailing the execution of a method. The differences are that aspects are specified from outside the method without touching the method or its class's code, and that aspects can be applied to multiple methods in one go. Mr Kiselev concludes this section of the book with a few simplistic examples of 'here is class A, here is class B' kind.

In Part II Mr Kiselev rolls up his sleeves and takes us through an extended, realistic example. I did wonder if perhaps it weren't a wee bit too realistic, as it is a miniature website application for news story submission and reading -- sort of Slashdot Ultralite -- all done using JSP and a MySQL database. Just explaining this setup, without even using any AspectJ, consumes a 15-page chapter. Since I am a C++ programmer who has not had any contact with JSP, I was initially anxious that I might not be able to follow this. However, recalling that www.[name withheld].com, the clumsiest, ugliest corporate website on the Internet, is programmed in JSP, I reasoned that if the dolts that programmed that site could understand JSP then it couldn't be very hard. So it proved.

The first example comprises adding password protection to the application. This is achieved by adding an advice that intercepts calls to doStartTag() methods. The advice can test if the user is logged in and, if he isn't, throw an exception that will dump him back at the login page. (Who says exceptions aren't 21st century gotos?) At this point Mr Kiselev admits that the cute 10-line implementation that he initially shows is in reality a non-starter; for one thing not all pages that must be secured define doStartTag() methods, for another the aspect can't reach an instance variable it needs to read because it is declared in protected scope. The second problem is easily overcome. AOP offers a mechanism by which extra classes can be bodged ('introduced' is the preferred verb in the AOP community) into the hierarchy as parents of existing classes. He uses this to add an accessor method for the field in question. The other problem is not so neatly smothered, and it is somewhat ruefully that Mr Kiselev produces his final, two-page solution. But I think that it is greatly to Mr K's credit that he does this - it tastes like programming in the real world as I have experienced it.

For the rest of Part II, Mr K demonstrates other applications of AOP using the AspectNews code. This includes Eiffelish design-by-contract stuff, improved exception handling, various debugging and tuning techniques (specifically logging, tracing and profiling) and a chapter on runtime improvements - stream buffering, database connection pooling and result caching - which show the AOP way to do things, usually where I would expect to be putting in proxy classes.

In part III we get down and dirty with the AspectJ language. This is the part where the book explains the obscure stuff: how to make a pointcut that picks up object preinitialization, or make an advice that goes off only when you are exiting a method on the back of an exception. I skimmed this bit - I guess it will become vital when I start using AspectJ in earnest. It looked good and clear on a flick through. A brief part IV contains some patterns, to give one a start when engaging AspectJ in earnest. Apparently it is horribly easy to create infinitely recursive situations, so if you here a faint popping sound from your machine it will be the stack colliding with the heap. There are seven appendices, supplying such things as a summary of the API in AspectJ's packages and hints on obtaining and using the Open Source supplementary tools mentioned in the book (Tomcat JSP container, MySQL database and Ant make replacement). AspectJ itself, now escaped from Xerox PARC, can be downloaded from the Eclipse website.

Complaints? None really. Oh all right, here's a nitpicklette because it's you: at page 75 Mr Kiselev adopts the irritating Internet habit of writing 'loosing' when he means 'losing'. Note to publisher SAMS proofreaders: do I win 25 cents?

For the rest, this is a lucid and readable book that describes the Next Big Methodology. I'm a bit alarmed at the prospect of squeezing new actions into the cracks of existing code, but I dare say I'll grow to love it.

A word of warning to the eager: since this technology is currently implemented as a species of preprocessor that relies on having all the source code available at once, so it is rather slow and probably isn't going into production shops for a while. There again, I seem to remember the comparable Cfront C++ compiler doing rather well, before we had platform-native C++ compilers.

And to the sceptics: if you think you can ignore AOP, don't forget the fate of the A and C type inhabitants of Golgafrincham, who having sent their B type telephone sanitizers into exile were all wiped out by a germ caught from a particularly dirty telephone.

You can purchase Aspect-Oriented Programming with AspectJ from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

426 comments

  1. So, what is this? by Juiblex · · Score: 2, Interesting

    What is Aspect-Oriented Programming?? I've never heard of it!

    1. Re:So, what is this? by ralico · · Score: 3, Insightful

      I've never heard of it either, but I'm suspicious of things that claim to be The next big methodology.

      From what the reviewer talked about with A types, B types and C types, it sounds a whole lot like roles and the delegation design pattern.
      Agree? Disagree?

      --

      SCO to Hell
    2. Re:So, what is this? by punkball · · Score: 0, Flamebait

      Amen.

    3. Re:So, what is this? by zanerock · · Score: 0

      Design patterns themselves are just renaming something every skilled programmer already used, and now every unskilled programmer bandies about like so many Microssoft Certifications.

      I'd say that logically, it's about the same thing, but the AOP model does have one thing going for it in that it provides actual tools instead of just a lot of talk. I don't see any sort of revolution here, but I think it's much more useful than patterns for that reason alone.

    4. Re:So, what is this? by Anonymous Coward · · Score: 0

      And, what, you think it's a bad thing that patterns allowed programmers to transfer good practice to other programmers?

      You're not one of these silly elitists, are you?

    5. Re:So, what is this? by Ouroboro · · Score: 3, Insightful

      What is Aspect-Oriented Programming?? I've never heard of it!

      the gimmick dejour. yet another programming methodology that hopes (in vain) to eliminate the need for skilled programmers.

      Once again someone proves the old saying Better to keep your mouth closed and be thought a fool than to open it and remove all doubt. I can see why the above response was submitted anonymously.

      The goal of Aspect-Oriented programming is not to eliminate the need for skilled programmers. The goal is to reduce the local complexity of code. Make it so that when you look at code who's job is to store some data, it isn't cluttered with all of the other code like debugging and error handling. The point of this isn't to remove that code all together, but rather to make it much less tightly coupled. Why should persistence code be married to logging code? The answer is it shouldn't, they are two entirely different functions. Aspect-Oriented programming makes it easier to decouple them. This makes both pieces of code more flexible, and reusable.

      --
      When I want your opinion I will beat it out of you.
    6. Re:So, what is this? by Minna+Kirai · · Score: 5, Insightful

      I've read a few papers, but never managed to pay much attention. However I tried to put it in terms of how you might accomplish such effects with a traditional programming langauge.

      Basically, imagine if you wrote a program which had "hooks" scattered through it. As you write your code, you place hooks for before/after doing many things: reading user input, transmitting network data, accessing preference files, checking permissions, etc. (Imagine wrapping all your function calls with dynamically-bound functions which you don't yet know if map to an identity function, or have some effect)

      Other parts of the program can then hook into these things and effect how your program runs, without them having to go through and modify your code. (Example: if they want to log a message to file everytime your "CastRay()" function is called, they can do this without going in and editing your code).

      Now, imagine than rather than the programming having to plan ahead to scatter hooks all around his code (uglifying it towards readers who don't care about them), they are inserted automatically by the compiler.

      So a person can create a function which will be automatically called whenever some other set of 3 different functions is called, without having to go modify each one. Instead of going to each function body and adding a call, he at one position attaches his code to functions of that kind. The program is shorter, but has more effects. This may mean, when all goes well, that if someone adds a new function with similar effects, those hooks may still get called.

      Now, is all this a code idea? It's hard to say, Aspect-Oriented programming (like OO programming) is yet another way for a program to do things without the source code making it abundantly clear. In OO, if you see one method A call method B, you must check the source code for all base classes to see if and how B was virtually overridden, a complexity that didn't exist before. Now, with AOP, you must be aware "is this behavior creating a context which will cause some Aspect to add in more effects"?

      In both those cases, the program is doing things that the source code doesn't make 100% clear to a programmer reading a single function body. This can be either good or bad. The usage of editing tools which evaluate the code and alert the reader to these facts (analogous to "class browsers" in several IDEs) shift it much further towards "good".

    7. Re:So, what is this? by whazzy · · Score: 3, Informative

      Aspect-oriented programming (AOP) is a new language paradigm proposed for cleanly modularizing the crosscutting structure of concerns such as exception handling, synchronization, performance optimizations, and r esource sharing,that are usually difficult to express cleanly in source code using existing programming techniques. AOP can control such code tangling and make the underlying concerns more apparent, making programs easier to develop and maintain. In aspect-oriented programs, the basic program unit is an aspect. An aspect with its encapsulation of state with associated advice, introductions, and methods (operations) is a significantly different abstraction in comparison to the procedure units within procedural programs or class units within object-oriented programs. The inclusion of join points in an aspect further complicates the static and dynamic relations between aspects and classes My humble request:Please take a moment to use Google before you feel the urge to click the submit button here:-)\

    8. Re:So, what is this? by tickleboy2 · · Score: 5, Insightful

      Aspect Oriented programming is a brand new programming paradign, kinda of like the switch you made when going from functional programming to object oriented programming. It's a different way of expressing your programs

      The reason that Aspect Oriented Programming was created was due to "cross-cutting" concerns that cannot be easily modelled in object oriented programming. I read the presentation for AspectJ and the example they used was logging in Apache Tomcat. Bascially the code that is used for logging is scattered throughout the whole program on hundreads of different lines, not all in one nice neat class. Aspect Oriented Programming wants to give the programmer the tools to gather all of this code together.

      Bascially, Aspect Oriented Programming is supposed to result in: less tangled code (code that is fragmented throughout your program because you are unable to modularize it well), more natural code, shorter code, easier to maintain and evolve, and more reusability.

      One question I had about the book that the review didn't seem to answer was did the book talk at all about designing using Aspect Oriented Programming? Just like Object Oriented Programming, it's a great tool until you get some inexperienced programmer who just knows how to program functionally, and thus doesn't use the advantages of aspect oriented programming. I too would like to learn more about how to go about designing a program in an Aspect Oriented way; such as how to identify aspects, what are some common aspects, etc.

      In all, I'm very excited about Aspect Oriented programming. I think it has the ability to allow programming to shape thier programs more naturally, make their programs easier to understand, and make the whole process much eaiser. But of course as with any new technology, it has some growth and refinement to go through yet.

      Those of you who would like more information can check out the AspectJ webpage, or the Aspect Oriented Software Design webpage.

      --
      The only thing that will stop you from fulfilling your dreams is you. - Tom Bradley
    9. Re:So, what is this? by EnderWiggnz · · Score: 1

      its obvious that AOP will succeed where OOP, Top-Down Design, UML, and JAD failed.

      its another stupid methodology that appdev shops will spend lots of money chasing.

      bfd.

      --
      ... hi bingo ...
    10. Re:So, what is this? by Caoch93 · · Score: 5, Interesting
      Now, is all this a code idea? It's hard to say, Aspect-Oriented programming (like OO programming) is yet another way for a program to do things without the source code making it abundantly clear. In OO, if you see one method A call method B, you must check the source code for all base classes to see if and how B was virtually overridden, a complexity that didn't exist before. Now, with AOP, you must be aware "is this behavior creating a context which will cause some Aspect to add in more effects"?

      It's my opinion that, if you have to ask that question, then you and everyone else on your team are doing AOP in a bad way. The entire function of AOP is to separate disjoint concerns so that you don't think about them when you're programming. You write application logic. Your fellow team member maintains your security aspect. You don't ask "When I call this method, will it trigger the security aspect?". Especially in a world of runtime AOP, it's not possible for you to really have a reliable answer.

      Long story short- if two separated concerns in AOP have such a sufficient dependency that you have to ask yourself a question like that, then they should not be separate concerns at all. At least, in my opinion.

    11. Re:So, what is this? by Anonymous Coward · · Score: 1, Interesting

      It reminds me a lot of the programming languages used for creating "interactive fiction" or "text adventure" games. Specifically Inform and TADS.

      Game and simulation programming lends itself perfectly to aspect oriented design because it's full of objects and events which must be responded to. For example a "banana" object might have a "before eating" action which checks that the banana has been peeled and an "after eating" action in which it removes itself from the player's possessions and places a "banana peel" object there instead. A "monkey" object, might have an "after player enters room" action in which it attempts to steal the banana from the player. Since there are an unlimited number of possible events, it is impractical have a virtual function for each of them, so aspect-oriented programming is the only viable solution (especially if you want to create extensible libraries).

    12. Re:So, what is this? by mvw · · Score: 3, Funny
      the gimmick dejour

      I don't know if I am just becoming old and closed-minded, or if there were too many methodologies-de-jour in the last years.

      • OOP was a nice addition to structured programming, but already with UML I had my pains, because of course, it was closely connected to buying the right tools (Rose, Together..) and too much hyped for my taste.

      • Extreme Programming seems to have lost its impetus, or am I just not up to date? :)

      • AOP has great potential to reintroduce spaghetti code, something fought by structured programming in the 70ies. I believe it will lead to truely incomprehensible control flow without the right killer tool/killer IDE. From all the candidates either I grok it the least or my feeling is right that it is the gimmick-est.

      And please note that some schools of programming, like some disciples of the school of functional programming think that even OOP was snake oil!

      Man I wish Microsoft or Sun would hype Visual OCaml or Erlang2EE or Prolog.NET for a change. That would be refreshing.

      Regards,
      Marc

    13. Re:So, what is this? by Minna+Kirai · · Score: 2, Interesting

      The "delegation pattern" may be somewhat similar, but because it's a "pattern"- a repetitive process that a programmer does again and again- it's still bad.

      There's quite a bit of repetitive code created (copied & pasted, then search & replaced) when you make a delegator. Hopefully, Aspect-Oriented would let you skip the mechanical work of writing a delegator, and just get on to using it.

      You might describe it as the programming language compiler becoming aware of a pattern, and learning to implement it when told.

    14. Re:So, what is this? by mvw · · Score: 1
      Basically, imagine if you wrote a program which had "hooks" scattered through it.

      Imagine what would happen if one of these AOP folks would try to sell it to Dijkstra ("Go To Statement Considered Harmful", Communications of the ACM, Vol. 11 (2), pp. 147-148, 1968).

      Regards,
      Marc

    15. Re:So, what is this? by Ouroboro · · Score: 1

      its obvious that AOP will succeed where OOP, Top-Down Design, UML, and JAD failed.

      its another stupid methodology that appdev shops will spend lots of money chasing.

      Well OOP, UML and JAD are all usefull tools for developing software. They may not always be the most appropriate tools for solving the problem at hand, but it is silly to discard them out of hand. It's kind of like woodworking, an adz insn't always the appropriate tool for solving the problem, but when it is, you are glad that you've got it.

      --
      When I want your opinion I will beat it out of you.
    16. Re:So, what is this? by Minna+Kirai · · Score: 1

      then you and everyone else on your team are doing AOP in a bad way.

      You'd think my team uses it? We're CMM SEI Level 5, man. We don't touch a new paradigm until it's got 12 years of proven applications under it's belt!

    17. Re:So, what is this? by mvw · · Score: 1
      Other parts of the program can then hook into these things and effect how your program runs, without them having to go through and modify your code. (Example: if they want to log a message to file everytime your "CastRay()" function is called, they can do this without going in and editing your code).

      Which will inavoidably lead to very bad code. Remember operator overloading in C++, where a similiar overuling of semantics was possible? Because of its abusive potential it was one of features that became considered bad practice if used at all later.

      Regards,
      Marc

    18. Re:So, what is this? by mvw · · Score: 1

      kinda of like the switch you made when going from functional programming to object oriented programming.

      :) I doubt that this will ever happen.


      You mean of course structured programming, which belongs to the programming school of imperative programming.


      Regards,

      Marc

    19. Re:So, what is this? by Caoch93 · · Score: 2, Insightful

      That was a "rhetorical you". I didn't meant to target it specifically at you. I do beg your pardon.

    20. Re:So, what is this? by ergo98 · · Score: 3, Interesting

      While hardly the same thing, at the binary level this reminds me of Detours, a very cool binary interception package from Microsoft Research: Without the sourcecode it allows you to target and intercept calls at the function level, useful, for instance, for timing the framerate of an OpenGL application for instance (I wanted to know the effects of various settings so I intercepted the flip/render command in the opengl system calls...voila I had an exact timing of every frame interval). Of course this is much less of a scope, but it is a tremendously useful little tool.

    21. Re:So, what is this? by Caoch93 · · Score: 2, Insightful
      Which will inavoidably lead to very bad code. Remember operator overloading in C++, where a similiar overuling of semantics was possible? Because of its abusive potential it was one of features that became considered bad practice if used at all later.

      I can see what you mean, but I do see this as different from operator overloading. Aspect weaving does not change the semantic definition of a language's mathematical operators. Depending on your AOP use, too, AOP advice may not have full access to the whole of the program to abuse it. I have seen some interceptor implementations that only let the advice have access to the context of the method call. Yes, this could mean that you could write advice that scrambles the parameters before a function call, leading to unsuspected results in the function call, and I would definitely call that abusive.

      Honestly, though, that's the breaks. Being able to pass pointers into a function gives the author of a function the opportunity to wreck whatever's on the end of said pointers, and that allows for abuse, but I consider it worthwhile to do. There are great ways to abuse everything.

    22. Re:So, what is this? by Minna+Kirai · · Score: 2, Informative

      They certainly wouldn't approve of manually adding hooks everyplace, which is what AOP tries to avoid (while still giving the programmer the power as if that had been done)

      How far would AOP meet with his approval? Good enough, it seems. Dijkstra's criteria for allowing a feature into a language was how much it complicated the description of the "cursor position" ("textual index point") of a program at a certain time. Gotos are bad, because they make the size required to describe that position unbounded (the full history of all previous goto jumps). Structured programming, with nested blocks and function calls, keeps the size limited, because the position-descriptor shrinks when you leave a block. (As long as there's no infinite recursion, but even that can sometimes be handled)

      AOP's effect on the execution graph is the same as function calls. It's just the calling of functions, but the calls themselves are implicit and invisible. The textual index size is only increased by a small constant factor per aspect called, and that size is recovered when it's done.

    23. Re:So, what is this? by e-Motion · · Score: 1

      Now, is all this a code idea? It's hard to say, Aspect-Oriented programming (like OO programming) is yet another way for a program to do things without the source code making it abundantly clear. In OO, if you see one method A call method B, you must check the source code for all base classes to see if and how B was virtually overridden, a complexity that didn't exist before. Now, with AOP, you must be aware "is this behavior creating a context which will cause some Aspect to add in more effects"?

      I used to work with an older fellow who developed software long before I was born. He would complain that decomposing subroutines into smaller, bite-sized subroutines made the program logic harder to follow. He was used to having very long subroutines that performed complicated tasks. He liked to read functions from start to finish and thought that jumping from subroutine to "utility" subroutine and back again was confusing. At the time, I thought that his complaint was ludicrous, mostly because I was so used to having smaller functions that made the high-level logic simpler. To understand decomposed code, instead of thinking in terms of lines of code (execute line 1, then 2, then 3, then 4... then N etc) and understanding each simple line as it appeared in the program, one should think in terms of larger code blocks (execute a simple utility function whose responsibilities I understand, then line 2, then another simple utility function whose responsibilities I understand, etc).

      Your complaint about OO programming sounds somewhat similar. Yes, it is true that dynamically bound functions make the program's flow nonlinear, but when the interface to a method or class is well-defined, this isn't a problem. If method A's responsibilities are clearly documented, then it should not matter whether method A is dynamically bound or not. Instead of thinking (for example) "after code block X, execute code block Y", one should think "after performing some operation X whose interface is defined in this way, perform some operation Y whose interface is defined in that way".

      That being said, I do not understand the benefit of aspects. I have read all of the examples, but I have not been able to change my way of looking at software so that I may understand how aspects can improve development. I'm still stuck asking myself "what's the point?".

    24. Re:So, what is this? by ralico · · Score: 1

      I'll go out on a limb here and what we are really talking about is sofware quality. This Aspect oriented programming seeks to improve software quality. OO did over procedural designs by introducing concepts like encapsulation, inheritance and polymorphism.

      I agree with you that it would be good to have this "aspect" or role quality rolled into the language rather than requiring manual construction.

      I disagree, though, that repetative processes, in themselves, are bad. Some repetative processes are bad, others are good.
      There is a wide grey line between the good and bad too, which is worth a long discussion.
      But I won't get into buzzword bingo, developers edition here.

      --

      SCO to Hell
    25. Re:So, what is this? by Anonymous Coward · · Score: 1, Interesting

      i won't argue the value of reducing the local complexity of code. however i fail to see how this differs significantly from structured or component-based programming where the logging logic is self-contained and called where necessary as a simple yet well-conceived interface. this is 25 year old technology that is as clean (and reusable) as anything ever written.

      if the purpose of AOP is to remove the actual logging calls from the data module you wouldn't be doing any logging i suspect. unless the calls were stealthily inserted by a preprocessor or some other tool. which isn't good either because then you can't tell whats really going on.

      pick a methodology and stick with it, not for a few months, try a decade. if its really that good its worth hanging onto.

    26. Re:So, what is this? by mvw · · Score: 2, Interesting
      Dijkstra's criteria for allowing a feature into a language was how much it complicated the description of the "cursor position" ("textual index point") of a program at a certain time. Gotos are bad, because they make the size required to describe that position unbounded

      Bounded and large would be worse enough. Let me rather cite:

      My second remark is that our intellectual powers are rather geared to master static relations and that our powers to visualize processes evolving in time are relatively poorly developed. For that reason we should do (as wise programmers aware of our limitations) our utmost to shorten the conceptual gap between the static program and the dynamic process, to make the correspondence between the program (spread out in text space) and the process (spread out in time) as trivial as possible.

      AOP, like operator overloading in C++, can introduce amazing surprises to a programmer. A small innocent source code file in the collection of hundreds of source code files can change the behaviour of a program in an unpleasant way.

      Regards,
      Marc

    27. Re:So, what is this? by cyclist1200 · · Score: 2, Informative

      I read about it about a year ago in Java Pro.

      Here's an article

      And here
      And here

      Hope that helps.

    28. Re:So, what is this? by Minna+Kirai · · Score: 2, Insightful

      That's Sun's opinion, but disregard for operator-overloading is by no means universal.

      Only dumb programmers become any more confused by operator overloading than by other kinds of overloaded functions.

      I don't want to reduce the effectiveness of the smart ones by sheparding the stupid.

    29. Re:So, what is this? by the_2nd_coming · · Score: 1

      I have to say, this is going to make programming much nicer.

      --



      I am the Alpha and the Omega-3
    30. Re:So, what is this? by the_2nd_coming · · Score: 1

      how will you end up with spaghetti code? this is ment to keep all asects of a program that are relevent to one another grouped into nice easy to read code. all code for logging is in one aspect, all code for errorhandeling is in another aspect, all code for the bannana object is in another aspect etc. it modularises relevent code together. that makes it nice to read IMHO.

      --



      I am the Alpha and the Omega-3
    31. Re:So, what is this? by ClosedSource · · Score: 1

      So was there 12 years of proven value for CMM before you adopted it?

    32. Re:So, what is this? by Vector7 · · Score: 2, Insightful

      You might describe it as the programming language compiler becoming aware of a pattern, and learning to implement it when told.

      And as a (bitter?) Lisp programmer, I'm suspicious of a language that isn't flexible enough to provide an easy way to integrate the pattern into the language without having to use some silly preprocessor or (god forbid) modify the compiler. =)

    33. Re:So, what is this? by Majix · · Score: 1
      Design patterns themselves are just renaming something every skilled programmer already used, and now every unskilled programmer bandies about like so many Microssoft Certifications.

      That's the whole point of design patterns, to formalize what skilled programmers already know and give us a framework of terms to discuss the things with. Instead of a lot of hand waving and whiteboard drawing we just say "delegation pattern" and everyone in the room knows what we're talking about and we then move on to getting some actual work done.
    34. Re:So, what is this? by nusuth · · Score: 1
      From what the reviewer talked about with A types, B types and C types, it sounds a whole lot like roles and the delegation design pattern.

      I think the author couldn't sell the idea to the reviewer, but he is being polite. Cause it sounds more like we should put all aspects in a bit bucket and send them away.

      --

      Gentlemen, you can't fight in here, this is the War Room!

    35. Re:So, what is this? by zoydoid · · Score: 1

      Aspect Oriented Programming is just an implementation of the infamous 'COMEFROM line-nbr' extension once jokingly proposed for BASIC. Seems someone took it seriously.

    36. Re:So, what is this? by dubl-u · · Score: 1

      Extreme Programming seems to have lost its impetus, or am I just not up to date? :)

      You're not up to date. New user groups are still popping up, conference attendance is increasing, and lots of people are adopting it. I'm helping convert another two teams to it right now.

      What's died down, thank god, is the hype.

    37. Re:So, what is this? by Samrobb · · Score: 2, Interesting
      A small innocent source code file in the collection of hundreds of source code files can change the behaviour of a program in an unpleasant way.

      That's a true statement about any program. Just try tossing in a random uninitialized pointer or runtime exception here or there in any utility function, rebuild, and see what happens.

      I've written "aspect"-like code before... a system that I worked on not too long ago (hey, Honus!) made use of a pretty nice set of functions and macros in order to:

      • trace function call entry
      • do parameter checking
      • log return values
      • log exceptions/unexpected return values

      This involved manually adding the appropriate macro at the start and end of each function. A pain in the butt, and the inevitable tyop came back to bite you hard :-/ IMHO, this is the type of problem that aspect oriented programming is intended to solve.

      Yah, improperly coding an aspect could cause all sorts of heartache and difficult to solve problems. But... when we did the same thing by hand, it still caused heartache and difficult to solve problems. I'll take AOP (supported by an AOP-aware debugger) over doing this sort of thing by hand any day of the week.

      --
      "Great men are not always wise: neither do the aged understand judgement." Job 32:9
    38. Re:So, what is this? by Zenin · · Score: 1

      So if it's "just" an automatic delegation pattern, could this be yet another programing methodology that Perl has "built in" support for? -For those not familar, Perl's AUTOLOAD system can make quick work of mass delegation, even if you're targeting multiple possible delegate objects.

      --
      My /. uid is better then your /. uid
    39. Re:So, what is this? by jovlinger · · Score: 1

      well, then.

      AOP is like metaprogramming, but more controlled and disciplined, so that it fits into the statically typed Class/Object/single inhertiance world.

    40. Re:So, what is this? by vbweenie · · Score: 1
      kinda of like the switch you made when going from functional programming to object oriented programming...

      You almost certainly don't mean Functional Programming...;)

      --
      Experience is a hard school, but fools will learn no other.
    41. Re:So, what is this? by sql*kitten · · Score: 1

      Basically, imagine if you wrote a program which had "hooks" scattered through it. As you write your code, you place hooks for before/after doing many things: reading user input, transmitting network data, accessing preference files, checking permissions, etc. (Imagine wrapping all your function calls with dynamically-bound functions which you don't yet know if map to an identity function, or have some effect)

      So it's the same thing as NSAPI/ISAPI? Or is it more like a trigger in a database?

    42. Re:So, what is this? by Lozzer · · Score: 1

      It made it into the INTERCAL spec, however http://www.muppetlabs.com/~breadbox/intercal-man/s 04.html#4.14

      --
      Special Relativity: The person in the other queue thinks yours is moving faster.
    43. Re:So, what is this? by zanerock · · Score: 1

      I don't disagree with you at all on that point. Renaming things to a consistent name is a good thing, but still, that's all it is.

      And if everyone in programming deserved to be there, that would be fine. The problem is, however, that while I'm trying to explain how to fix a problem, I've got to politely fend off five fools who just read about the "delegation pattern" and want to show how much they know about it when that pattern is probably neither ideal, nor even applicable.

      The fact is that we've always used patterns forever, the fact that so many people believe that systems can be fixed or designs improved by "using design patterns" belies a fundamental misunderstanding of what design patterns are and what the naming convention has done. It did not create anything new, and the existing design uses them extensively, guaranteed. It may use the wrong ones, and it may not name them, or it may present them in non-canonical forms, but they're there.

      All in all, I'd much rather lose the 20 seconds it takes me to communicate to my skilled peers what I'm talking about than the many, many hours I've lost to explaining why a "facade" or a "factory" doesn't help the problem at all.

    44. Re:So, what is this? by zanerock · · Score: 1

      I think patterns are very valuable, but I still say that they are no more than renaming what skilled people already know. It does help the knowledge transfer to have regular names, no doubt, but it does not create the knowledege, and this is the mistake that many in the field (who probably shouldn't be there) have made. Those I speak of act as if every system must now be redisegned to use patternss, yet this shows they don't know what they're talking about since every system in existence probably uses patterns already, they just weren't called that at the time.

      As for being elitist, depends. Do I know more than the average programmer? Almost certainly. I also believe that just about anyone could learn what I know, however, so consider it an accident of fate and hard work rather than destiny or something, so I'll let you be the judge.

    45. Re:So, what is this? by ANGIE's+Lover · · Score: 1

      The goal of separation of concerns surely lead to higher abstraction levels in programming languages. These more abstract languages are in some way difficult to maintain. Examples are the inheritance concept in the OO world and the logical programming languages like Prolog. There only little academic tasks may be solved easily - in general the higher abstraction levels lead to higher maintenance problems. On my opinion there is a need to provide abstract but task oriented programming environments. From this point of view, AOP is only a base technique for GP (Generative Programming), which I would suppose to be the right direction. The abstraction gap between the programmer's view of the things and the programming language techniques can only be closed by generators. So, AOP is a first step towards GP.

  2. Where's this useful? by KiahZero · · Score: 1, Interesting

    I honestly don't understand the applications for this. Maybe it's just because I'm reading the review rather than the actual book, but it does'nt feel all that useful.

    I can understand the benefits of OOP over standard top-down programming, but I'm failing to see where this coding methology gives you any gains.

    --
    I'm a lawyer, but not yours. I wouldn't represent someone who thinks taking legal advice from Slashdot is a good idea.
    1. Re:Where's this useful? by Anonymous Coward · · Score: 0

      It's like Emacs hooks, except for Eclipse. Derrrr!

    2. Re:Where's this useful? by Mahrin+Skel · · Score: 4, Informative
      I can see it. Okay, you know how OOP lets you over-ride ancestor behaviour in descendants? But if you want to combine the behaviour of two different objects you have to either encapsulate one in the other, or go all the way back to their common ancestor and create a new descendent line because if you change the root line then *all* descendants are changed?

      AOP would seem to let you over-ride methods or invoke special handling *without* touching the object directly. You simply tell the compiler "When this method is called, do this first (or afterwards)."

      On the one hand, this could lead to spagetti code nightmares, since execution paths could become effectively untraceable. On the other, it's in many ways cleaner than putting your special-case or over-ride code directly into the methods and objects directly.

      --Dave

    3. Re:Where's this useful? by dima233 · · Score: 3, Insightful

      Writing to a log before and after an event is an aspect. A logging facility could be coded as an aspect.

      D

      --

      Listen, strange women lying in ponds distributing swords is no basis for a system of government
    4. Re:Where's this useful? by Lord+of+the+Fries · · Score: 2, Interesting

      The common examples seem to be persistance, concurrency, and something else. AOP is OK, my problem though is that its applicability to orthogonal issues seems (to me) limited. I am rarely able to find any more uses than the common three examples. I am much more interested in some of the recent work done on Traits Programming.

      --
      One man's pink plane is another man's blue plane.
    5. Re:Where's this useful? by Ed+Avis · · Score: 2, Insightful

      'Advice' in Emacs Lisp is handy for running your own custom code before or after any existing function. So it's another way of adding hooks to existing code. A highly customizable app like Emacs is a natural place for this sort of language facility.

      And of course, INTERCAL has the 'COME FROM' statement.

      --
      -- Ed Avis ed@membled.com
    6. Re:Where's this useful? by cushty · · Score: 5, Informative

      Aspects are cross-cutting concerns, they are things that cut through numbers of classes. My way of thinking: draw vertical rectangles side-by-side and call these "classes", now draw a horizontal box that cuts through them all and this is an "aspect".

      The simple example, and one used in the book I believe, is that of logging. Say you have to log the entry to and exit from every single method in your code. Typically you would probably write this directly putting "entering XYZ, exitting XYZ" actually in the code. But with aspects you can write one aspect that basically says "on entry to any method log the method and parameters, on exit log the method" and compile your code and away you go.

      So? Why would I want to do this? Well, now that you have been through your development process and discovered everything runs fine, you decide to go into production. Want to remove every single log line to improve speed? With the "normal" approach you'll have to write a script to remove them or do it manually. With aspects: just dont use the aspect in the compilation! Put them back in by compiling in the aspect again.

      For me aspects are a real benefit but they do you head in for a while when you're an OO programmer!

    7. Re:Where's this useful? by sergio.garcia · · Score: 2

      The sad thing is that the loggin facility is the only convincing example I have heard so far. :P

      --
      "Agree with them now, it will save so much time."
    8. Re:Where's this useful? by cushty · · Score: 2, Interesting

      The other is probably design by contract or something like that. Checking that things that call a method pass good parameters and that methods return what they say they should. A generic aspect could check that all parameters are not null and that a method doesn't return null. A more specific aspect could check particular method parameters, return values, and object consistency. Once confirmed to be working you remove the aspects and your code will "just work like normal" *gulp*

    9. Re:Where's this useful? by nojomofo · · Score: 5, Insightful

      I'm not trying to troll here, but I'm afraid this might sound like it.... It sounds to me like the main selling points of AOP are that you don't have to design things well in the first place, because if you missed something, well then you can change how your objects behave without redesigning them.

      The place where this wouldn't be true is with code that's part of the API or other code that comes packaged. I think that changing the behavior of this type of code sounds pretty dangerous to me - there's a reason that some data is kept in private and protected variables! Wouldn't you get into situations where you've added and aspect or a parent or some such thing, and in the process you access a private variable, and then you upgrade your runtime environment which changes the INTERNAL structure of the code that you hooked into (leaving the external API the same), breaking your code? Isn't that what code encapsulation is for? What I'm hearing touted as AOP's best feature is that you can break encapsulation.... Count me out.

    10. Re:Where's this useful? by stratjakt · · Score: 1

      So you're saying that aspects are helper functions or classes, that are implicitly called, rather than explicitly? (maybe implicit is the wrong word, but they're attached from outside the code itself)?

      So this basically saves you the hassle of writing stuff like this?

      #ifdef DEBUG
      do this
      #endif

      Seems in a large project it would be real easy to forget about code that executes that you cant see.. Is the added complexity worth it?

      --
      I don't need no instructions to know how to rock!!!!
    11. Re:Where's this useful? by tshak · · Score: 1

      You simply tell the compiler "When this method is called, do this first (or afterwards)."

      Maybe I'm misunderstanding your point, but can't this be accomplished via OOP?

      override MyMethod() {
      // ...
      base.MyMethod();
      }

      --

      There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
    12. Re:Where's this useful? by Enonu · · Score: 5, Informative

      Yeah, this review didn't introduce AOP that well.

      Going here:
      http://dev.eclipse.org/viewcvs/indextech.cg i/~checkout~/aspectj-home/doc/progguide/index.html

      I found this code example:

      pointcut move(): call(void FigureElement.setXY(int,int)) ||
      call(void Point.setX(int)) ||
      call(void Point.setY(int)) ||
      call(void Line.setP1(Point)) ||
      call(void Line.setP2(Point));

      and then this:

      after(): move() {
      System.out.println("A figure element moved.");
      }

      As you can see, "after" any method call as defined by the pointcut, System.out.println is executed to reflect this fact.

      I can see how this would be great for logging, checking pre/post conditions, quicker debugging, or anything else that is of a "horizontal" nature in your code.

    13. Re:Where's this useful? by ndvaughan · · Score: 2, Informative

      I did a paper on AOP last semester. Basically, AOP not only gives you an object-oriented view of the code, but also splits it up according to other aspects of its functionality, like "security", or "debugging". Then, when you want to add a certain functionality to multiple objects, all you do is name all of the class methods that are affected (called a "joinpoint"), and then write one section of code, instead of changing each and every object (or class) that you would have to do if you were using an OO language. Go to http://www.parc.com/groups/csl/projects/aspectj/in dex.html and look at some of the PPT presentations. They describe it pretty well.

    14. Re:Where's this useful? by Caoch93 · · Score: 3, Interesting
      Really, the biggest use for AOP is, as far as I know, still not available in AspectJ. AspectJ was, as of the last time I looked at it, just an additional compiler for a language extension to Java. As a result, I can't say that I find AspectJ all that amazing.

      AOP is a very interesting notion in that it allows you to separate your concerns. Application logic, security, logging, transaction maintenance, etc, etc, etc. All of these things can be written separately but are then woven together at specific critical points. The result of good AOP programming is that your code is cleaner, and the guy writing application logic thinks only about application logic, not about persistence, caching, security, etc, which are all implemented as separate conerns and woven together later.

      The real power is the ability to define this at runtime instead of compile-time, though. Imagine this- you write a generic caching and persistence layer for an application. You write this once. Then, at runtime, any time you want to apply this persistence layer's functions to an object, you just instruct the application (through a config file or some other means) to weave the persistence layer in with a specific object. Boom. Instant persistence. You could do this with any feature really, as long as you wrote each aspect generically.

      This is a pretty extreme boon for certain classes of applications. Specifically, take any application that's modular or componentized. Each component can now have additional services dynamically bound to it. You can apply code as a policy over any activity...field modifications, method calls, constructors...etc. As a result, you can apply special policies to modules or compnents in your application without having to actually code them in to the component.

      Other possiblities include applying advice to the constructor of Thread objects that checks threads into a registry on their creation. Now, every thread in the VM has a handle in this registry. If a thread flies off into an infinite loop, you can see the stacktraces of all the threads easily and have a better point to investigate from.

      It's worth noting that the applications that really will benefit from this methodology...applications servers...are taking note of it. The JBoss 3.x series was written with a limited form of AOP that can only apply policies in limited ways to objects that implement certain interfaces. The next major version of JBoss promises the opportunity to leverage runtime AOP so that any Java object can have server services bound to it regardless of whether it implements an EJB interface or not.

      Again, though, the power comes in in the ability to make these pointcuts at runtime. AspectJ, as far as I know, still doesn't offer this, so you can't dynamically change the aspect policies in your application dynamically. That makes AspectJ pretty useless for AOP in my book.

      Then again...I could be talking arse. Here come the flames!

    15. Re:Where's this useful? by Minna+Kirai · · Score: 1

      That only works in OOP if you actually are creating a derived class (and, depending on language, if the other programmer didn't make it a "final" method)

      In AOP, you can decide to apply pre/post behaviors to a bunch of methods without needing to first create inherited classes, and then change the construction-calls ("new MyOverRiddenObject") to make those new classes.

    16. Re:Where's this useful? by Anonymous Coward · · Score: 0

      This sounds about right. It's basically trying to abstract the cross-object interactions that are necessary for things like effective synchronization and transactional support.

      This sounds good, but I'm skeptical about the market for this. On the server side these things are handled by management environments like servlet containers, EJB systems, and (shudder) .NET environments. On the client the need for these services isn't great enough to make supporting a new programming paradigm worthwhile. It could be useful on the back-end, but it will take a long time to catch on.

      It's worth remembering that one of the reasons that OOP took so long to catch on was the lack of decent compilers for OO languages (particularly C++). Aspect proponents should take note.

    17. Re:Where's this useful? by BMazurek · · Score: 1

      When you decompose a system into a set of objects, you do so according to what some call the dominant decomposition. By virtue of consolidating various (I hesitate to use this word here in this context) aspects of your program into these object classes, various other aspects of your program get scattered to the wind. (This is called the tyranny of the dominant decomposition.)

      AOP allows you to consolidate these portions of your program into a independent entities: aspects. An aspect will encapsulate a certain feature of your program into one location where you can easily modify, extend or replace it.

      Wrote an application and would like to insert ACL checks for security prior to accessing data sources? Encapsulate this in an aspect. Maintain that aspect independently. If you want a version of your application with security, compile it with the security aspect included. Want a version without security, compile it without the security aspect.

      Want to add security to another portion of your program? Where do you add it? Do you add it the security calls to the applicable methods of classes X, Y and Z? Or do you extend the set of join points to which your aspect is applicable? That is, do you add the security-layer calls all over hells-creation, or do you add it to the consolidated list recorded in your security aspect?

      The more I look at AOP and the more I see, the more I think this will revolutionize development.

    18. Re:Where's this useful? by Minna+Kirai · · Score: 2, Interesting

      Seems in a large project it would be real easy to forget about code that executes that you cant see.

      The nice thing, then, would be a smart editor which is aware of aspects, and can draw flags on top of the source code you're reading so that the programmer is warned that an Aspect will be sticking it's nose in.

      Even better, you could click those flags to apparently expand the aspect's code inline, revealing exactly what statements will execute when the function runs. Of course, this can't be reliably done in all cases, if the Aspects are something that can be toggled on/off as the program runs.

      In that case, the editor might have to be pessimistic, and assume "an Aspect might apply here...". But that might not work well either. In the end, you need smart programmers, both writing the aspects, and using them.

    19. Re:Where's this useful? by kwerle · · Score: 1

      That only works in OOP if you actually are creating a derived class (and, depending on language, if the other programmer didn't make it a "final" method)

      Or if you're writing in Obj-C. Using Obj-C, you can dynamically replace instance methods on the fly and call the previously defined method when you're done/before you start (or both, or not at all).

      It's easy to do, and it's a dream if you need to patch a system, but it leads to code that is hard to debug/understand.

    20. Re:Where's this useful? by stratjakt · · Score: 1

      I'm still missing the big pictures. It's usually the case that trivial examples used to explain a programming concept are the worst implementation of the concept. Like when taught recursion with the factorial example. A for loop with a collector variable is a much better implementation than a recursive function.

      For the logging example, macros (I'm thinking in C++) seem to work better. I define a macro like #define DEBUG_LOG write_log(), then link against my library that defines write_log, and other debugging functions. In the release builds, I redefine the macros to nothing, and dont link the library. I do the same thing for sanity checks and assertions and other debugging tasks.

      Maybe I just need to read some better examples about what aspects would do, beacause in this case they'd just add obscurity to the code. Perhaps this is something better suited for larger more distributed projects?

      I've always had it driven in my head that good code should read like a book. With aspects the code would read like a book with the first and last few dozen pages missing.

      --
      I don't need no instructions to know how to rock!!!!
    21. Re:Where's this useful? by MsWillow · · Score: 4, Informative

      Want to remove every single log line to improve speed? With the "normal" approach you'll have to write a script to remove them or do it manually.

      Or you change one #define in one .h file, re-compile and you're golden. That removes all the #ifdef debug code you put in when you were writing it.

      Do they teach programmers anything useful these days? Sheesh.

      --

      Lemon curry?
    22. Re:Where's this useful? by BHearsum · · Score: 1

      I'm really reminded of GTK's callbacks. This paticular example makes me think of AOP as the same thing as Event Driven prorgramming.

    23. Re:Where's this useful? by ipjohnson · · Score: 1

      Or -DDEBUG on the copile line.

      I'm sorry it just sounds like a great way to create bottle necks.

    24. Re:Where's this useful? by Anonymous Coward · · Score: 1, Informative
      It sounds to me like the main selling points of AOP are that you don't have to design things well in the first place, because if you missed something, well then you can change how your objects behave without redesigning them.


      No, that isn't the purpose of AOP, although it can seem like that when you get the newsbite version of it. The goal of AOP isn't so you can string in extra code you forgot, it's so you can cleanly separate the different parts (aspects) of your program so that someone can see the real purpose of a method/class/package without seeing all the extra cruft that is needed but is incidental to the main purpose (error handling, logging, persistence, etc).

      The typical example is in adding logging behaviour to a system. AOP isn't there so much so that you can say "Oh yeah, we need to log this stuff" after the fact (after all, in normal OOP the programmer can always just paste in the required code to all the methods). Rather it's identifying that the log code is entirely orthogonal to the main purpose of the system, and as such doesn't really "belong" in the method definitions. It has nothing to do with the real purpose of the method, the only reason it is there is because the only way to get the desired behaviour when that method is executed is (was) to actually drop all the logging code directly into the method.

      The biggest beef many people (myself included) have with AOP is the fact that it has the potential to make your programs completely unreadable or unmaintainable (but, then again, show me a programming paradigm where it's impossible to make unreadable/unmaintainable programs). This happens when people misunderstand the purpose of aspects, and start using them to do things they shouldn't be used for (namely, the reasons you mention above: to tack on extra code to a method, code that really is a proper part of the method, but was stuffed into an aspect because of inexperience/laziness/gee-whiz-aspects-are-great. IMHO, AOP is still so new that we don't really have a good set of idioms for what should be in an aspect and what should be in the method proper.

    25. Re:Where's this useful? by William+Tanksley · · Score: 1

      It sounds to me like the main selling points of AOP are that you don't have to design things well in the first place, because if you missed something, well then you can change how your objects behave without redesigning them.

      No; of course, that won't work. Bad design can't be simply patched over; you'd have to edit the original source.

      However, it _does_ mean that you don't have to write your function to include everything that your function has to do. You can code the function in a simplistic way, ignoring boundary cases, odd memory management quirks, and esoteric optimizations: just make the code say what it does. Then write an aspect to be the optimization, and another to handle memory management in that and similar code, and another to handle the boundary cases, and so on.

      -Billy

    26. Re:Where's this useful? by Anonymous Coward · · Score: 0

      You could also make a debugging class, have your objects use this class to write debug output, then, have a production version of this class.

      In dev version you actually write the logs, the prod version is empty. Simply make the class return boolean as the return value... Extra objects in your code suck but developability (new word) and the ability to easily troubleshoot is as important as having fast code.

      AOP is simply a way of formalizing all of the variables (not $a) associated with OOP. I think of it as a best practices implementation with a language implication.

    27. Re:Where's this useful? by Minna+Kirai · · Score: 1
      Like when taught recursion with the factorial example.

      That all depends on if the student is a math major, or in software-eng. Math guys find induction functions clear and beautiful.

      For the logging example, macros (I'm thinking in C++) seem to work better.

      C++ preprocessor macros are a reasonable way to emulate some AOP behavior, but they have many drawbacks. Using something like your DEBUG_LOG means that as all the functions are written, a programmer has to remember to add these macros to each one. Negative effects:
      • This creates an opportunity for human error. If DEBUG_LOG is forgotten from a function, you might not realize it, and falsely trust a logfile that says it wasn't called
      • Limited flexibility. Ok, you've got DEBUG_LOG in every function. What if you want to change the logging to only happen on one function, on functions that write to data structures (not read it), on functions that are suspected to be slow? To support this kind of thing, you'd need to change the DEBUG_LOG in every single call. (Some people do this. They give DEBUG_LOG an integer argument, which is masked against a debugging variable set at program startup. That's still limited)
      • Once every single function has a macro in it, the total length of the program has increased. ("Yay! More SLOC, I've met this week's quota"). But the length the functions have gained is not related to computing the output of the function, it is for a totally different purpose. It makes the code (slightly) harder to read, write, and understand. (Do you love it when an argument to DEBUG_LOG accidently gets a side-effect in there? I sure do!)

        With only one kind of macro, it's no big deal, readers see the macro as just "another standard piece of every function definition". But if more flexibility is desired, then other kinds of macros float in, increasing ugliness and raising the percentage of each function body that doesn't directly contribute to the output of the function.


      But yes, logging and santity checking are prehaps too simple examples to present the concept's power. (Drawing circles and square's is also a poor demonstration of the benefits of OOP, but all introductory lessons use it)

      With aspects the code would read like a book with the first and last few dozen pages missing.

      The output of the program is still fully determined by the source code, so no pages are missing. Instead (this is how it should work, IDK in practice), the authors gave general directions on how to perform a category of tasks, rather than repeating those instructions in each and every recipe. ("And if you're diabetic, do this. And for kosher food, do this. And if you're at above 3km altitude...")
    28. Re:Where's this useful? by PurplePhase · · Score: 1
      The short answer is "No, they don't teach programmers anything useful anymore."

      A different answer includes the fact that there aren't #ifdef's in Java, and that you don't have to put them in there in the first place using AOP.

      Then again the review mentions not being able to use it in production systems. And there's the old problem of changing any existing system to incorporate it. The papers I've read say that AspectJ add a negligible amount of time to the execution, but that doesn't mean it can't hurt - even if you don't make any infinite loops :)


      8-PP

    29. Re:Where's this useful? by nojomofo · · Score: 1

      Okay, I'll agree with the common theme of "people can program badly in any sort of language", and AOP isn't particularly better or worse than OOP in this. But what I would like somebody to explain to me is why it's okay to allow encapsulation to be broken. Is there any way to really keep a private data member private? How about all of the other reasons that encapsulation is a good thing, like the fact that it allows a programmer to change algorithms entirely as long as a consistent interface is explained?

    30. Re:Where's this useful? by stekylsha · · Score: 1

      You know, this sounds an awful lot like head patching and tail patching, something the MacOS did back when everything ran in the same address space and they used the 68K's interrupt vector for system calls. It quickly became a total mess.

      What happens if tail patches conflict? Is there a spec as to what gets executed first? Does the first one executed always win?

      In a small project that is carefully designed and managed, this might work alright. On a large project, even with careful design and managment, this could become a nightmare very quickly.

      I'm hopeful because this is fairly cool and would be really nice to use in many instances. On the other hand it's likely that it will be horribly misused (like operator overloading in C++) and become just another Bad Idea.

      --
      "There is no spoon." - Neo
      "Spoooon!" - The Tick
    31. Re:Where's this useful? by etcpasswd · · Score: 1
      if the other programmer didn't make it a "final" method

      What stops the end user from extending a commerical AOP application? I, as a commerical software developer, don't want the end user to hook into my program as he pleases. How does AOP handle this scenario?

    32. Re:Where's this useful? by asolipsist · · Score: 2, Interesting

      I still dont understand how this is all that much different than event driven programming. Obviously its syntatically different than using event triggers, but is it conceptually?

      Every example of AOP I've seen uses the "logging example" (is AOP actually useful for anything else?)
      In this example some sysout is printed after certain method calls.
      methodFoo();
      methodBar();
      both trigger message();

      so what? Can't this be done with java style event handlers and triggers? Are there benefits of AOP beyond oberserver/oberserved type relationships?

    33. Re:Where's this useful? by gr8_phk · · Score: 1

      So what you really want is 2 functions in the base class that are called at entry and exit from the corresponding function in the subclass. This is similar in behavior to constructors isn't it? Only is applied to other functions and again on exit from those functions. You just need a compiler that knows to add a call to the "aspects" at the start/end of overloaded functions if the aspect exists. Putting them in a base class definition shouldn't make it too hard to follow the code.

    34. Re:Where's this useful? by UnknownSoldier · · Score: 1

      > Limited flexibility. Ok, you've got DEBUG_LOG in every function. What if you want to change the logging to only happen on one function, on functions that write to data structures (not read it), on functions that are suspected to be slow? To support this kind of thing, you'd need to change the DEBUG_LOG in every single call.

      You don't need a DEBUG_LOG in *every* function. Only the ones that you are interested in.

      I ran into exactly this type of problem when I was working on a sound system (PS2) last year. (Debugging real-time systems - ugh.)

      My solution was to use a 2 tier system.

      e.g.

      // Master enable/disable
      #define LOG_SOUND 1

      // Specific logging
      #define LOG_SOUND_UPLOAD 1
      #define LOG_SOUND_CREATE 0
      #define LOG_SOUND_PLAY 0
      #define LOG_SOUND_VOLUME 0

      Sound::Play()
      {
      #if LOG_SOUND & LOG_SOUND_PLAY
      printf( "Playing..." )
      #endif
      :
      }

      Sound::Upload()
      {
      #if LOG_SOUND & LOG_SOUND_PLAY
      printf( "Uploading..." )
      #endif
      :
      }

      Sound::Pan()
      {
      :
      }

      > (Some people do this. They give DEBUG_LOG an integer argument, which is masked against a debugging variable set at program startup. That's
      still limited)

      Yeah, a "debug level" or "debug bitmasks" are the 2 common ways of doing this. The orthogonal logging drove me to a variation on the "bitmask" style.

      > Once every single function has a macro in it, the total length of the program has increased.
      I haven't found this to be an issue -- and this is on a console, where memory is tight! The logging doesn't add THAT much to the code size. Logging is ONLY enabled for when I need to debug "full optimization" builds. When everything works, I turn the logging off.

      Besides which, logging everything, brings the entire game down to a complete crawl.

      Cheers

    35. Re:Where's this useful? by e2d2 · · Score: 1

      Logging is frequently used as the killer app to justify AOP (Does Jog4J use AOP as the basis for it's design?). But a code profiler might be another example of when to use aspects.

      My biggest beef with AOP is that unlike OOP it cannot be easily explained to a novice. People can understand OOP because it relates to real world metaphors very easily. Objects have properties and you can interact with those objects using actions (methods). I can explain this to my brother, who is a brick layer, and he understands what I am talking about when I say I want to create a "brick" object and changes it's color property to red. It seems a little abstract to him to talk about computer representations of real world objects and manipulate them, but he can make the leap. The reason for OOPs popularity is it's ease of use and logical representation of real world ideas.

      But when you try and explain AOP to a novice you have to explain it in terms that don't have a logical metaphor that you can easily reference. join points? cross cutting? You are now manipulating real world objects using a event and time based metaphors. I think it is hard to make the leap and that is going to be a hurdle for adoption of AOP. What they need is a good group of high profile evangelists and more real world examples (other than just logging).

    36. Re:Where's this useful? by Anonymous Coward · · Score: 0

      So how is this different from this:

      move(): call(void FigureElement.setXY(int,int)) ||
      call(void Point.setX(int)) ||
      call(void Point.setY(int)) ||
      call(void Line.setP1(Point)) ||
      call(void Line.setP2(Point));

      System.out.println("A figure element moved.");
      }

    37. Re:Where's this useful? by pyropaul · · Score: 1

      Aspect-oriented programming is used in a high-level verification language for verifying ASICs and SoCs (systems-on-chip). At the moment, the language "e", used in Verisity's specman elite tool is proprietary, but there is an IEEE committee on HLVLs (high level verification languages)

      See verisity's website for more info.

      Cheers,
      Paul.

    38. Re:Where's this useful? by Minna+Kirai · · Score: 1

      I don't know details like that (AOP is not 100% defined yet, implementations may vary).

      And AOP is used more during program building, so this problem would apply to a commercial library, not a finished executable. (Otherwise, it's just like asking "What keeps an end user from from calling functions in my programs?"- the fact that they're completely undocumented and unsupported, that's what)

      Now, regarding a library written with AOP style- maybe there is nothing to stop the user from extending it. And maybe this is a good thing.

      (In all likelihood, though, AOP can only work if you have the source code, or a least a non-obfuscated binary like Java classes. In which case, the user could effect his changes anyhow by just modifying the code, or de-compiling it and editing that)

    39. Re:Where's this useful? by jilles · · Score: 1

      Actually new paradigms like this are extremely usefull because we are rapidly approaching the ceiling of what we can do using modern technology. There are now many companies developing/maintaining software systems that have multiple millions of lines of code (of which an increasing amount is either Java or C++). Typically these large systems are a nightmare to maintain and require the fulltime attention of extremely large development teams (up to 1000 programmers) to keep them up to date. Any technique that can help factor out logical units of behavior into nice maintainable modules of code is extremely useful to these companies because that allows them to put more programmers on creating new functionality rather than maintaining existing code.

      This situation has caused researchers to go and look for alternatives to the traditional OO and procedural paradigms. Particularly IBM has contributed a lot in this research area (e.g. multi dimensional separation of concerns and subject oriented programming). However, none of these approaches ever made it out of the labs into the real world. In 1997 Kiczalez et al. from Xerox labs published a paper on AOP at Ecoop '97. At the time they were using CLOS (an OO lisp dialect) for the handfull of toy examples in the paper. Kiczalez had the vision that if he was ever going to get real life experience with real AOP systems he would have to have a compiler that was usable by regular programmers. Hence the AspectJ project was born. For more than three years the aspectJ project has worked with a rapidly growing community to create a compiler. Some time ago the 1.0 version was released and since then there have been updates to improve the compiler, integrate into popular development tools and resolve some minor language issues.

      AspectJ extends on what Java developers already know (you can compile your existing java code with it) and adds useful AOP features to the Java language. At 1.0, the compiler is stable, the language has been tuned by experts to be useful in day to day programming and you can actually make very nice systems with it.

      However, AspectJ is currently also a very powerful language that maybe offers programmers too much power (just like C++ is a lethal weapon in the hands of those who do not understand it). So yes, it is easy to create spagheti code. However it is also easy to convert existing spagheti code to nicely modularized code where existing techniques would make that very hard to do. You just need to understand what you are doing.

      AOP is still new. Good design patterns for it have yet to emerge. It is currently unclear how to model an aspect in UML, development methodology has yet to adjust to using this new technique and this is only the first implementation of a new paradigm. It's not designed to be perfect but to be usable with existing Java code. Other AOP implementations exist and are in various state of development/usability but AspectJ currently is the most mature of these approaches.

      Still curious? Download the compiler and browse through the examples.

      --

      Jilles
    40. Re:Where's this useful? by Anonymous Coward · · Score: 0

      My biggest beef with AOP is that unlike OOP it cannot be easily explained to a novice.

      Ah, so if you do not like it you are now a novice? Thanks for helping the discussion along...

      What you need to make it more popular is good examples. Evangelists can go screw themselves in a dark corner; I'll decide on my own if I can use it for something or not.

      I have used similar facilities in C++ in the past, by declaring as the first thing in any function an object that calls the hook function (which was, in my case, a logging function). It was somewhat useful, and having them automatically added instead of by hand would obviously save a lot of work, but the only use for this seems to be logging (in fact the only other example you mention, code profiling, is essentially logging with better timers).

      Bottom line: I'm not convinced. Logging is not a good enough reason to allow this extra level of obfuscation into our systems.

    41. Re:Where's this useful? by mccoma · · Score: 1

      well, I gues the real world metaphor using your brick example would be:

      Either before or after you change the color to red, some dude is gonna want to do something because that dude is watching the brick for color changes and needs to do some other work based on that.

      I do agree, it isn't the logical, next progression when I am trying to explain object oriented programming.

    42. Re:Where's this useful? by Minna+Kirai · · Score: 1

      You don't need a DEBUG_LOG in *every* function. Only the ones that you are interested in.

      The idea is, that in a multi-programmer project, the guy who writes the functions doesn't know what other people might care about. He's either got to add a debug macro to each one, or expect other people to do this for him later.

      In many projects, that isn't a problem at all. But some people will get disturbed by this, it depends on your organization. Developers of real-time systems are less likely to care.

      The logging doesn't add THAT much to the code size

      The size of the outputted program isn't what we're talking about. I mean the size of the source code.

      The supposed advantage of Aspect Orientation is that when you add logging (or some other "cross-cutting" feature) to a class, it only takes a constant number of lines of of code. Otherwise, it would take lines of code proportional to the number of methods in the class. And when more methods are added, more lines.

      Ideally, AO should allow a Bob to add features to all the functions Adam wrote in a class, and later when Adam writes more functions, Bob's features will automatically apply. (Without Adam ever needing to know that someone else is logging his calls)

    43. Re:Where's this useful? by Minna+Kirai · · Score: 1

      Quibbling over 2-3 lines from simple macros isn't valuable. However, if I had written debug macros like that, I'd have gone like this:
      // Master enable/disable
      #define LOG_SOUND 1 // Specific logging
      #if LOG_SOUND == 1
      #define LOG_SOUND_UPLOAD 1
      #define LOG_SOUND_CREATE 0
      #define LOG_SOUND_PLAY 0
      #else
      #define LOG_SOUND_UPLOAD 0
      #define LOG_SOUND_CREATE 0
      #define LOG_SOUND_PLAY 0
      #endif

      Sound::Play()
      {
      #if LOG_SOUND_PLAY
      printf( "Playing..." )
      #endif
      :
      }


      That transitions a little complexity (and code size) out of each function, and concentrates it at the macro setup in the top of the file. Then as an additional step, I'd do this:

      // Master enable/disable
      #define LOG_SOUND 1 // Specific logging
      #if LOG_SOUND == 1
      #define LOG_SOUND_UPLOAD(x) printf x
      #define LOG_SOUND_CREATE(x)
      #define LOG_SOUND_PLAY(x)
      #else
      #define LOG_SOUND_UPLOAD(x)
      #define LOG_SOUND_CREATE(x)
      #define LOG_SOUND_PLAY(x)
      #endif

      Sound::Play()
      {
      LOG_SOUND_PLAY(("Playing..."));
      :
      }


      In this case, each function only has 1 line added to it, instead of 3. And instead of having #if going out to column 0, everything in the function body is indented consistently. (The all-caps is still a sufficient hint to readers that they're looking at a macro, not a function-call)

    44. Re:Where's this useful? by e2d2 · · Score: 1

      Ah, so if you do not like it you are now a novice? Thanks for helping the discussion along...
      I simply never said that or even implied it and you are stretching. What I meant is it's hard to explain to someone that is new to AOP, I.E. a novice. Or do you think programmers come out of the womb as experts? It will have to be taught and the inability to easily relate it to metaphor leave it lacking. Ease of use leads to wide adoption.

    45. Re:Where's this useful? by William+Tanksley · · Score: 1

      Actually, AspectJ strictly observes encapsulation, so you're okay. (Or at least it did when I learned it -- there was some debate even at the time, since it's obvious that being able to pointcut on private variables is useful.)

      I'm definitely on the side of forbidding breaking of encapsulation. There's too much coupling otherwise.

      -Billy

    46. Re:Where's this useful? by e2d2 · · Score: 1

      I guess I can see where you are going. I could always say - "ok but now the supervisor wants to count each brick because he is real anal and wants to keep a real time count of the amount of bricks you have lay."

      I guess with a little bit of effort I could make these metaphors work, but they need to be more widespread in the AOP movement if they want wide adoption. More education that is dumbed down for those of us that aren't the next Donald Knuth and need a little help ;-) (read:dummies like me)

    47. Re:Where's this useful? by Anonymous Coward · · Score: 0

      The standard answer to this sort of complaint is not to use macros in the first place. Sheesh, why does everyone want to do logging with macros? Just do it with a function call/method invocation.

      Optimizing compilers are smart enough (or rather, the compiler writers are smart enough) to remove your redundant code, generally. Even in C, with a good compiler you can use functions with a flag, and if that flag is set to off, it'll get optimized out.

      Then there's the general software engineering design type question of why you want to remove your logging code in the first place (that confident it won't fail in production?). Sure, you probably want to turn the verbosity down a bit, but you don't want to eliminate your logging facility altogether. In that usage, the logging functions are hardly going to be this huge performance penalty.

    48. Re:Where's this useful? by nojomofo · · Score: 1

      Maybe AspectJ claims to observe encapsulation, but as far as I'm concerned, the following breaks encapsulation, because it allows application developers to rely on implementation-specific details (that were carefully protected!) of an API:

      ...the aspect can't reach an instance variable it needs to read because it is declared in protected scope. [This problem] is easily overcome. AOP offers a mechanism by which extra classes can be bodged ('introduced' is the preferred verb in the AOP community) into the hierarchy as parents of existing classes. He uses this to add an accessor method for the field in question.

      Maybe he's technically retained encapsulation by "re-encapsulating" the object somewhat differently, but for all intents and purposes, he just accessed a variable that he wasn't supposed to, so in my book, he's just done a no-no.

    49. Re:Where's this useful? by eglamkowski · · Score: 1

      Ok, I can see the idea of bounds checking and memory mangament and such things being done in a more transparent way (I hate things like String classes - Borland's AnsiString class disturbs me to no end! And don't even get me started on C++ exception handling...).

      BUT, things like overrunning array bounds or dereferencing a free'd pointer is generally a case I want to know about and fix (i.e. have the app crash and burn), rather then have it be implicitly handled and keep running without my knowing about it. (mind you, I'm doing stand alone app development and not anything mission critical...)

      And if it is a team of programmers and someone wrote an aspect to "silently fix and keep running" these types of problems, then I may be in a world of hurt later on. And finding a bug that was thus hidden would be a nightmare.

      I mean, if I really want my program to handle "errors" in an "intuitive manner" and keep going, I'd write in Perl. (N.B. I *LIKE* Perl, but only for certain types of things).

      --
      Government IS the problem.
    50. Re:Where's this useful? by eglamkowski · · Score: 1

      Also, how does it interact with multi-threaded stuff?

      --
      Government IS the problem.
    51. Re:Where's this useful? by SamThePondScum · · Score: 1

      Wouldn't it be cool if you could make everyone read a disclaimer before they read any of your posts that said you're not being insulting and you're willing to explain anything that's confusing?

      And, now that you know how cool making people read disclaimers is, if you could make it happen for all the messages you've ever written, without going back and editing them?

      Or, in other words, I'd never hard of this "aspect" programming before today, but I think it's kind of cool.

      --
      -- PondScum, SamThe
    52. Re:Where's this useful? by William+Tanksley · · Score: 1

      And if it is a team of programmers and someone wrote an aspect to "silently fix and keep running" these types of problems, then I may be in a world of hurt later on. And finding a bug that was thus hidden would be a nightmare.

      No doubt if you were on the same team and someone wrote a function to work around a bug (rather than finding it and fixing it) you'd be in a world of hurt, too. It's possible, but it's no more possible now than it was before.

      I mean, if I really want my program to handle "errors" in an "intuitive manner" and keep going, I'd write in Perl. (N.B. I *LIKE* Perl, but only for certain types of things).

      You're confusing "aspects" with "magic". They don't fix errors for you. They don't "silently fix and keep running," any more than a text editor silently fixes your code and keeps it running, or the C preprocessor silently fixes C code and keeps it running. They only do what you code them to do.

      In fact, the comparison to the C preprocessor is a very good one. The C preprocessor (cpp) searches through text for simple text patterns and replaces them; AspectJ searches through your program's parse tree for simple semantic patterns and augments them.

      -Billy

    53. Re:Where's this useful? by William+Tanksley · · Score: 1

      Actually, that IS new since I learned the language; I can't say whether or not I like it, but I'm a bit suspicious.

      Let me say, however, that what he did isn't illegal; anyone can declare a derived class, and a derived class has every right to access a protected variable. That fits the API of the original class perfectly well. And the subclass getting the new parent really had the right to access the private variable all along, so it's not doing anything wrong either.

      No, this makes perfect sense. It fits with object orientation and aspect orientation, even if it seems a little roundabout at first. The object should be able to access the protected variable, but the aspect shouldn't be allowed to. Thus you introduce an object which can legitimately access it, and use it to build an API for the aspect to use.

      -Billy

    54. Re:Where's this useful? by eglamkowski · · Score: 1

      Zippy comment I found at the bottom of this page:

      Pascal Users: The Pascal system will be replaced next Tuesday by Cobol. Please modify your programs accordingly.

      ----
      No doubt if you were on the same team and someone wrote a function to work around a bug (rather than finding it and fixing it) you'd be in a world of hurt, too. It's possible, but it's no more possible now than it was before.

      If I wrote a function that didn't do bounds checking on a passed-by-reference array before it returned it, and it overran array bounds, there's no possible work around possible. It WILL bomb.
      Maybe not right away, but it will eventually. If he wants to modify my function to check array bounds, there will be a great big visual footprint of such modification, either new code or a new function call or a new preprocessor directive or SOMETHING. With an aspect, there's nothing in there to clue me in that there was an error.

      And the preprocessor analogy isn't quite apropos, because with preprocessor directives you see something in the code that tells you something is happening at that point. It sounds like with aspects you don't get any corresponding cue in the code.

      Perl does automagically fix stuff - overrun an array bounds? No problem, it just grows the array to be big enough. Use an array in a scalar context? No problem! (well, there is, but there is well defined behavior for this case so it does that and keeps going like nothing happened). I've written perl programs where it did the Right Thing even though I wrote the code in the wrong way. That can be pretty scary, but its ability to silently fix and keep going is what makes that possible.

      --
      Government IS the problem.
    55. Re:Where's this useful? by nojomofo · · Score: 1

      I see what you're saying, but this still strikes me as a risky proposition. I could, in theory, create a new parent for a class that defines some method differently from the original parent of the class. This would change the behavior of objects that are instantiated as the old class (because they would inherit the method from the new parent rather than the old parent (which would now be the parent's parent?) and would be expected to act the same. But somebody working with one of these objects would be surprised that it no longer acts the same. In OOP, all I can do is create a new child with the new method, in which case I have to explicitly instantiate that child in order to get the new behavior, so I know what I'm getting into.

      Of course, this isn't something that an experienced programmer would do without knowing what he/she is doing, but if not used carefully, it could be cause of major problems.

    56. Re:Where's this useful? by William+Tanksley · · Score: 1

      If I wrote a function that didn't do bounds checking on a passed-by-reference array before it returned it, and it overran array bounds, there's no possible work around possible. It WILL bomb.

      Okay, if that's the case, then there's no problem -- nothing to fear. Aspects won't change any "impossible" into a "possible".

      Quite seriously, though, of COURSE it's possible to workaround almost any single bug. Programmers do it ALL the time -- usually one of the ways to find a bug is to first find a workaround, and only by carefully examining the workaround does the true cause become evident and fixable. Lazy programmers often just implement the workaround without bothering to fix the bug. Like I was saying, that sort of laziness is just as possible with AspectJ as it was with Java or C. No change.

      And the preprocessor analogy isn't quite apropos, because with preprocessor directives you see something in the code that tells you something is happening at that point. It sounds like with aspects you don't get any corresponding cue in the code.

      Not at all. Aspects can use more _subtle_ cues, yes; such as assignments to variables of a certain type, or calls to methods whose names match a regex; but the cues are all contained in the text. The analogy is very precise: AspectJ is a very powerful, semantically safe preprocessor for Java.

      Perl does automagically fix stuff - overrun an array bounds?

      Of course it does. I never said otherwise.

      AspectJ doesn't and can't.

      -Billy

    57. Re:Where's this useful? by William+Tanksley · · Score: 1

      Now you're not worried about encapsulation -- you're worried about the very concept of AOP. AOP allows you to insert new behavior almost _anywhere_, not only into new parent classes. You could use an aspect to insert the new behavior directly into the original parent without ever creating the inserted parent!

      The trick is that this is very well defined behavior. Worrying about it is very much like refusing to use subroutines because some programmer might change one of them while you weren't looking -- better to keep all your code in one function so that you can SEE the changes people might make!

      -Billy

    58. Re:Where's this useful? by mccoma · · Score: 1

      yeah, I like your example. I agree about the need for some better stepping stones. Objects, functional, etc. I got, aspects I am still fuzzy on.

    59. Re:Where's this useful? by sethdelackner · · Score: 1

      if you're writing in Obj-C. Using Obj-C, you can dynamically replace instance methods on the fly and call the previously defined method when you're done/before you start (or both, or not at all).

      I've been trying this out some myself and it is just amazing. The end result is that third party add-ons to common applications proliferate to provide tiny changes that users want.

      Kwerel, do you have links to some good articles on using Obj-C this way? My own adventures with poseas have been somewhat unsuccessful.

    60. Re:Where's this useful? by Anonymous Coward · · Score: 0
      >> "Then there's the general software engineering design type question of why you want to remove your logging code in the first place (that confident it won't fail in production?)."

      Okay, how about a different example than logging. How about..... development mode? Or how about different cross-concern functionality that is sold optionally, and therefore needs to be added or removed based on what options the customer paid for.

      Think beyond just the specific example given.

  3. I prefer reading... by borgdows · · Score: 5, Funny

    Microsoft-oriented development book at Microsoft Press!

    This book contains every programming concepts and practices to avoid like hell!

    1. Re:I prefer reading... by arvindn · · Score: 2, Insightful
      That's truer than you think. For instance, take this "Code complete" book by some Microsoft guy. I went through the horror of being forced to read some chapters of it in college. It recommends monstrosities like "Hungarian encoding": the name of each variable should reflect 1) its data type 2) what type of variable it is ("counter", "array index", etc) 3) what its supposed to do 4) what you were thinking when you named it, and other things too numerous to list.

      This is from /usr/src/linux/Documentation/CodingStyle

      Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged - the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft makes buggy programs.

    2. Re:I prefer reading... by punkball · · Score: 1

      But its put out by Microsoft? I thought one of the coding practices to avoid was coding for Microsoft platforms?

    3. Re:I prefer reading... by Anonymous Coward · · Score: 1, Insightful

      Actually Microsoft Press books have a few gems like "Rapid Development" and "Code Complete" by Steve McConnell.

      This just goes to prove that knowing how to do a good job and actually doing it are two completely different things.

    4. Re:I prefer reading... by namespan · · Score: 2, Insightful

      Having types work their way into names isn't entirely brain damaged. The hungarian way may be -- I tried it for a while, and couldn't make it stick. However, some data types lend themselves to it. Ever notice how often file pointers have the name fptr? That's because the naming convention serves the programmer -- programmers have an abstract convention of a file pointer in their head, and they work with it. Similarly, every once in a while I'll find myself giving a name like "HostList" -- a list (linked list, perl list, doesn't matter) of hosts.

      And Code Complete really isn't a bad book at all. It may give you some false starts and misdirections, but it will definitely make you think about aspects of software development methodology.

      --
      Libertarianism is rich wolves and poor sheep playing gambler's ruin for dinner.
    5. Re:I prefer reading... by Michael_Burton · · Score: 1

      Here's another vote for Code Complete, the best book about programming I've ever read.

      McConnell discusses a lot of popular programming practices and the rationale behind them. He clearly likes some practices more than others, but he doesn't force any particular methodology down the reader's throat. There are lumps of pure gold scattered throughout the book.

      I think it would be difficult to read this book with a receptive mind without becoming a better programmer.

      --
      When all you have is an axe, everything looks like a grindstone.
    6. Re:I prefer reading... by jilles · · Score: 1

      Interestingly the inventor of the hungarian notation (Charles Simonyi) has recently teamed up with Gregor Kiczalez (inventor of AOP) to start a new company.

      --

      Jilles
    7. Re:I prefer reading... by Lagged2Death · · Score: 2, Insightful
      Code Complete does not recommend the Hungarian naming convention.

      It has a chapter on naming things, and it has a lot of good guidelines for picking names. It strongly recommends settling on and using some standard, project-wide naming convention.

      There is a a section describing the Hungarian naming convention. That section includes a frank discussion of it's drawbacks and caveats. A quote from that section:

      Some of the versions of Hungarian that are in wide circulation... set up base types based on programming-language integers, long integers, floating-point numbers and strings. The result is a convention of little value... When you declare a variable to be an integer, you shouldn't have to change the variable's name if you change it to a long integer.


      Most critics of Hungarian - like the author of the CodingStyle document, apparently - don't understand it. You actually are closest to the money with point #2. I don't know where you got your other points from; your point #1 is specifically listed as something not to do.

      You're supposed to use the variable names to indicate abstract types, not programming language types. If you're merely using a prefixes to indicate programming-language types (i.e., int iQuantity, char chInput, etc.) then you're doing it wrong.

      You should actually read - rather than skim - Code Complete. It's teriffic book, no matter what your favorite OS is.

      I'm sorry if this post seems a little grumpy, but reading Code Complete was a revelation to me (Aha, I'm not crazy, these other people around me are doing it all wrong! No wonder this disorganized mess doesn't work!) and it's still one of my favorites.
    8. Re:I prefer reading... by etcpasswd · · Score: 2, Informative
      Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged - the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft makes buggy programs.

      Variable names are for the programmer - not compiler. Also, weakly typed languages like C will compile the code with mismatching types. Hungarian notation is just a mechanical way to name your variables consistently. I don't think Code Complete insists on Hungarian; most of the book is about throwing more light on the issues than forcing you to follow a specific standard. It is a good beginner's book, IMO.

    9. Re:I prefer reading... by Surak · · Score: 1

      I like Writing Secure Code from Microsoft Press, myself.

      The back cover says:

      "Required reading at Microsoft."

      Yeah, *that's* the book I want to buy about writing secure code. Heh.

    10. Re:I prefer reading... by Nevyn · · Score: 1
      However, some data types lend themselves to it. Ever notice how often file pointers have the name fptr?
      Sure, but that isn't really the type, it's a description of what the variable does (it points somewhere in a file). The same way unix file descriptors are often named "fd" (and yes an fd does allow you to do a lot more with it than an fp/fptr) ... the type is int but anyone who encodes that into the name is on some serious drugs, IMO.
      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
    11. Re:I prefer reading... by esanbock · · Score: 1

      Their new guildline for variable-naming in .NET is to not use variable type notation.

    12. Re:I prefer reading... by Anonymous Coward · · Score: 0

      Faggot.

    13. Re:I prefer reading... by Anonymous Coward · · Score: 0

      Sure, but that isn't really the type, it's a description of what the variable does (it points somewhere in a file). The same way unix file descriptors are often named "fd" (and yes an fd does allow you to do a lot more with it than an fp/fptr) ... the type is int but anyone who encodes that into the name is on some serious drugs, IMO.



      One could attach 'i' to every variable that's an int. But that's stupid, the point to prefixing variables is to carry around type information that the compiler doesn't check. Examples for types that C compilers don't check for... odd integers, even negative doubles, strings, strings that contain non-aphlanumerical chars, etc.


      Many bugs in the open source world related to people not understanding how variables are being used. Of course anyone can read the type info. But it is hard to understand how the variable should work. A perfect example of this problem has come up recently.

    14. Re:I prefer reading... by broter · · Score: 1
      • Sure, but that isn't really the type, it's a description of what the variable does ...


      Indeed. As with any religion, variable name comes down to preference. After coding for VC++ (among other things) for about 5 years, I've personally developed a distaste for it. I'm currently more verbose than most of the variables I see in (for instance) the linux TCP/IP stack, but I doubt I'll ever voluntarily add the "m_"'s, "i"'s, and "d"'s of the MS world again. If you need that much identification in your variables, you're probably doing something wrong.

      When I see coding like that now, it fills me with dread and sickness, which is funny since that's the same reaction my dad had to cigarette smoke after he stopped smoking.

      --
      "One man can change the world with a bullet in the right place."
      - Mick Travis, "If..."
    15. Re:I prefer reading... by Anonymous Coward · · Score: 0
      Most critics of Hungarian - like the author of the CodingStyle document, apparently - don't understand it

      No, I'd say they are criticizing the Hungarian notation as used in the Win32 API, which is indeed brain-damaged. It's not obvious a book from Microsoft Press (from Microsoft developpers I'd assume), would criticize the Hungarian as used and messed up in Win32.

  4. Fascinating by Limburgher · · Score: 4, Funny

    I love that aspects seems to provide alternative techniques without loosing any ease-of-use, coing-wise. I was afraid that in switching to this new method I'd loose some functionality, or maybe loose some speed, but so far so good. Nothing to loose any sleep over. :)P

    --

    You are not the customer.

    1. Re:Fascinating by jackjumper · · Score: 1

      I'm trying to decide if this is funny or if the person didn't actually read the review, in particular the part about the editing and 25 cents...

    2. Re:Fascinating by Pinky3 · · Score: 2, Funny

      I almost loost it when i read that someone modded this interesting instead of funny!

    3. Re:Fascinating by Anonymous Coward · · Score: 0

      'Lose' is spelled with one 'o', dude.

    4. Re:Fascinating by Anonymous Coward · · Score: 1, Funny

      My cousin's friend tried AOP, and lost his arm. Not just his hand, but the whole fucken arm. Just gone like that!

    5. Re:Fascinating by jcoleman · · Score: 1

      Read the review, dumbass.

    6. Re:Fascinating by Anonymous Coward · · Score: 0

      I'm trying to decide if you're an idiot or just a moron.

    7. Re:Fascinating by roman_mir · · Score: 1

      from dictionary.com
      Idiot:
      1. A foolish or stupid person.
      2. A person of profound mental retardation having a mental age below three years and generally being unable to learn connected speech or guard against common dangers. The term belongs to a classification system no longer in use and is now considered offensive.

      Moron:
      1. A stupid person; a dolt.
      2. A person of mild mental retardation having a mental age of from 7 to 12 years and generally having communication and social skills enabling some degree of academic or vocational education. The term belongs to a classification system no longer in use and is now considered offensive.

      So, do you imply his mental age is before 3, or between 7 and 12?

      I wonder what they call you if your mental age is 3-7.

    8. Re:Fascinating by Anonymous Coward · · Score: 0

      I wonder what they call you if your mental age is 3-7.

      I believe that is called 'Democrat'

    9. Re:Fascinating by micromoog · · Score: 1
      I wonder what they call you if your mental age is 3-7.

      Imbecile:
      1. A stupid or silly person; a dolt.
      2. A person whose mental acumen is well below par.
      3. A person of moderate to severe mental retardation having a mental age of from three to seven years and generally being capable of some degree of communication and performance of simple tasks under supervision. The term belongs to a classification system no longer in use and is now considered offensive.

    10. Re:Fascinating by Anonymous Coward · · Score: 0
      I wonder what they call you if your mental age is 3-7.

      Commander-in-Chief.

  5. RTFA by Anonymous Coward · · Score: 0

    And you might look less like a total dickhead.

  6. Yet another reason to switch to Lisp by Anonymous Coward · · Score: 5, Insightful

    I should have stuck with Lisp all this time. When OO became hot, we could switch to OO without a preprocessor (early C++) or a whole new language (C++ or Java). (Eventually, Lisp got CLOS -- the first standard language to do OO, in fact.) If AOP gets hot, that'll just be a few more macros.

    Once you've used a language like Lisp with closures, macros (at the language level, not wimpy C macros), and code-is-data, it's hard to go back. I feel sorry for everybody who has to use Java, for whatever reason, and will have to get a new language/compiler/libraries just to take advantage of a slight change in "what's hot today".

    1. Re:Yet another reason to switch to Lisp by mccalli · · Score: 1
      I should have stuck with Lisp all this time.

      Never trust a language with more brackets than code...

      Cheers,
      Ian

    2. Re:Yet another reason to switch to Lisp by swagr · · Score: 3, Informative

      Take advantage of both languages.
      Of course, as everyone knows, there are Scheme/Lisp implementetions in Java:
      http://grunge.cs.tu-berlin.de/~tolk/vmlangu ages.ht ml
      Ones that act as interpreters or compilers to Java byte code.
      Or write your own (it's not that hard) http://www.paulgraham.com/rootsoflisp.html

      --

      -... --- .-. . -.. ..--..
    3. Re:Yet another reason to switch to Lisp by Anonymous Coward · · Score: 1, Funny

      ((((((((((((((((((((((( I ((((((((((( absolutely ))))))))))) agree )))))))))))))))))))))))

    4. Re:Yet another reason to switch to Lisp by Minna+Kirai · · Score: 1

      The brackets are the code!

    5. Re:Yet another reason to switch to Lisp by ErroneousBee · · Score: 1

      The switch from Lisp wasnt the mistake, it was the move to C syntax that was wrong, replacing the unreadable parentheses with semi-colons, curly brackets, squiggles, dots and loads of other stupid ideas. Maybe COBOL went to far, and just got it wrong, but the idea of a human readable language is a pretty good one. If Java gets aspects support in the JRE, things like NetRexx and JPython could use this opportunity to undo some of the awfulness of Java by adding nice, readable, useful syntax for aspects.

      --
      **TODO** Steal someone elses sig.
    6. Re:Yet another reason to switch to Lisp by Latent+Heat · · Score: 1

      Isn't there a joke out there about how some "top-secret" Department of Defense code got accidently released to the public? It was only the last 10 pages of the source that got out, and it turns out the thing was written in Lisp, and that snippet of source was revealed to be only close parens . . .

    7. Re:Yet another reason to switch to Lisp by Waffle+Iron · · Score: 1
      I agree, Lisp and Scheme support every language feature you can think of. But I think Larry Wall said it best: "Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."

      That's why after almost 50 years, it still hasn't taken over the world. Moreover, while code that operates on code is extremely powerful, it can be one of the most mind-boggling features in all of CS. In a world where many developers can't understand simple recursion, it's probably just too advanced for general consumption.

      I think languages like Python and Ruby (especially use is made of their functional programming features) find the happy medium between powerful features and approachability.

    8. Re:Yet another reason to switch to Lisp by redragon · · Score: 4, Insightful

      And I think it's easier for people to write bad LISP than bad C/C++ (though I could be wrong). It seems to me that LISP suffers from "data morph" issues more than any other language.

      (5 256 "Item" "Description") represents your base data type.

      Programmer A:
      "I don't need that first number..."
      (256 "Item" "Description")

      Programmer B (who get's A's data):
      "What happened to that number?"
      (256 "Item" "Description" 5)

      Programmer C (who get's B's data):
      "Strings? We don't need no stinking strings, we can look those up in a table! I can make that table global! Sweet!"
      (256 1 20 5)

      Person hired 2 years later to fix a bug:
      "What the f*ck?!?"

      It seems to me that Scheme and Lisp over-extended themselves, and are just too powerful/flexible for their own good, and that some "rules" should be in place...

      And as the previous poster said...
      ((((()()))))
      Lisp will make you hate parenthesis.

      C

      --
      - Sighuh?
    9. Re:Yet another reason to switch to Lisp by Anonymous Coward · · Score: 0

      > Lisp will make you hate parenthesis.

      Well of course. That is why they named it
      Lots of Interfering Stupid Parenthesis

    10. Re:Yet another reason to switch to Lisp by antifuchs · · Score: 1

      you would not even need to define any new macros for the stuff that is shown in the review, IMHO - before, after, around-methods and call-next-method already exist in the lisp standard. (cue greenspun's tenth rule of programming).

      --
      this post was brought to you by Andreas Fuchs.
      echo [Address] | sed s/[-a-z]//g | tr A-Z a-z
    11. Re:Yet another reason to switch to Lisp by Anonymous Coward · · Score: 0

      Lots of Interfering Stupid Parenthesis

      You're new at this, aren't you?

      It's "Lots of Irritating Single Parenthesis"

      You'll know it if you ever write a 10 line function with one missing closing paren and you don't know at what level.

      It's a damn fine language otherwise.

    12. Re:Yet another reason to switch to Lisp by antifuchs · · Score: 2, Informative
      Some points about your posting:

      Either you have stuck around with too many bad lisp programmers, or you haven't paid enough attention to what they were doing - no usefulness can come from code which uses lists for anything more than they were designed for - sequences of data. (-:

      Also, it is not very rewarding to just clip the first element off the list you gave - it will still be around (not being garbage collected until the pointer to the head is), so why bother?

      Scheme is not, in any way I can think of, over-extended. It is designed to be a minimalistic language - hells, it even has minimalistic syntax. Please check your facts before you claim such things. Common Lisp does have a hell of a standard, though. But see Greenspun's tenth rule for why.

      And concerning your hate of paranthesis, I can only believe that you have mapped your () buttons to the wrong keys - using them from a non-shifted key (dump those []s, for example (-;) makes them much easier to type (and having an editor which can operate with the lists your code forms, helps too - use vi -l or emacs).

      --
      this post was brought to you by Andreas Fuchs.
      echo [Address] | sed s/[-a-z]//g | tr A-Z a-z
    13. Re:Yet another reason to switch to Lisp by paulfwilliams · · Score: 1

      Granted, Java doesn't have the Lisp ability to redefine everything-- and I mean everything-- but you can do lots of neat stuff with Java, too. There's nothing stopping you from creating dynamic Java code. Just build your class in memory, then load it from a class loader! It's very handy for stuff like proxies, ORBs, etc.

    14. Re:Yet another reason to switch to Lisp by jilles · · Score: 1

      Actually Gregor Kiczalez (AOP inventor) comes from a Lisp background and first experimented with AOP in CLOS (which he helped create as well).

      The problem with lisp is that it never really escaped from the computer labs. There are some nice lisp applications (e.g. emacs) but it's very much a niche language. That's why AspectJ was created: to draw attention of normal C++/Java programmers to AOP.

      --

      Jilles
    15. Re:Yet another reason to switch to Lisp by Dr.+Photo · · Score: 2, Insightful

      Yawp.

      What I got from the review is simply further confirmation of Paul Graham's hypothesis that more modern programming languages are asymptotically approaching the capabilities Lisp has had for decades.

      The whole "join points / pointcuts" thing seems to me like a watered-down version of Scheme's (and other Lisps) dynamic-wind and call/cc.

      (And didn't the B-type Golgafrinchans end up populating some utterly insignificant little blue-green planet orbiting a small unregarded yellow sun far out in the uncharted backwaters of the unfashionable end of the Western Spiral arm of the Galaxy? ;-)

    16. Re:Yet another reason to switch to Lisp by ReelOddeeo · · Score: 1

      I haven't read the copyright act since about 1988 or thereabouts. As I recall, when you register code for copyright protection, you must deposit a copy of the code with the copyright office. The copyright act was amended at some point such that you could register only the first 10 pages and last 10 pages of the program listing.

      The last 10 pages of a Lisp program being registered for copyright would probably not be made up entirely of parenthesis.

      It is not necessary to register a program in order to have copyright protection. It is only necessary if you are going to pursue litigation against a copyright infringer.

      (We were writing, what amounted to a driver, in Pascal on Mac OS. Small main program. Many libraries. We never could figure out which were the "first" 10 pages and which were the "last" 10 pages. Some library units might not even be 10 pages.)

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
    17. Re:Yet another reason to switch to Lisp by ReelOddeeo · · Score: 1

      but the idea of a human readable language is a pretty good one.

      I'm not sure if I agree. It depends on what you mean by human readable.

      A language that is easy for programmers to read is a good thing.

      An attempt to make a language that a non-programmer can read is misguided. Examples? COBOL (as you point out).

      Another example: HyperTalk and AppleTalk. Reading these languages is easy. They read almost like natural english sentences. Very easy to follow. Drawback? Writing the code. The programming language syntax is obviously not as unrestricted as english prose. You have to learn which operators can be applied to which operands and many other complex rules. Sure, when you apply them properly, it reads great. But the language is a "read-only" language.

      My final argument that it is misguided to make a language that can be read by non-programmers would be this. Non programmers, especially managers, can't think logically anyway. They don't think in terms of formal semantics. Programming is an activity for humans to formally express an idea in a rigid way for a computer to execute. Learn the semantics of the language (the syntax part is easy) if you want to read the code. A manager might say: I want to see the people from new york with green hair AND the ones with purple hair who are over 8 feet tall. Now what he really meant was an OR condition.

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
    18. Re:Yet another reason to switch to Lisp by redragon · · Score: 1

      I haven't stuck around with them, they're just out there, and we get brought in when the tower of crap they've made begins to crumble... :)

      All of your points are good, I'm just saying so many people I see using Lisp write piles of crazy poop...and they DO data morph, whether they should or not is irrelevant...

      Scheme is a super-set of Lisp I thought...and I'm just saying they made it too customizable, never said it was or wasn't minimalist....you can do some powerful and some amazingly stupid stuff.

      --
      - Sighuh?
    19. Re:Yet another reason to switch to Lisp by Phs2501 · · Score: 2, Informative
      Any reasonably complex structured data will probably be put into a structure or class in Common Lisp. In addition to being specified, you get constant-time access to the elements:

      ;;;; Leading dots are because of slashcode lameness
      (defstruct item
      . "Strores a gronk foobar blazwart mrph."
      . quantity
      . product-code
      . name
      . description)

      (make-item :quantity 5
      . . . . . .:product-code 256
      . . . . . .:name "Item"
      . . . . . .:description "Description")
      Or you'd be putting data into a class, hash table, array, or whatever.

      Common Lisp is not just about lists.

    20. Re:Yet another reason to switch to Lisp by ashultz · · Score: 1

      They do say that whatever hot new language X does, Lisp has been doing it and being ignored for years.

      I think the problem with Lisp, as someone who has programmed in Lisp and in other languages, is that until you get quite good at it the language seems to run backwards from straightforward procedural programming. Switching from one to the other requires experience in both, and it's easy to get out of practice with the functional way of doing things... and it's hard to get a programmer trained in procedural languages to make that first climb to functional Lisp and thinking backwards.

    21. Re:Yet another reason to switch to Lisp by King+Babar · · Score: 1
      Another example: HyperTalk and AppleTalk. Reading these languages is easy. They read almost like natural english sentences. Very easy to follow. Drawback? Writing the code.

      Uh, I think you mean "AppleScript" back there. Moreover, I think you kind of have it sideways. :-) Reading these languages had its own pain-in-the-neck aspects, too. Back in my hypertalking days, i was always having to write stuff like:

      put word 3 of line 4 of field "foo" into baz
      when what I *wanted* to say and read was more like:
      baz = foo[4][3]
      The real horror of hypertalk was the lack of decent datatypes and the inavailability of really any decent syntax. The *glory* of hypertalk was that it was a delegation-based event-driven object-oriented language *without* inheritance. Those are suprisingly powerful and it's really a shame that a de-uglified version of HyperTalk never really happened, or anything like it.

      In a sense, all the w3c work in DOM and standardized events and event-bubbling is really just getting us back to where you could have been in 1990 with HyperCard. Now I might be able to do similar things in Javascript in 2005; I guess that's sort of progress in a way, but...

      --

      Babar

    22. Re:Yet another reason to switch to Lisp by rpg25 · · Score: 1

      Not just closures and macros --- how could you forget ADVICE, the construct that seems to be at the (unacknowledged?) core of this whole Aspect Oriented Paradigm ("My project's a paradigm, too!" - Dilbert).

    23. Re:Yet another reason to switch to Lisp by g4dget · · Score: 1
      Actually, AOP and CLOS are related; it's not clear that if you have CLOS, you still want AOP.

      As for Java and Lisp, yes, it would be great to be able to use Lisp. Unfortunately, CommonLisp implementations and libraries simply don't work out to be as practical. That's not a problem with Lisp, it's a problem with the CommonLisp standard, the CommonLisp community, and CommonLisp history. Someone could still create a great Lisp-based language and implementation, but it doesn't exist right now.

    24. Re:Yet another reason to switch to Lisp by g4dget · · Score: 2, Insightful

      Same thing happens in C/C++, perhaps more frequently:

      Programmer 1:

      struct Part {
      int number;
      string name;
      string description;
      int count;
      };

      Programmer 2:

      Oh, how inefficient; let's just replace that
      with integers and put the strings into a
      "resource table" somewhere.

      typedef int Part[4];

      In fact, by using atoms rather than strings,
      the Lisp programmer can achieve the efficiency
      of C++ Program 2 while essentially preserving
      the appearance of Program 1.

      Note that the correct way of defining the
      data structure would be with DEFSTRUCT or
      as a CLOS object.

      As for the parentheses, people who sit in
      glass houses shouldn't throw stones: C/C++
      syntax has numerous flaws. Is syntax like this
      really better?

      a[((unsigned)*(short*)b)]

      What about expressions like "a = b << c + d";
      do you really know how the precedences work out?

      Lisp syntax, with the right editor, is easy
      to input and easy to read. And unlike C/C++
      syntax, it doesn't have any precedence issues
      and it is extensible.

    25. Re:Yet another reason to switch to Lisp by Anonymous Coward · · Score: 0

      Given that AOP is basically a specific form of metaprogramming, it's not surprising to find that some of the early research work was done in lisp. There is a fascinating paper describing the use of aspect techniques to produce OCR software versus the same software written in C. There were two C versions, a very simple, small implementation which was slow, and a much faster implementation which required about 10x more code, as the programmers were essentially doing by hand what aspects do for you, and the AOP lisp version which was almost as fast as the large C program, and almost as small as the small C program.

      http://www2.parc.com/csl/groups/sda/publications / papers/PARC-AOP-RG97/for-web.pdf

    26. Re:Yet another reason to switch to Lisp by jaoswald · · Score: 1

      That's not a problem with Lisp, it's a problem with the Common Lisp standard, the Common Lisp community, and Common Lisp history.

      There isn't any problem in the Common Lisp standard that prevents Common Lisp implementations from being practical programming environments. The standard simply states what should be the same between implementations, not what should be different in implementations. In fact, virtually every decision behind the standard was based on proven programming practice.

      Common Lisp wasn't made a standard in order to take over the world, it was meant to unify various Lisp dialects into one common base. It succeeded, in that most real Lisp programming now happens in Common Lisp.

      I suppose you would argue that the C and C++ standards have equal problems with being practical languages?

    27. Re:Yet another reason to switch to Lisp by g4dget · · Score: 1
      I suppose you would argue that the C and C++ standards have equal problems with being practical languages?

      The C and C++ standards have enormous numbers of problems. However, when all is said and done, the C/C++ standards have succeeded in the real world: there are huge numbers of libraries available and it is easy to write efficient C/C++ code that runs on a wide varietly of platforms and implementations. Unfortunately, for whatever reasons, the same cannot be said for CommonLisp.

      In fact, virtually every decision behind the standard was based on proven [Lisp] programming practice.

      True, and that's probably one of its problems: CommonLisp was in use by a narrow slice of the software development community, and their narrow interests got codified in the standard.

      It succeeded, in that most real Lisp programming now happens in Common Lisp.

      Most real Lisp programming these days probably is happening in Scheme and EmacsLisp.

    28. Re:Yet another reason to switch to Lisp by ReelOddeeo · · Score: 1

      Uh, I think you mean "AppleScript" back there.

      Oooops.... yes I did.

      In a sense, all the w3c work in DOM and standardized events and event-bubbling is really just getting us back to where you could have been in 1990 with HyperCard.

      Yes. It's amazing how many times I see that everything old is new again. Especially when it comes to things Apple did ten plus years ago.

      One problem was that the programming languages of the day didn't really lend themselves to fully scriptable applications like we are seeing today, in OpenOffice, for example. The Finder and ScriptEdit were the only two highly scriptable applications, and among the few that were scriptable at all.

      I've been learning how to control OpenOffice.org via. UNO. You can do this either in Java (even over the network!) or within StarBasic within the office program. My interest lies in scripting the draw module. So far I can build complex "spirograph" like geometric shapes, I also just got a maze generator running that makes draw documents of mazes. I've made a "turtle graphics" module for both Java and StarBasic to make programming drawings easy using turtle graphics.

      Oh, how I would have loved for MacDraw to be scriptable from Macintosh Common Lisp. The ideas may have been there, back in the day, but it takes until the 21st century to get the stuff implemented!

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
    29. Re:Yet another reason to switch to Lisp by jaoswald · · Score: 1

      The C/C++ *standards* did not "succeed" in the "real world" in any meaningful sense. The *languages* did, before they were practically standardized.

      Think about how much code is out there that wasn't written using the features of C90, how much C code actually makes assumptions about endianess and the size of pointers, and how long it took most commercial C++ compilers to actually implement the spec. What happened was that a huge number of people programmed in something *like* the standard (i.e., were programming in UNIX and Windows, using the most well-supported definition of the APIs, with the tools that existed at the time).

      Your last comment means that your definition of "real" certainly differs from mine. Just for curiosity, what do you consider to be a real software project implemented in Scheme (not including Scheme implementations)?

    30. Re:Yet another reason to switch to Lisp by firewrought · · Score: 1
      A manager might say: I want to see the people from new york with green hair AND the ones with purple hair who are over 8 feet tall. Now what he really meant was an OR condition.

      A manager wants to see the UNION of the two sets of people, which you are calculating by making of list of each person x where x is either in in the first group OR in the second.

      My point is that the manager is unknowingly speaking a high-level sentence in relational calculus and you are translating it down to the level that the computer can understand. The boss isn't being illogical so much as he's uses a different language than the computer.

      English-like languages have tried to address this mismatch naievely, assuming that it's just the syntax that scares people away. However, (and this is where you really hit the nail on the head) the real mismatch occurs at the semantic level: we are stochiastic beings that don't take to well to formal semantics. Engineers, mathematicians, scientists, and programmers have the education and nerve required to get the knack of these programming languages when it serves our aims, but the general population typically lacks this skill. Even us programmers can have difficulty swinging language paradigms when something new arrives in our life (like first-time Lispers who use loops, variables, and other procedural constructs instead of recursion, lambda expressions, and functional constructs). Thus, the fundamental job of the software engineer: actively translate back and forth between the human world and the computer world. A Hypertalkish langauage isn't going to replace the software engineer (nothing will short of human-level AI).

      Trying to create new languages that allow for the more straightforward expression of ideas is a noble goal, but the "make it sound like english" approach is not going to bring a nirvana where everyone can suddenly express their thoughts in code. At best, such languages will afford communications b/t software engineers and the users. This is particularly true when working with sub-languages that pull the computer up to the level of a particular problem domain. (Thus a major selling-point of stuff like XML, SQL, Guile, etc.)

      --
      -1, Too Many Layers Of Abstraction
    31. Re:Yet another reason to switch to Lisp by g4dget · · Score: 1
      What happened was that a huge number of people programmed in something *like* the standard (i.e., were programming in UNIX and Windows, using the most well-supported definition of the APIs, with the tools that existed at the time).

      Of course, that's what happened, and that's one way of building a successful standard. The ANSI C and ANSI C++ standards still have had, and continue to have, a profound impact on C and C++ programming. In fact, the standardization process itself was going on for long enough and involved enough people in the community that many bugs got worked out.

      Another reason for the wild success of C and C++ is what they didn't standardize: the language creators tried to refrain from trying to standardize things they did not understand or could not understand at the time, and focused on giving developers the tools with which they could build entirely new sets of efficient standard libraries themselves.

      Think about how much code is out there that wasn't written using the features of C90, how much C code actually makes assumptions about endianess and the size of pointers, and how long it took most commercial C++ compilers to actually implement the spec.

      Yup, but pretty much all that code has been migrated to ANSI standards compliance: because of careful design of the standard, that conversion can be automated in almost all cases. What can't be fixed automatically usually is an easy-to-fix compile-time error.

      As for about "assumptions about endianness and the size of pointers", those are perfectly valid: they are implementation defined or unspecified features. It's a valid choice in a language standard, even though I don't particularly like them. Note that CommonLisp is full of implementation-defined and unspecified effects, too.

      Your last comment means that your definition of "real" certainly differs from mine. Just for curiosity, what do you consider to be a real software project implemented in Scheme (not including Scheme implementations)?

      Guile alone has a significant number of desktop applications that are largely written in it (see here). There are also many other systems where Scheme is used as an extension language. Also, compilers like Bigloo are actually both quite nice and reasonably efficient; I have never found anything comparable for CommonLisp.

      Overall, I think your last point is pretty key to understanding why CommonLisp never took off more widely: its community often had a disdain for the applications and concerns of people outside their community, considering anything that didn't fit into their little world "not real".

    32. Re:Yet another reason to switch to Lisp by jcast · · Score: 2, Interesting

      That may be true, but it still would've been better if he'd make a bigger deal about the lisp roots of the thing. May help it ``escape the computer labs'' and all.

      --
      There are reasons why democracy does not work nearly as well as capitalism.
      -- David D. Friedman
    33. Re:Yet another reason to switch to Lisp by Anonymous Coward · · Score: 0

      I don't think you're sufficiently familar with CL to comment - CMUCL, for example, is certainly comparable to bigloo (only better :-) ), and completely open source. CMUCL/SBCL are actively developed.

      In fact, Bigloo is my textbook example of how Scheme needs to become most of a Common Lisp implementation to actually do anything useful! Bigloo isn't really a "small, elegant Scheme" - it is more like a Common Lisp compiler and without the extensive standardisation, and it's a Lisp-1 instead of a Lisp-2 (that's not derogatory - Lisp-1 is when funcs+vars share namespace like Scheme, Lisp-2 where they're split like CL)

      Bizarrely, you use the past tense for the CL community - you may be confusing your leaving it with it's non-existent demise.

      Common Lisp has a very active developer community, including the open source sector - see www.cliki.net and comp.lang.lisp

    34. Re:Yet another reason to switch to Lisp by axxackall · · Score: 2, Insightful
      Never trust a language with more brackets than code

      How about XML?

      Besides, every language has barackets. Just in Lisp all bracket are unified to be as (). Other languages use various forms of brackets: (), {}, [], ";", "new-line". Python use even space identation instead of brackets (the only thing I hate in Python!).

      When the code is the data, unified brackets are much better for verification purposes. That's why XML also has unified brackets (just badly designed, IMHO).

      --

      Less is more !
    35. Re:Yet another reason to switch to Lisp by axxackall · · Score: 1
      The switch from Lisp wasnt the mistake, it was the move to C syntax that was wrong, replacing the unreadable parentheses with semi-colons, curly brackets, squiggles, dots and loads of other stupid ideas.

      What make Lisp's parentheses to be unreadable while XML parentheses to be still readable? By my opinion, Lisp parentheses are much more readable and that's the thing I miss in any other languages.

      --

      Less is more !
    36. Re:Yet another reason to switch to Lisp by jaoswald · · Score: 1

      You use very judgmental language ("disdain", "little world") to describe a community you are obviously not a member of. (You can't even spell the language name correctly.)

      Of course Common Lisp was standardized for the benefit of Lisp programmers, just like C was standardized for C programmers. Should they have made Lisp more like C to please them? Maybe throw away the powerful macros and replace them with #ifdef? Remove bignum support so that they could have good old familiar integer overflow? Or more like Scheme by removing everything not absolutely essential to writing the most skeletal program?

      the language creators tried to refrain from trying to standardize things they did not understand or could not understand at the time,

      How is this different from Common Lisp? What did Common Lisp standardize that was not very well understood? You seem to be describing a failure of C++, if anything. Templates contained a Turing-complete (but tortuous) language within them, which was hardly understood when the feature was first developed.

      I don't know how "little" the world of Lisp programmers can be when it includes things like Orbitz. Lisp programmers worry about Web applications, calling foreign libraries, large databases, numerical performance, data-mining---all sorts of things that other communities worry about as well. Is that a narrow view?

    37. Re:Yet another reason to switch to Lisp by TheLink · · Score: 1

      Yeah code that operates on code is powerful. But I still haven't found any info on writing securely in Lisp (or Forth for that matter). Based on my limited understanding and knowledge, security auditing code that works on code might be a bit harder.

      It does worry me whenever the lines between data and code are blurred or even absent (a Forth programmer proudly said obliterated).

      Of course if you can ensure that the code from code from code etc ultimately comes from the programmer and not some 3rd party then at least that limits the scope somewhat.

      But would you be surprised if a programmer foolishly transforms 3rd party data into code in an insecure manner? "See my web-app allows users to customize their webpages in practically ANY way! None of those inflexible template stuff".

      So often I see programmers doing very quick development, and I go "Wow" are these guys are good or what. Then when I take a deeper look, "whoa" you can cancel other people's cheques, or you can change price of product, or you can insert arbitrary statement/code to be executed.

      Indeed they write very powerful and flexible programs. More powerful and flexible than they think. They left out the equally important parts that reduce the power.

      There's a real lack of info on programming securely using Lisp especially when using the popular powerful programming styles characteristic of Lisp.

      --
    38. Re:Yet another reason to switch to Lisp by TheLink · · Score: 1

      "Lisp programmers worry about Web applications, calling foreign libraries, large databases, numerical performance, data-mining---all sorts of things that other communities worry about as well"

      Yah, but Lisp programmers have to build so many of these things themselves (or buy). Sure the typical guru Lisp programmer can do all of that in half a page of code (probably less than 5 minutes too), but the rest of us can't or can't be bothered to. e.g. where can I get the defacto standard Common Lisp libraries for: CGI, DB, GUI?

      --
    39. Re:Yet another reason to switch to Lisp by Tablizer · · Score: 1

      And I think it's easier for people to write bad LISP than bad C/C++ (though I could be wrong). It seems to me that LISP suffers from "data morph" issues more than any other language.....

      Your example is what happens when you try to use application code as a self-made half-ass database.

    40. Re:Yet another reason to switch to Lisp by g4dget · · Score: 1
      You use very judgmental language ("disdain", "little world") to describe a community you are obviously not a member of.

      Yes, like most of my colleagues (and the creator of AspectJ, for that matter), at some point I stopped being part of the CommonLisp community. As for the terms, they aren't judgemental, they are descriptive: read the "UNIX Hater's Handbook".

      Of course Common Lisp was standardized for the benefit of Lisp programmers,

      CommonLisp was standardized for the benefit of users and vendors of a number of commercial lisp dialects, not all Lisp users.

      I don't know how "little" the world of Lisp programmers can be when it includes things like Orbitz.

      The world of Lisp programmers is quite big. The world of CommonLisp programmers is "little" in the sense the fraction of all programmers using CommonLisp is very small (and probably decreasing, for that matter).

    41. Re:Yet another reason to switch to Lisp by g4dget · · Score: 1
      I don't think you're sufficiently familar with CL to comment

      I don't think you have sufficient information to make that determination.

      CMUCL, for example, is certainly comparable to bigloo (only better :-) ),

      As implementations, the two aren't comparable at all. Bigloo generates small, stand-alone, efficient executables, while CMU CL does not.

      I have actually used CMU CL quite a bit over the last decade. IMO, it's one of the best Lisp implementations around; but what makes it good is a lot of the things that it implements that go beyond the CommonLisp standard.

      In fact, Bigloo is my textbook example of how Scheme needs to become most of a Common Lisp implementation to actually do anything useful!

      You will get no argument from me that the Scheme standard is too minimialist for industrial-strength Lisp development. But Bigloo is a good implementation of Scheme in the same sense that CMU CL is a good implementation of CommonLisp: both go far beyond the standard they are based on, and neither is fully compliant with the base standard.

      Bizarrely, you use the past tense for the CL community - you may be confusing your leaving it with it's non-existent demise.

      I believe I only used the past tense when referring to past events. If I indicated that CL had already met its demise, that was unintentional. While CL usage seems to be shrinking relative to other language communities, it clearly isn't gone yet.

    42. Re:Yet another reason to switch to Lisp by ErroneousBee · · Score: 1

      put word 3 of line 4 of field "foo" into baz
      when what I *wanted* to say and read was more like:
      baz = foo[4][3]


      Im definitly with you on that, but you missed the semi-colon, and isnt 'baz = foo(4,3)' even more natural to read, as the '][' is very deceiving to the eye.

      For C, I was thinking more of the switch statement (requires curly backets, colons,semi-colons, only tests one variable, has fall through), the horrors of 'for (init;iter;incr)' when 'do i = 1 to 10' is just so much nicer, and I just cant get with the use of curly brackets everywhere.

      for (int i=0,j=0;i11;i++,j++){ etc }
      is quite frankly a mess and shouldnt be allowed.

      --
      **TODO** Steal someone elses sig.
    43. Re:Yet another reason to switch to Lisp by ErroneousBee · · Score: 1

      What make Lisp's parentheses to be unreadable while XML parentheses to be still readable?

      I dont program in XML, and neither does anybody else if they know whats good for them.

      XMLs role is also completely different from that of a programming language. Users need to be able to spot the difference between the markup (clue: its in backets) and the text.

      --
      **TODO** Steal someone elses sig.
    44. Re:Yet another reason to switch to Lisp by axxackall · · Score: 1
      There are many examples of programming in XML. XSL is one of them, XQuery is another one. Also, I can mention XSP (XML server pages for either Cocoon or Axkit) and DPT (Zope analog of XSP). You can find also various ontology programming dialects of XML on Semantic Web

      The good point of XML is its unified syntax - you don't need a new parser each time, you already have one and you concentrate on semantics rather than syntax.

      That's why there are such projects as XML representation of FlatCurry. Similar implementations I've met also in mail-lists about Mercury (BTW, they have also discussed S-exps as a basis of new syntax). Even ASN.1 goes to XML.

      Again, I think XML tags are worse readable (and less compact) than Lisp S-expressions. Thast's why I believe that eventualy the market attraction of Lisp-like languages will tise again.

      --

      Less is more !
  7. Bad code by Anonymous Coward · · Score: 4, Funny

    System.out.println(Hello, world!);

    Where are the quotes?
    I dont trust this guy if he cant write a HelloWorld app.

    1. Re:Bad code by diablobynight · · Score: 1

      lol compiler error line 4 I guess he just ignored it and went on writing his article about a book that reiterates information I heard 2 years ago.

      --
      Anonymous Cowards - Oh God, How I hate you
    2. Re:Bad code by KalvinB · · Score: 1

      Typical "arrogent author" code where they give you example code assuming it works without bothering to actually check it. Perhaps it was just a typo on the submitter's part.

      It's why I only resort to using prewritten code when necessary because I know I'm just going to have to debug the hell out of it and effectivly end up rewritting it.

      I even had the displeasure of asking a question on a forum and being given some code that I knew wouldn't work because I even told the person why the functions he used wouldn't work before he wrote up some crappy and obviously untested code using them. It wasted my time and his time.

      I never understood why people post crap code. I'd rather be unknown than be made irrelavent and avoided by posting untested and non working code which serves only to annoy people.

      Ben

    3. Re:Bad code by Dr.+Photo · · Score: 1

      I think the lack of quotes is the point.

      Behold the magic of Aspect-Oriented Programming! ;-)

    4. Re:Bad code by SlowMovingTarget · · Score: 1

      Uhhh...

      pointcut (
      after ( : "

      yeah, that's it...

  8. So, what is it? by Dixie_Flatline · · Score: 1

    I went to AOSD.net and the description there is a little thin. They say that there's a good overview in a particular issue of the ACM, but last I checked, you have to pay the ACM if you want to retrieve any articles online. Does anyone have a website that gives a solid overview of what AO is? A quick googling gives me a whole bunch of specific language pages or links back to AOSD.net.

    1. Re:So, what is it? by Halo1 · · Score: 2, Informative

      The original article that introduced it can be found here (download links for the article in several formats are at the top). Google also has a nice collection of links.

      --
      Donate free food here
    2. Re:So, what is it? by Anonymous Coward · · Score: 0

      Or you could go visit a library with online access. Your average community public library may not have that sort of thing, but university libraries often do, especially on campuses with an engineering focus. It usually doesn't cost you anything to get into a (public?) university library (although they won't let you check anything out).

      Sheesh, I wonder if some people have forgotten what "books" are.

    3. Re:So, what is it? by Anonymous Coward · · Score: 0

      Thanks for the reference. Unlike the review or the many comments, this article makes it clear what AOP is and has convinced me of its usefulness (in 20 years, once languages have good AOP support).

  9. What is Aspect Oriented? by utahjazz · · Score: 1

    I'm not getting any instant gratification from the above links and blurb. Can someone explain in a few sentences what Aspect Oriented Programming is?

    1. Re:What is Aspect Oriented? by DamnStupidElf · · Score: 2, Informative

      It looks like the concept is to group common methods from many different classes into a form that can be acted on uniformly. The example they gave allows for the creation of several multi-layer classes, all related and built upon each other. A "join point" is constructed as a collection of all methods that actually create new objects. The article explained that this is particularly useful for security, since while there may be many different classes that can be created, a join point can be used to allow or disallow the creation of any or all of them in a single place. The advantage is that security code does not have to be maintained in each class independantly.

    2. Re:What is Aspect Oriented? by WeaponOfChoice · · Score: 2, Informative

      The advantage is that security code does not have to be maintained in each class independantly

      This is precisely what I use AOP for. Whilst there is tremendous opportunity for spaghetti coding, so long as you adhere to some reasonable standard of layout and documentation it works out much more maintainable for certain design patterns.

      --


      It's not that I'm Anti-American - I'm Pro-Freedom
    3. Re:What is Aspect Oriented? by jjohnson · · Score: 1

      In other words, interfaces and factories?

      --
      Anyone who loves or hates any language, platform, or manufacturer, doesn't know what they're talking about.
    4. Re:What is Aspect Oriented? by rossifer · · Score: 1

      Interfaces and factories are a patterned approach to decoupling interface from implementation, which is a valuable thing, but...

      Aspects attack a different set of coupling problems. Should all of your classes really have to import java.logging.Log (or whatever it is, I'm not looking it up right now)? Should your persisted objects be aware that they're persisted and have transaction enlistment code in their method bodies? Should...

      If you have modifications or enhancements to groups of classes that aren't really related to the class's responsibilities (you did go through a CRC exercise, right?), then you could go in and add that code to each relevant method in each relevant class, knowing that when some change needs to be made to this code, you'll have to go back to the same hundred or thousand or more places and change all of them.

      Or you could write an aspect.

      In my experience, it often really is that easy. For the ORM I'm writing, I've developed an aspect that can make your classes persistence aware in a reasonably performant way using minimal x-doclet tags (most classes only need an "@persist" tag in the class javadoc).

      As another poster observed, it takes all of the code related to a specific system feature and moves it all to one place (the aspect definition). You want to pay attention to security, you have your security classes and your security aspect. Persistence? Same thing. Exception handling around an external API? Aspect.

      Actually, the pattern aspects most resemble is the Visitor pattern, but without the need to write an accept(Visitor) method, without needing to work against only the public interface (aspects can break encapsulation if you think it's valuable, which it is for persistence) and without having to maintain all visitors if your visitable list of classes change (actually, there are some ways to manage this in visitor, the "lite-Visitor" variant, for instance).

      As for whether or not AOP is the next big thing? I don't know. It makes it easier to write inscrutable code in Java which means you need to keep a tighter leash (more code reviews) on your less experienced developers. I had one guy "get it" and he pretty much managed to turn one part of our system into a lispish mess of code-generation. But even with that risk, when used carefully, aspects can take code that is difficult to maintain and really improve the readability and understandability. I plan to continue using AOP for my projects, but to always do so carefully.

      Regards,
      Ross

  10. Sounds like pre-post "exception" handling by binaryDigit · · Score: 2, Insightful

    Sounds a lot like adding a pre "exception" handler in c++, mixed with somewhat normal exception handling, and doing a Microsoft and making it declarative. Sounds like an interesting feature, but without reading the book and seeing what else there is, hardly anything earth shattering. Just another way to have the compiler/dev environment formalize a programming practice.

    A methodology hasn't made really made it until somebody has published a Proper Book

    Are they kidding. Hell there probably books out here on clipping your finger nails using a new methodology. Now days having a book don't mean squat (unless you're a tree, beaver, or a bird).

    1. Re:Sounds like pre-post "exception" handling by Anonymous Coward · · Score: 0

      It isn't limited to exception handling. You can do it anywhere. Why not read one of the many webpages out there and actually learn about it instead of guessing from a book review?

    2. Re:Sounds like pre-post "exception" handling by binaryDigit · · Score: 1

      It isn't limited to exception handling.

      I know, that's why every time I say "exception", I placed it in quotes. I was relating the physical mechanism to something similar in C++.

    3. Re:Sounds like pre-post "exception" handling by binaryDigit · · Score: 1

      Oh and a better analogy sounds like the many 4gl's out there that provide pre-post handling for their forms. This concept is then extended to methods vs form objects.

    4. Re:Sounds like pre-post "exception" handling by Anonymous Coward · · Score: 0

      The pre/post -code part sounds more like dynamic extents (R5RS).

      But I suspect that there's more to AOP than that. However, I'm not going to bother, at least as long as it's bolted on to a crippled language like Java.

  11. Here we go again.. by Viol8 · · Score: 0, Insightful

    Another obscure and pointless programming paradigm dreamed up by an academic who
    wants to make a name for himself. God save us from the egos in the computer world...

    1. Re:Here we go again.. by Caoch93 · · Score: 1
      So, you've tried AOP before? Compile-time weaving or run-time weaving? Wasted your time? How?

      AOP is a very useful perspective to take, though, and I've seen it used to some incredibly good ends. Rhetoric it cheap.

    2. Re:Here we go again.. by Viol8 · · Score: 1

      "Weaving"? Oh excellent , another buzzword to ad to my The-way-people-try-to-sound-intellectual list.

  12. My 2 bits... by praetorian_x · · Score: 5, Insightful

    Aspect oriented programming is moderately useful, though, if it isn't built into the language (and, in java, it isn't) it can be cumbersome to work with.

    In java you can get 50% of the way to AOP using Dynamic Proxies (see java.lang.reflect.Proxy) which allows you to wrap all method invocations or an object. This without an outside tool. This is how a lot of j2ee app servers do thier magic.

    By and large, the more I work in java, and the more I work in Lisp, I realize how lacking java is in dynamic behaviors. The lisp guys yawned when OO became all the rage because, well, it is so easy to do in lisp. If AOP gets big in java, they will yawn at that too:

    "Oh, so functions and try blocks are your boundry block for inserting aspect oriented code? Well, *every parenthisis* is ours. Put that in your JVM and smoke it."

    Cheers,
    prat

    1. Re:My 2 bits... by ed__ · · Score: 1

      i believe the original AOP implementation was in a LISP dialect. (check out the paper on cisteseer).

    2. Re:My 2 bits... by Anonymous Coward · · Score: 0

      "Oh, so your ivory tower language has been around for 50 years without ever entering the mainstream? Put that in your Y combinator and smoke it."

    3. Re:My 2 bits... by ipjohnson · · Score: 1

      Actually I believe emacs was written in LISP as well as many other programs. Just because you can't use it doesn't mean its not a useful tool to other people. I personally love the eligence a good recursive solution provides. Any good programmer should have taken a class in LISP to understand how good recursion should be done. Point blank.

    4. Re:My 2 bits... by Caoch93 · · Score: 1
      In many ways, you're right. The current solution for dynamic run-time AOP in Java is...Bytecode Engineering!

      Dynamic Proxies are good, but require that you have some sort of basal interface for objects the proxy conceals. The result, really, is that you can only apply advice on methods of the interface and nothing more. True dynamic AOP will allow virtually anything to be advised, though. LISP is in a solid position to do this...the more I learn about other languages, the more I want to start doing my regular coding in LISP.

      Any language requiring you to re-engineer your compiler's output format to implement dynamic behaviour is too static for its own good.

    5. Re:My 2 bits... by Fnkmaster · · Score: 4, Insightful


      In java you can get 50% of the way to AOP using Dynamic Proxies (see java.lang.reflect.Proxy) which allows you to wrap all method invocations or an object. This without an outside tool. This is how a lot of j2ee app servers do thier magic.


      Sure, of course you can. AOP is a technique, supported by tools, it doesn't need to be hoodoo magic to be useful. Mind you, like you said, it'll get you 50% of the way. You can get 50% of the benefits of assertions by writing a static Assert class and using it consistently. It's just that it is nice to have capabilities either built into the language to support good practices, or extensions to the language (a la AspectJ) to support them.


      And the List thing is tired. We all know that Java is limited. It's limited compared to C++, it's limited compared to Lisp. Ya know what? That's a good thing. For large software development projects with many engineers involved. I can pick up other people's code and not worry about whether X really means X or whether it's a macro that's been defined elsewhere to mean Y. I realize my view on this isn't the most popular on Slashdot, but that's probably because people haven't had to manage teams of developers who aren't populated throughout with brilliant coders, capable of writing fast, functional readable code in languages that leave n degrees of freedom.


      Adding capabilities to a language to support a particular kind of new programming paradigm is not unreasonable. I realize that the fact an extension to the language is needed seems like a limitation, and it is, but like I said, that limitation can be a godsend, and it's worth the tradeoff.


      Of course, when I'm working on my own time on my own projects, I far prefer to use a manly language like C++, or a pleasant language like Python.

    6. Re:My 2 bits... by ctrimble · · Score: 3, Informative

      Gregor Kiczales, the lead on the AspectJ project, wrote "The Art of the Metaobject Protocol", which was a description of how to do metaobjects in Lisp (metaobjects, and particularly generic functions, are closely related to AOP). A description that Gabriel and Steele put together can be found in The Common Lisp Object System: An Overview

    7. Re:My 2 bits... by praetorian_x · · Score: 1

      [quote]
      And the List thing is tired. We all know that Java is limited. It's limited compared to C++, it's limited compared to Lisp. Ya know what? That's a good thing. For ... ...y because people haven't had to manage teams of developers who aren't populated throughout with brilliant coders, capable of writing fast, functional readable code in languages that leave n degrees of freedom. ...

      Of course, when I'm working on my own time on my own projects, I far prefer to use a manly language like C++, or a pleasant language like Python.
      [/quote]

      For what its worth, on these points, I totally agree with you.

      Cheers,
      prat

    8. Re:My 2 bits... by c0nst · · Score: 1

      Java's reflection mechanism/dynamic proxies can't do everything that AspectJ does. For instance, you cannot set up handlers based on the control flow of the program using reflection. AspectJ's cflow() and cflowbelow() allow us to do this with ease. Other features of AspectJ include static introductions that come in handy when testing/debugging code.

    9. Re:My 2 bits... by Thrakkerzog · · Score: 1

      I think they are yawning because it is nap time in the retirement home.. :-P

    10. Re:My 2 bits... by Anonymous Coward · · Score: 0

      it's limited compared to Lisp. Ya know what? That's a good thing. For large software development projects with many engineers involved. I can pick up other people's code and not worry about whether X really means X or whether it's a macro that's been defined elsewhere to mean Y. I realize my view on this isn't the most popular on Slashdot, but that's probably because people haven't had to manage teams of developers who aren't populated throughout with brilliant coders, capable of writing fast, functional readable code in languages that leave n degrees of freedom.

      IOW, Java is a modern day version of:

      Row! (whip) Row! (whip) Row! (whip) Row!.....

    11. Re:My 2 bits... by eggfellow · · Score: 1

      the comparison to j2ee containers is apt.

      aspect-oriented programming allows objects to exist in a more 'pure' state. for instance, rather than filling up your object with persistence code, you can write an aspect that handles the persistence, same as you can use cmp in j2ee to handle persistence. same idea applies for security, debugging, scarce-resource management...

    12. Re:My 2 bits... by Anonymous Coward · · Score: 0

      > If AOP gets big in java, they will yawn at that too:

      Ummm, AOP was originally created for/using Lisp. Only then was it ported to Java, since Java was the "hot" language. So the lisp folks were yawning long ago.

      (Former xerox intern)

    13. Re:My 2 bits... by Anonymous Coward · · Score: 0

      You can get 100% of the way there is java byte-code modification. See BCEL

      http://jakarta.apache.org/bcel/

      It's relatively easy to go through a class directory or jar file and add hooks for method entries/exits or use of globabl objects. I've used it to add logging after the fact or to replace wall time with simulated time.

    14. Re:My 2 bits... by s88 · · Score: 1

      Just because you can bypass the built-in safety features of a language, doesn't mean you should. Dynamic behaviors are very difficult to maintain and understand inherantly; it is difficult to understand them from a static analysis (reading the code).

      If you find yourself needing to do that all over the place, either: 1) you don't know how to design properly or 2) you should be using a scripting language.

      Scott

    15. Re:My 2 bits... by praetorian_x · · Score: 1

      wouldn't that be

      (setf (get-former-interns xerox)
      (append (get-former-interns xerox) you)?

      (wink me)

      (cheers)
      prat

    16. Re:My 2 bits... by Stuntmonkey · · Score: 1

      That's a good thing. For large software development projects with many engineers involved. I can pick up other people's code and not worry about whether X really means X or whether it's a macro that's been defined elsewhere to mean Y.

      Casual observation: Most of the advances in programming over the past 50 years have enhanced coder productivity by limiting what programmers can do.

      Examples:

      • 1950's -- High-level languages eliminate many degrees of freedom present in assembly, e.g., most kinds of self-modifying code
      • 1960/70's -- Procedural programming encapsulates data within functions, limiting the scope of variables. Execution flow also more rigidly constructed; use of goto is allowed but discouraged
      • 1980's -- OOP enforces additional encapsulation; encourages "black box" coding in which programmers have no ability to look inside large chunks of code/data
      • 1990's -- Java eliminates pointer manipulation and implicit type-casting (e.g., all those "if (x=1) {}" bugs in C)

      My explanation of this trend is that coding productivity is enhanced if we minimize the number of dimensions along which coders can screw up (or at least do something nonstandard).

      AOP doesn't seem to fit this trend (or does it?). What would be the next programming degree of freedom that could be eliminated? To me one answer would be in the direction of functional programming, which severely restricts programmers' ability to specify execution order.

      Somewhat offtopic, in a parallel vein many of the advances in science/math over the past 100 years have also been "limiting" advances: Special relativity eliminated faster-than-light signalling and absolute reference frames, quantum mechanics introduced the uncertainty principle limiting what kinds of information we can have about particles, Godel's theorem proved the fundamental limitations of mathematics, etc.

    17. Re:My 2 bits... by eduardodude · · Score: 1

      >In java you can get 50% of the way to AOP using
      >Dynamic Proxies (see java.lang.reflect.Proxy)
      >which allows you to wrap all method
      >invocations or an object. This without an
      >outside tool. This is how a lot of j2ee app
      >servers do thier magic.

      While the java.lang.reflect.Proxy class is very powerful, it is also extremely limited. It can only decorate objects that implement interfaces, and you have to explicitly "wrap" objects with your proxy. Factories can help, and this works especially well for app servers that emphasize clean design. But for most times when you'd like to use Proxy, it isn't practical.

      Aspects get around this completely.

    18. Re:My 2 bits... by Anonymous Coward · · Score: 0

      The problem is that with Java, some of the limitations are IMO unforgivable, because they force you to do lots of extra work for no gain in clarity.

      Consider the difficulty of returning multiple values from a method.

    19. Re:My 2 bits... by tigersha · · Score: 1

      Yes, yes, yes.

      Programming languages revolve by restricting freedom. I have heard this argument from someone who said that that is why purely functional languages such as Haskell or SML (and to some degree, LISP) is so powerful: They even restrict you from using state. The ultimate restriction leads to the ultimate cool language.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    20. Re:My 2 bits... by Fnkmaster · · Score: 1
      True to an extent, but it violates the "worse is better" principle. The languages that let you do the "bad things" (quick hacks that are useful, perhaps) and still enable you to do a lot of good useful things seem to tend to be particularly popular (witness Perl and C/C++).


      Few can doubt that the move to procedural programming and the move to OOP are so useful you can't neglect them, but languages like the above that force nothing on you still prove to be popular. And functional languages have been around for years, as you know (the original "Worse is Better" article was written to explain the fact that LISP, the "better" language was losing out to C), but still only see usage in particular problem domains or among academics. And frankly, Java is hugely successful only in a particular problem domain - large server-side enterprise systems (notably, of course, not the domain it was designed for originally, at all).


      But generally, you are correct that eliminating degrees of freedom does improve productivity - BUT if the capabilities lost make it harder to think about or map the problem into code, it's generally too costly a loss of functionality (i.e. loss of state in pure functional languages).

    21. Re:My 2 bits... by broter · · Score: 1

      Interesting observation (if I had a mod point, I'd mod it "Interesting" and just shut up, but since I don't...).

      Most of the limitations you mention weren't meant to be limitations, but rather codifications of practices that were seen as Good Things (ref. jargon).
      * Fortran offered the ease of representing arrays, matrices, vectors (not sure they had the last two in old Fortran), etc. in a compact notation.
      * Procedural programming offered the ability to reuse variable names in different scopes.
      * OOP was a limitation, but its intention was to offer an easier interface to logical components that procedural programming offered (has anyone else done object oriented coding in K&R C? It's totally do-able, but very tricksy).
      * Java's "feature" was a limitation... Yeah, I'll give you that one. Can't say I can complain much about it (I think my brain auto-switches when I go from C++ to Java so I don't notice...).

      As for AOP, it's a tool to keep you from having to rewriting your (or someone elses) library everytime the implimentation calls for a linked list instead of a tree.

      As for the somewhat off topic remark: all science and math (ie. science of patterns) is "simply" pointing out where the walls and doors are in the universe. It's not limiting or expanding in that sense; it simply *is*.

      For Godel's proof (excellent, but very thick - non-math geeks should probably read "Godel Escher Bach" instead), it's a statement of the limitations of logical proof based systems (ie. all modern math). Keep in mind that, in the future, there may be ways of "proving" uncountable sets of theorems, as well as nontraditional logic to "prove" items that can't be addressed by current math. Never forget meta-math!!!!

      eeks, this has turned into a total rant. Sorry, man.

      --
      "One man can change the world with a bullet in the right place."
      - Mick Travis, "If..."
  13. Portable.NET uses AOP for the C# compiler: treecc by manyoso · · Score: 2, Insightful

    One example of Aspect Oriented Programming for compiler writers:

    http://www.southern-storm.com.au/treecc_essay.ht ml
    http://www.southern-storm.com.au/treecc.html
    ht tp://www.southern-storm.com.au/treecc_doc/treecc _1.html#SEC1

    It is also rumored that Portable.NET will use treecc for the creation of a JIT engine sometime in the future.

    From my limited understanding, Aspect Oriented Programming combines the power of the Visitor and Inheritance patterns without the drawbacks of either.

    Another interesting link:
    http://www.pcmag.com/article2/0,4149,440611 ,00.asp

  14. People are still adapting to the last big thing by Badgerman · · Score: 1

    From reading the review, I'm not sure Aspects are going to really do much for me. It seems to be "encapsulating" some code needs in an object format, and that's about it.

    I see plenty of crappy code all the time. I see lousy use of OOD/OOP. People haven't even adapted to OOD/OOP very well. I can't see this being much more than a technique curiosity that may solve some needs here and there for quite some time to come.

    --
    "The Sage treasures Unity and measures all things by it" - Lao Tzu
    1. Re:People are still adapting to the last big thing by WeaponOfChoice · · Score: 1

      Agreed, even though I am quite taken with AOP (though it has taken some time to really come up with real world applications for the theory).

      In the end, however, it is still limited by the ability of the programmers who are using it - as is OOD/OOP and indeed any programming style at all...

      --


      It's not that I'm Anti-American - I'm Pro-Freedom
    2. Re:People are still adapting to the last big thing by slide-rule · · Score: 1

      Heck, the science-type community (in my immediate experience, engineers) has not fully adapted to "modular" programming, let alone, OO. The couple of us where I work were thoroughly horrified and amused to see the following take place: (1) internal company code 'X' is F77 based, and purely procedural (and that even with a frightening number of GOTO's), (2) company gets new F90 compiler, (3) code 'X' is modified *just enough* to pass the compiler with no errors (warnings, on the other hand...), (4) voila! code 'X' is now "modular", since we all know F90 is modular (the complete lack of "MODULE" statements notwithstanding). Granted, these guys are practicalists and aren't comp-sci grads, but the degree of cleanup that could be achieved ('X' is nearly untraceable, given the level of spaghetti) is staggering.

    3. Re:People are still adapting to the last big thing by Tablizer · · Score: 1

      I see lousy use of OOD/OOP. People haven't even adapted to OOD/OOP very well.

      Part of the reason is that nobody can agree on what "good" OO is. It appears that people model their own thought processes or gear for change according to how *they* perceive change. Then somebody else comes along who thinks different or perceives change differently, and you have a mass disagreement that requires getting back to "does this chair exist" type of arguments.

      It is easier to argue politics. At least we have thousands of years of history to argue politics with rather than guesses and "notions" pulled from our ass and subjectivity that one may not recognize as subjective, thinking other people think like them.

      Software engineering is a shameful dark-grey art, on par with the discipline of Psychology.

    4. Re:People are still adapting to the last big thing by Badgerman · · Score: 1

      I'd like to make a witty post or something, but all I can honestly do is extend my sympathies.

      Even programmers can be pretty bad about this. Even good ones. External factors, pressures, etc. can cause almost as much damage as ignorance, thus even good programmers can use lousy procedures.

      --
      "The Sage treasures Unity and measures all things by it" - Lao Tzu
    5. Re:People are still adapting to the last big thing by Badgerman · · Score: 1

      Software engineering is a shameful dark-grey art, on par with the discipline of Psychology.

      I majored in psychology before I became a programmer. An amazing amount of my coursework is relevant to my IT work, both directly and indirectly - and half the time, its the "human-factors" level.

      Software is engineering IDEALLY, in a pure world where everything is defined and organized and parameterized.

      But in the real world, it's definitely in the realm of the gray arts. My own experience seems to bear that out.

      Bringing it full circle to the subject, though Aspects sounds kind of neat, there are psychological factors to consider - is it explanable, does it work with people's existing concepts, etc.

      --
      "The Sage treasures Unity and measures all things by it" - Lao Tzu
  15. How true by arvindn · · Score: 4, Funny
    It doesn't matter how big and popular the website is.

    Yup. Nothing can save it from slashdot.

  16. MOD PARENT UP +1 Pedantic! by Anonymous Coward · · Score: 0

    What do you mean there is no such setting?

  17. Other Aspect Oriented Technologies by Frums · · Score: 4, Informative

    Since AspectJ is getting some attention I figured i would point out some other AOP resources

    • MDSOC - Paper - Is basically IBM's take on AOP. It avoids creating Aspect Space and Object Space (what belongs in an aspect, what in an Object?) but is less mature than AspectJ
    • HyperJ - Home - IBM's Java language stuff supporting MDSOC
    • JAC - Home - Aspect oriented middleware for Java. I haven;t explored this one much, is on my todo list.
    • Aspect Browser - Home- A tool to help identify crosscutting concerns in Java (emacs!)
    1. Re:Other Aspect Oriented Technologies by smagoun · · Score: 1
      One more for the list....Structs and Nodes Development is a methodology for developing enterprise apps that leverages aspects for almost every part of the system. Unlike many of the other AOP tools out there, you don't need extra preprocessors or special compilers. Instead, SAND uses code generators to implement aspects across the entire application. It's like XDoclet on steroids.

      The result is a convergence of AOP and model-driven architecture (MDA; another buzzword) that actually works. Writing enterprise apps with SAND is a joy, and there's even an open-source implementation on Sourceforge called "sandboss". (yeah, I'm a sandboss developer. It rocks).

      AOP is definitely a buzzword, but it's here to stay because it makes things so much easier. It's not as applicable for consumer applications, but in the enterprise world it's a godsend. There are 2 different types of code you have to write in an enterprise app. First is the business logic - what the application does. The second part is the plumbing - how the application does it. This includes persistence, caching, user interfaces (web site, client application, etc), IPC, and so on. The first part is far more important than the second part, but the second part is where most of the time gets spent. A good AOP tool can drastically cut the time needed to put together the app's plumbing, and that's why AOP is here to stay.

  18. Workarounds? by mparaz · · Score: 4, Informative
    1. Re:Workarounds? by Anonymous Coward · · Score: 0

      =v= Yep, visitor pattern was the first thing that came to my mind, too.
      Anonymously,
      <_Jym_>

  19. I urge you all as fellow members to avoid this by $$$exy+Gwen+Stefani · · Score: 0, Troll

    I urge you all as fellow members to avoid purchasing this book. Save your time and money, as they're both valuable things that this "amazing" new theory that promises to change the world will waste. The creators want us to believe that Aspect will make some programming utopia, but you know what? Hitler said the same thing about his "great new idea" and look where it got him.

    Object-oriented is a common sense, practical way to view the world. You treat the variables in your program as objects, and you think about how a real-world object and what its private values would be and what operations you would be able to perform on it. It's a very pragmatic approach.

    I've read this Aspect book, though, and it sucks. There's nothing new or innovative, as I'm sure you can see from the Hello World example. Does it look like any ordinary Java or C# code? Yup.

    So please, save yourself thirty dollars and a heck of a lot of time and don't ever touch this book. Spend time improving the code you've already written rather than wasting time on theoretical gibberish that won't result in any improved programs.

    What we really need is better error prevention, not some new style to program in. Get your priorities straight.

    --

    31 people regularly point & click my G-spot
  20. Just natural by Anonymous Coward · · Score: 0

    If your OO program is large enough, you naturally begin designing things "aspect oriented" without even knowing that it is called so. If someone needs to explain this to you, you should not be in programming.

  21. Re:Portable.NET uses AOP for the C# compiler: tree by Anonymous Coward · · Score: 0

    That is rather limited undestanding. Bog-standard CLOS does that. AOP is like a comprehensive set of :around-method-like extensions to CLOS via the MOP.

  22. disgusting by rpeppe · · Score: 5, Insightful
    Sounds like a disgusting way of trying to legitimise hacks to me. Changing code in ways it wasn't meant to be changed, guaranteed to break lots of things (hence the "horribly easy to accidentally create infinite recursion" reference... no shit Sherlock!)

    When will people realise that the most important thing in a programming language is to make it possible to reason about one part of it independent of another part? Most of the time spent developing a program is spent modifying code, not creating new code!

    Unfortunately people don't realise this: they just want a way of hacking something existing into something different, cross their fingers and hope that it works when someone changes some other part of the system.

    Sadly, it's not just AOP: some of the "usual" OO programming language features suffer this kind of problem too.

    Then again, maybe I'm completely wrong, and AOP has a sound theoretical basis and has been created by someone with deep understanding of programming language developments over the last thirty years... someone please reassure me!

    1. Re:disgusting by Anonymous Coward · · Score: 0

      Actually, in my opinion, the purpose of programming languages is to restrict the number of ways you can do something to about three: the fast way, the slow way, and the middle way.

      Simple languages are better because they do what you advocate: make understanding easier. Languages which include everything and the kitchen sink have so many (redundant) ways of doing things, it impedes understanding.

      Taken to the extreme, machine language gives you the ultimate in flexibility. (You can make the CPU execute invalid instructions! Whee!) A language like C adds a few more restrictions on top of that. C++ goes the other way and adds a kitchen sink, so I don't know about that...

      Maybe I'm just the ivory tower type.

    2. Re:disgusting by agedman · · Score: 3, Insightful
      I've used AspectJ a fair amount. I'm not sure if it is the next hot thing, but it is more interesting than rpeppe gives it credit for being.

      When will people realise that the most important thing in a programming language is to make it possible to reason about one part of it independent of another part?

      Actually, this is precisely what AOP seeks to do. By gather all the logging or DB transaction logic into one place and giving rules to the compiler for determining when/where to insert that code, you achieve a very clean separation of concerns.

      The business logic writer doesn't have to know about logging or transations, trusting that the aspect writer it correctly specified. However, if the business logic writer comes upon a special case, that could be handled outside the general Aspect covering that.

      ...hence the "horribly easy to accidentally create infinite recursion" reference...

      Attempting to apply Aspects to Aspects can get a bit dangerous. But then so can recursion, reflection or any other powerful tool.

      I think AspectJ is an interesting technology that you ought to check out before sneering at. Certainly it does have problems - my biggest problems with AspectJ spring from it not being tightly integrated with the language. When I used it, there were issues with debugging, building large projects and with non-hacker acceptance. With any luck, these have been dealt with.

    3. Re:disgusting by rpeppe · · Score: 1
      Actually, this is precisely what AOP seeks to do. By gather all the logging or DB transaction logic into one place and giving rules to the compiler for determining when/where to insert that code, you achieve a very clean separation of concerns.

      Clean from the point of view of the person implementing the logging or DB transaction code, perhaps... but think about it from the point of view of the person debugging the system: at any method invocation in the original code, some other arbitrary code might run, with possibly arbitrary side effects, including possibly invoking other methods and/or changing instance variables in the object that's currently being used.

      Of course, no sensible person would use this kind of feature in a way that would cause these kind of side-effects, but when debugging a system you don't know whether the original implementor was sensible. Perhaps they made a mistake (something I believe has been known to happen...).

      The point is that by adding primitives like this, you've gone from building your system on solid building blocks to a foundation of shifting sands. An API that was stable before might be utterly demolished by a slightly injudicious use of this feature.

      Those people in this thread comparing this feature to LISP macros were dead on... experienced LISP programmers use them seldom. As this says:

      Macros are powerful, but dangerous. Use them sparingly, and only when you really understand what they might do.
      Do people really want to build reliable software using this sort of stuff?
    4. Re:disgusting by Anonymous Coward · · Score: 0

      > When will people realise that the most important thing
      > in a programming language is to make it possible to
      > reason about one part of it independent of another part?

      I thought the most important thing about a programming language is to allow the programmer to express the solution to a problem in as clear, concise, and natural way as possible. Whatever helps in achieving this is good. Whatever only adds to move obfuscation is bad.

    5. Re:disgusting by Anonymous Coward · · Score: 0

      It would seem to me that it would be trivial to remove the Aspects for debugging. Aspects seem to be more useful for profiling, logging, security, exception handling etc. The kinds of things that are parallel to, but not directly part of, the purpose of the application and it kind of makes sence to separate them out. In order to both create simpler application specific code as well as to gather and organize the other related code in one place.

    6. Re:disgusting by sdkone · · Score: 1

      You mention that OOP suffers from similar problems to AOP but the paper you link doesn't describe the half of it. When you said...

      Sounds like a disgusting way of trying to legitimise hacks to me. Changing code in ways it wasn't meant to be changed, guaranteed to break lots of things (hence the "horribly easy to accidentally create infinite recursion" reference... no shit Sherlock!)

      ...you could have easily been talking about implementation inheritance, since it suffers from exactly that problem. Still, implementation inheritance is standard in all modern, popular OO languages because it's so powerful and as long as you try to use it correctly, you probably won't hang yourself.

      AOP is another step down that road I think. Objects are powerful, but occasionally confusing - aspects are something along those lines to. There are still problems that need to be worked out before AOP takes off - aspect composition, or feature interaction for one - and I don't think anyone (apart from the evangelists) is really sure if AOP is going to be a big thing.

      Btw, I heard a whisper that Gregor Kiczales, the guy credited with pioneering a lot of this stuff, thought that AOP had diverged from what he originally intended. Certainly, the original AOP paper seems to describe something completely different. Make of it what you will...

    7. Re:disgusting by Rary · · Score: 1
      >> "Of course, no sensible person would use this kind of feature in a way that would cause these kind of side-effects, but when debugging a system you don't know whether the original implementor was sensible."

      This seems an odd criticism. It seems you're criticizing AOP for what people can do with it when using it incorrectly. In that case, all programming should be criticized, since all programming (AOP, OOP, procedural, whatever) can be made to be extremely ugly and unmaintainable when done incorrectly.

      AOP is not supposed to be used the way you've described it. I won't throw away the concept simply because somebody who doesn't know what they're doing might mess things up. I'll just try to make sure the only people using it on my project know what they're doing.

      --

      "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    8. Re:disgusting by rpeppe · · Score: 1
      Programming languages are as important for what they don't allow you to do as for what they do allow you to do. Why does Java have a statically declared type system? Why... for the sole purpose of forbidding you to perform certain actions (e.g. calling a method on an object that doesn't implement that method).

      Certain language features lend themselves to abuse (C++ operator overloading has been held up as example of this in the past). In my view, a well designed language should provide powerful features that also lend themselves well to "modular-reasoning". By this I mean that in an arbitrarily large software project, I can look at one tiny bit of it and work out something of what it's doing.

      Given that most large software projects are, in their totality beyond one person's conception, I'd say this was a highly desirable feature in a modern computer language. Features like AOP undermine this kind of modular reasoning by changing the semantics of code that was originally written (and tested) without the knowledge that it would be changed like that.

      There are all kinds of invariants that programmers maintain when writing their code, and this kind of feature seems like a very good way of breaking them in all kinds of subtle ways. Welcome to Bug City.

      Random comment: If you're interested, this is an OO language which seems to be genuinely well done.

  23. COMEFROM by Anonymous Coward · · Score: 0

    People are going crazy over COMEFROM.

    1. Re:COMEFROM by Anonymous Coward · · Score: 0

      Intercal rules!

  24. AOP Resources by Vagary · · Score: 3, Informative

    The Software Practices Lab at UBC has been doing all sorts of AOP research lately. Of particular interest:

    • A study to determine whether AOP is actually useful.
    • Implementation of all the GoF Design Patterns in both vanilla Java and AspectJ.

    They're also working on AspectC and AspectSmalltalk. It's my understanding that UBC is one of the major world centers in AOP research -- do you think I should do a PhD there?

    1. Re:AOP Resources by listen · · Score: 1

      do you think I should do a PhD there?

      Its always important to get slashdots opinion when considering this kind of issue.

  25. My take on AOP... by Fnkmaster · · Score: 4, Insightful
    I checked this out almost a year ago now, and I'm sure it's come a way since then. First off, AOP is not going to replace OOP or any other paradigm of programming. It simply provides a viable alternative way to think about the control flow and execution of a program, and a shortcut for making more maintainable code.


    Anybody who has worked extensively in Java has found this problem before. Cross-cutting concerns - you know, those systemic things that infiltrate their way into every module of your humongo-system, no matter how you try to partition it. Now, object-oriented programming, isn't that supposed to let you "blackbox" things so you can just abstract away such things and throw them in some "common" or "system" package and be done with it? Sure, you can. And you probably have. And I've done it too.


    But these solutions can be suboptimal - for example, a project I once worked on had an Interface in the com.blah.blah.system package for logging, messaging, persistence, and some other features. These were always nasty pains in the ass to manage. I mean, some implementor of these objects existed everywhere in the system - if something changed fundamentally, or there was some insuffiency in the interface that was discovered, god forbid, you'd have to root around for hours changing code everywhere. Especially when exception signatures changed. Which eventually leads, in sheer frustration, to using Runtime exceptions everywhere, or declaring all of your "system" interfaces with "throws Exception". Ugh. Each solution seems worse than the problem.


    Admittedly, problems like this can be solved with good refactoring tools and practices. But not always well. The exception issue for "system" or "cross-cutting" interfaces was one I've never seen solved well (again, I'm thinking of Java here, it's the language I have the most experience working in large commercial-scale projects in where this stuff is really important). If you are working on medium or small sized open source projects, or medium or small sized tools or desktop applications, you may never have come across these kinds of limitations or frustrations in sufficient numbers to justify looking into AspectJ/AOSD in general. But if you've worked on large enterprise software projects, I'm sure you can see that there is a need to "patch," but certainly not replace, the standard OOP methodology to address these kinds of concerns.

    1. Re:My take on AOP... by Anonymous Coward · · Score: 0

      "Admittedly, problems like this can be solved with good refactoring tools and practices"

      Yes they can. But what's more is that problems like these can be solved (or at least eased a lot) by proper design in the first place. What's more, I have a bad feeling about AOP because it always presents the seemingly simple example of logging. This reminds me of the "shape" example presented in all OO books and articles but with one exception: The shape example works.

      Unfortunately the logging example does only work if you will use the simplest of logging imaginable. In all other cases you usually end up with literally thousands of joins and pointcuts. Granted they can all be in the same file or at least in the same package, so "refactoring hell" is somewhat soothed.

    2. Re:My take on AOP... by Anonymous Coward · · Score: 0

      If you're implementing interfaces everywhere for logging, doesn't this seem like one of those reasons Java should have support for multiple inheritence?

      Just a thought.

    3. Re:My take on AOP... by baldyman · · Score: 1
      specially when exception signatures changed. Which eventually leads, in sheer frustration, to using Runtime exceptions everywhere, or declaring all of your "system" interfaces with "throws Exception"

      that sounds wrong to me. Why wouldn't your 'system' methods just throw a SystemException or somesuch, if you need to augment its capabilities extend it as LoggingSystemException or whatever. No need to re-factor anything that way.
    4. Re:My take on AOP... by Fnkmaster · · Score: 1
      Well, because that forces you to wrap and rewrap exceptions repeatedly to debug accurately, which is a gigantic pain in the ass. Perhaps this doesn't make much sense, but if you have a "Messaging" interface, which you then write an implementation of in JMS, you have to catch JMSException and translate it into a SystemException (or really probably a MessagingException, which extends your SystemException). The JMSException is probably a translation of some internal exception condition to begin with, since JMS is usually a wrapper layer around some proprietary API a vendor uses. Then you need to wrap the SystemException in your code if you are passing it up to a client in some remote-invokation system (we had our own custom one of those in this case too... ugh). And our initial crack at it worked, until some over-engineering entusiast old fogey idiot promised our Director of Engineering he had a better solution, and he went through and replaced everything with a generic "wrapping" system that resulted in (literally) 10-20 page long exception dumps everytime something went wrong. Then the developers couldn't even figure out what happened when something broke ("well, there's this exception, here, but that's not the real exception, we have to scroll down to get to the 10th exception and now look at the stack trace for it to see what's really going wrong..."). In other words, when you embed or wrap exceptions, you lose the stack trace, or have to embed it as text. What a fucking mess that system became after Joejoe Overengineering Idiot got his hands on it.


      I'm not saying anything in particular is "wrong" (other than what this one fellow did), I'm just pointing out a flaw in the exception handling model that Java uses - several papers have been written on the subject, so I'm not the only one who feels that way.

  26. Aspect? by DulcetTone · · Score: 1
    More like Abject? Reject?

    tone

    --
    tone
  27. An example by Anonymous Coward · · Score: 0
  28. Hasn't CLOS had this sort of thing (15 years ago) by helixcode123 · · Score: 3, Interesting

    This sounds similar to the Common Lisp Object System (CLOS) :before and :after methods.
    If I remember correctly, in CLOS you can specify a method "foo", and then another method "foo" with the ":before" modifier that would be executed before the normal "foo" method. There is also an ":after" specifier.

    --

    In a band? Use WheresTheGig for free.

  29. A few better examples by rossjudson · · Score: 1

    Logging is an easy one for AOP. Here are some more interesting things you can do:

    1. Security processing...weave security checks into your code.
    2. Transaction monitoring.
    3. Automatic event propagation (get rid of those nasty JavaBeans listeners).

    If, in a given situation, you call several methods in order, and that pattern is repeated across many other methods, each of those calls is a candidate for AOP, where you weave the calls in directly through pattern matching, rather than typing.

    It can result in dramatically reduced code. It also _enforces_ behaviors (like when you forget to add that one line that does the security check).

    Without AOP you are programming by exceptions, not by rule.

    1. Re:A few better examples by Anonymous Coward · · Score: 0

      It also _enforces_ behaviors (like when you forget to add that one line that does the security check).

      What about when you forget to add that one method to the pointcut?

  30. Re:Portable.NET uses AOP for the C# compiler: tree by manyoso · · Score: 1
    Yes, my understanding is very limited ;)

    treecc was specifically designed to aid in compiler design and it turns out that this is one of the examples that make for a good AOP solution. This is the relevant blurb from Rhys's article on treecc:

    "During the early stages of writing a compiler, the node types change very frequently. This activates the Achilles heel of the Visitor pattern, and creates a maintainence nightmare. The book suggests that we should use the inheritance approach to solve this problem. ...

    The inheritance pattern becomes a problem when new operations are needed. The solution is visitors. Visitors become a problem when new node types are needed. The solution is inheritance. What we have is a situation that the design patterns gurus didn't consider: if the set of nodes and operations are both changing rapidly, then we will have problems no matter what we do.

    We need a solution that combines the strengths of both patterns without the drawbacks of either. We want the implementation language to catch us when we forget something, but we also want it to handle large numbers of nodes and operations smoothly. We want to split different operations into different modules, but also keep them closely associated with the node type.

    None of the standard patterns provide this combination of functionality, because none of the existing implementation languages support both styles of program design at the same time."
  31. Go read TAUOP by arvindn · · Score: 1
    I don't mean to disparage AOP or anything, but getting it right in practice is often a far cry from applying methodologies. I've sat through a software engg course, and its irrelevance to writing good software is striking.

    Go read The art of UNIX programming (online) NOW!. The author is ESR. Its an amazingly useful book. It cuts out all the hype and gives you a higher-level philosphical insight into effective programming.

    Quote from the book:

    Assemblers, compilers, flowcharting, procedural programming, structured programming, "artificial intelligence", fourth-generation languages, object orientation, and software-development methodologies without number have been touted and sold as a cure for this problem. All have failed, if only because they 'succeeded' by escalating the normal level of program complexity to the point where (once again) human brains could barely cope. As Fred Brooks famously observed [Brooks], there is no silver bullet.

  32. Overlooked extensions to C by WebfishUK · · Score: 5, Funny



    Instead of looking for radically new approaches in computer language development why doesn't someone introduce more colour into standard C. For instance we have if and while, how about adding verbs such as when, where or how.

    Taking it further we might like to introduce more polite language into code such WouldYouBeSoKindAsTo or WhenYouAreReady. Imagine the code you could write...

    when (time == "morning")
    WouldYouBeSoKindAsTo (turn_on_alarm);


    Alternatively we could convert C from English into, say, German. So if would become wenn etc. You could even mix nationalities. For instance if you wanted to be very forceful about a particular if statement you could use the German. If you wanted to seduce the code you might use the French.

    Come on all it takes is some imagination. (Alternatively we could all just start using befunge!)

    --
    -- "Can't sleep, clowns will eat me!"
    1. Re:Overlooked extensions to C by Anonymous Coward · · Score: 0


      We already have this. It's called COBOL.

    2. Re:Overlooked extensions to C by Anonymous Coward · · Score: 0

      The great thing about this is, you can already implement it in C! #define when to be if, add a function WouldYouBeSoKindAsTo, add an enumerated turn_on_alarm, and make time a const char *.

      Then do something like this:

      const char *morning = "morning"; ...
      time = morning;
      when (time == "morning")
      WouldYouBeSoKindAsTo (turn on alarm);

      If your compiler is clever enough, it'll make the two "morning"s the same read-only memory in your object file. And there you go. :)

    3. Re:Overlooked extensions to C by Jester99 · · Score: 1

      Befunge? No, no, no.

      You've got it all wrong. The language you are looking for is INTERCAL. This has features just as you described -- and 30 years ago!

      What other langauge has a PLEASE keyword? :)

    4. Re:Overlooked extensions to C by etcpasswd · · Score: 1

      The AOP way:

      after(): WouldYouBeSoKindAsTo () {
      ThankYouButPlease(turn_off_alarm);
      }

  33. I applaud this. by The+Kryptonian · · Score: 1

    The software development industry has seen so many different approaches to designing the design process in the past three years that the pointy haired bosses of the world are now running around in circles. This is a good thing. Now that the ivory tower managers are busy contemplating their navels, the people who actually roll up their sleeves and write something can actually get some work done - my point being that the time spent in such pursuits rather than doing the basic project planning that any software development manager with half a brain knows how to do in his sleep merely slows down the project and confuses the hell out of the programmers.

  34. AspectJ is a safe warm power drill by Anonymous Coward · · Score: 3, Informative

    I'd have to disagree that it won't be used in production shops any time soon. It's really a matter of the word getting out, which undoubtedly will be helped by both the book and the appearance of this review on /.

    A team I was on early last year had a legacy Java db access module that was rife with poor exception handling. We wrote a single aspect that joined on all exceptions, trapping only JDBC exceptions, and had the aspect trap the SQL error code, the ISAM error code, the offending method and source code line. After recompiling the module with the aspect included, we popped the new JAR into production and used the trace files to find the offending code. Altogether it took 2 days to address the errors. So we re-recompiled the JAR, this time with the aspect removed, into production it went, and received a few beers for our "inventiveness."

    Honestly, this is one of the most useful Java tools I've ever run across. I guess I should have sent the PARC guys money for some tallboys.

    1. Re:AspectJ is a safe warm power drill by Cranx · · Score: 1

      Since you took out aspect and just did global edits anyway, why did you bother doing aspect in the first place?

    2. Re:AspectJ is a safe warm power drill by Anonymous Coward · · Score: 0

      In a nutshell: time.

      Certainly we could have gone to the trouble of placing traces within the code using "straight" Java and using that to find the errors, but two factors steered us away from this. (1) Not all JDBC-related code was malfunctioning. We needed the fastest possible way to identify the problem, because it was in production and causing major headaches. So given the choice of picking apart a few klocs or writing a 10-line aspect we could just compile in, we went for the aspect. (2) By creating this aspect, we had something we could apply to any other part of the system for JDBC exception trapping with no additional effort. We did, in fact, use it for other things (in staging, thankfully) later on.

      It is an awesome feeling to leverage a little bit of work into a tremendous result. And for critics who suggest that AOP is somehow in conflict with OOP, consider that it can, if you choose, simply be used as a very effective tool for triage in times of stress (read: your xmas bonus is decreasing in proportion to the time it takes you to fix this problem).

      Also, I feel confident in saying that the problems we encountered with the code I mentioned probably never would have come up if we had used AOP in the module to start with. The problems centered around mistakes made in short code blocks that were repeated in many methods -- in other words, a crosscut -- but some coders screwed up the individual occurrences of the code blocks as they changed over time. Had the code blocks been encapsulated in an aspect, it never would have been an issue.

    3. Re:AspectJ is a safe warm power drill by rpg25 · · Score: 1

      Argh! Honestly, I'm getting more and more down with the guys who say "you should just have used lisp." With lisp you could have done that without popping it out and recompiling the JAR file. You could have hot-patched the executing code. and any half-decent modern common-lisp would have had advice or fwrappers to let you grab data without messing with the core functions.

      Sure is great to see that one can plunder the past, introduce a new buzzword for the old idea, and supercharge one's career with a new programming paradigm.

    4. Re:AspectJ is a safe warm power drill by Cranx · · Score: 1

      Oh...I must have missed that part. I knew you were seeking/destroying errors, but I thought you meant "in general" you were now handling errors differently. I didn't realize there was a specific error condition you were trying to nail down.

    5. Re:AspectJ is a safe warm power drill by sql*kitten · · Score: 1

      A team I was on early last year had a legacy Java db access module that was rife with poor exception handling.

      There's legacy Java code already... oh dear. :-P

      A cunning technique, tho'.

  35. Verity Stob by Dylan2000 · · Score: 3, Informative

    is not really a real person but is one of the funniest tech writers out there. She is famous for the history of the microcomputer, and is widely and deeply revered by everybody who's read her

    She also did a parody of our own Slashdot, which is absolutely f*cking hilarious.

    I strongly recommend anyone who hasn't read any stob to go and check out the archives and then laugh yourself stupid for half an hour.

    --
    Build your own website - full service homepage system your m
    1. Re:Verity Stob by rokicki · · Score: 1

      Just as a counterpoint, she's one of the few things I cannot stand about Dr. Dobbs. She thinks she's hilarious but I find it all so predictable, derivative, and self-indulgent. Luckily it's easy for me to turn the page.

      Same with that Swaine stuff at the end.

    2. Re:Verity Stob by Dylan2000 · · Score: 1

      *goes to check out Swaine...*

      :P

      --
      Build your own website - full service homepage system your m
    3. Re:Verity Stob by a2800276 · · Score: 2, Interesting

      Yep, can't believe nobody picked up on that. While Dr. Dobbs has a fair amount of weird ecclectic columns (Swaine, Campervan-jazz-musician-what's-his-name, etc.) Verity Stob is by far the best of them. One of my favourites is the lifecyle of the desktop PC: State of Decay (It's so true.)

      Nicely written, informative book review, too, by the way. Hope we see more of her here!

      Speaking of weird things to like about Dr. Dobbs, does anyone else look forward to the PC-Lint advert/riddles every month? -- Asking that feels strangely embarassing, similar to asking "Does anyone else ever find that they've been talking to themselves for the last hour with the office door open?" :-)

  36. Joe Coder and OO by Tablizer · · Score: 1

    He is motivated, he says in his introduction, by the recollection of the 25 odd years it took for the object-oriented concept to spread from its Simula origins in frosty Norway to being the everyday tool of Joe Coder.

    Not this Joe! OO is full of bullshit and unsubstantiated claims. oop.ismad.com

    Before you mod me down, link me some evidence that OO is better for custom biz apps besides brochure-talk and anecdotes. I can guarentee you have no such thing. It does not exist.

    1. Re:Joe Coder and OO by Cranx · · Score: 1

      Are you allowed to speak with other people? Forget brochures: if your anti-OO religion there lets you go outside once in awhile for walks or catching your own food, take the opportunity to speak with the thousands, if not millions, of programmers who have programmed in both OOP and non-OOP ways. Bring a clay tablet and chisel so you can take some notes.

    2. Re:Joe Coder and OO by Tablizer · · Score: 1

      to speak with the thousands, if not millions, of programmers who have programmed in both OOP and non-OOP ways. Bring a clay tablet and chisel so you can take some notes.

      I find most of such people who volunteer such information were also crappy proceduralists. It is no wonder because OO focus has drained attention from good procedural/relational software techniques. OO is becoming a self-fullfilling prophecy.

      Besides, most programmers I encounter don't really care which paradigm is in style. They go where the money goes. People who care about programming rather than money usually settle on things like LISP. The rest chase Learn OoXMLJavaPatterns in 21 Days fads.

    3. Re:Joe Coder and OO by Anonymous Coward · · Score: 0


      I've tended to notice that procedural programmers who rail against OO tend to produce inefficient procedural code as well. I suspect that these are two effects of a single cause, i.e. a low ability to construct mental models.

    4. Re:Joe Coder and OO by Tablizer · · Score: 1

      I've tended to notice that procedural programmers who rail against OO tend to produce inefficient procedural code as well.

      You mean from a machine speed standpoint, or from a code production standpoint?

      If you want to sell me on OO, then show me how it makes better code and/or better handles the change scenarios you are assuming will take place down the road, and exactly how your code stands up to it better. I want to see results with my own fricken eyes. (Just make sure you pick a realistic set change scenarios, not just those that happen to fit OO's grain.)

      I suspect that these are two effects of a single cause, i.e. a low ability to construct mental models.

      Everybody constructs mental models. It is just that they tend to be different from each other or hard for them to articulate.

      If by chance this is another way of saying that "OO is better abstraction", then I would like to see a demonstration. "Abstraction" tends to be a subjective notion. It is also relative to situational needs in my observation. OO tends to assume global astraction (public interface), which is a dead end IMO.

    5. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      I don't know about you, but I'm writing a simulator program right now in C (for portability reasons), and it would be a heck of a lot easier if I could do something like

      obj.doFoo(stuff + now)

      If you don't think OO is useful, this is probably because you've never run into an application where non-OO techniques plain suck to code in.

      Sure, you can do anything in a non-OOP language that you can in an OOP language (that's what I'm doing, and in fact, you could theoretically do everything using a Turing machine language), but it's often a lot easier to type in a few symbols that do a whole lot.

      If you're the kind of programming who just writes business logic, I could see your point. There isn't anything particular interesting about that. But writing a GUI, or something else in which the execution pathways aren't so predictable?

      Just compare the difference (especially internal) between a toolkit like GTk (written entirely in C) and Qt (written entirely in C++). It's mind-bogging.

    6. Re:Joe Coder and OO by Cranx · · Score: 1

      You know what? Then you don't chase them. If you couldn't get any good use out of OOP, then just stay there in your procedural camp. I programmed in LISP before I'd ever even heard of C or C++, much less Java and I've done a lot with all of them, and gotten excellent use out of all of them. I was not mired in a fantasy world of OO theory; I took C++ and Java and put them straight away to good use. You must be "the LISP guy" where you work; I feel sorry for you if your company ever decides to shift into second gear, you're going to end up at the bottom of a very large barrel of otherwise useful programmers clawing at the sky for a job.

    7. Re:Joe Coder and OO by Tablizer · · Score: 1

      You must be "the LISP guy" where you work; I feel sorry for you if your company ever decides to shift into second gear, you're going to end up at the bottom of a very large barrel of otherwise useful programmers clawing at the sky for a job.

      Making money and being good at programming are not necessarily the same thing. The cubicle world is irrational.

      Why is this conversation turning back to me anyhow? If you claim OOP to be objectively superior, then YOU provide the evidence. Otherwise, let some air out of the OO hype so it is treated as just another paradigm.

    8. Re:Joe Coder and OO by Tablizer · · Score: 1

      I don't know about you, but I'm writing a simulator program right now in C (for portability reasons), and it would be a heck of a lot easier if I could do something like....

      Maybe OO is better there. Simulations is where OOP was born. However, being good at A does not guarentee also being good at B.

      But writing a GUI, or something else in which the execution pathways aren't so predictable?

      Use table-based dispatching, then you can trace and perhaps mark the records that are triggered. I find tables far more navigatable than a web of tangled classes.

      Just compare the difference (especially internal) between a toolkit like GTk (written entirely in C) and Qt (written entirely in C++). It's mind-bogging.

      Some people like Tk. Besides, I would take a different approach from both.

      If you're the kind of programming who just writes business logic, I could see your point. There isn't anything particular interesting about that.

      Boring or not, I still need a paradigm that works well for it.

    9. Re:Joe Coder and OO by Cranx · · Score: 1

      What hype? Don't feel pressured...if you don't need it much, look the other way. If you drive a VW and you are sick of Hummer ads, look away. OO is a paradigm that people are finding extraordinarily useful. If you don't find it so, you don't find it so.

    10. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      Amusingly, of course, Common Lisp was actually the first standardised Object Oriented language, and is still the most powerful one, on balance. All this AOP malarkey is actually a subset of what's possible with the Common Lisp Object System (CLOS) Meta Object Protocol (MOP)

      Of course, anyone who writes Lisp as LISP pretty much certainly has a very outdated understanding of what Lisp is.

    11. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      Ahh, Tablizer. I see you're off ranting again. Still having trouble understanding Python's semantics? Still working on that retarded associative array language you're never quite educated enough to write a proper compiler for? Don't you ever get bored attempting to spread your net.kook ideological position, and get the urge to actually produce software with your time? I understand that writing VBScript on Windows can become mind-numbing, but you could take some of that dot-bomb money you've surely made and take the time to attend a University and acquire a degree in Computer Science. Eventually you'll then be educated sufficiently to implement your boring toy language, and be capable of expressing your ideas in your own special-ed sort of way through it, and you can be finally happy.

      Your major problem is that you're too caught up in making others prove to you what methodology is superior. No one cares what you do with your life, and the only reason they will respond to your ignorant statements is out of a delusions of intellectual challenge. If you cannot see their reasoning, they're not going to lose sleep over it. No one is going to waste time trying to "make you see with your own fricken eyes" anything, when you're clearly an uneducated zealot incapable of reason.

    12. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      Tablizer is a known net.kook who posts in several forums. There's no point in attempting to reason with him, because he will continually not comprehend anything you present. He will trivialize all examples of what you show him, and then go on to tell you that it's not applicable to pretty-printing or something else equally inane.

      Tablizer isn't anyone's lisp guy. He doesn't know anything about lisp. He's a fucking VBScript/SQL programmer that had difficulty understanding how to use Python. If you Google around you'll find plenty of examples of people expending far too much time writing software to show him the benefits of their specific paradigms to no avail. He's a real nutjob.

    13. Re:Joe Coder and OO by Cranx · · Score: 1

      Anyone who is still spelling Clos as CLOS is pretty much certainly lacking dates on the weekend.

    14. Re:Joe Coder and OO by Tablizer · · Score: 1

      What hype? Don't feel pressured...if you don't need it much, look the other way. If you drive a VW and you are sick of Hummer ads, look away. OO is a paradigm that people are finding extraordinarily useful. If you don't find it so, you don't find it so.

      Can't hide. The Hummer hype is shoving it into more and more jobs and tools.

    15. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      Tablizer is a known net.kook who posts in several forums. There's no point in attempting to reason with him, because he will continually not comprehend anything you present.

      I think I know who you are. An iwe regular, arencha?

      Red herring. I asked you guys for "good OO evidence" that YOUR OWN OO PEERS would agree is "decent OO evidence". You couldn't do it.

      Your own fricken peers couldn't find/agree on what is good OO evidence. Pitaful.

      He's a fucking VBScript/SQL programmer that had difficulty understanding how to use Python.

      So because I asked a question about function references in Python, I am a complete retard? Like you get 100% of every new language you try? Jeeez. (Perhaps a few do, but you can't extrapolate this to every programmer.)

      You are the nutcase, not me. You mistake personal emotion for science.

    16. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      IWE'r again? There are few things I need to correct here.

      Don't you ever get bored attempting to spread your net.kook ideological position

      Do OO zealots every get bored of spreading their unproven hype? Double standard.

      I understand that writing VBScript

      I never said that VBScript was an ideal language. How many programmers get to write in their favorite language?......and get paid.

      but you could take some of that dot-bomb money you've surely made

      Unfortunately, most of it was based on stock option promises. I actually wanted to work on intranets, not dot.com ecommerce, but got pulled in somehow.

      University and acquire a degree in Computer Science

      I got one. 3.8 GPA.

      If you cannot see their reasoning, they're not going to lose sleep over it.

      It is not reasoning. It is personal preferences mistaken for external truths. You are just not smart enough to see that this is what you are doing. You might be great at language and syntax trivia, but you suck at recognizing, finding, and presenting objective evidence. We can't all be good at everything.

    17. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      IWE'r again? There are few things I need to correct here.

      Is that supposed to be a proper noun, or is it Engrish?

      Do OO zealots every get bored of spreading their unproven hype? Double standard.

      1. Prove that I find Object Oriented Programming to be a good methodology.
      2. Prove that I hold it above all others.
      3. Find a double standard in the content of my post, or neglect to bring up what you conceive as a double-standard from "OO zealots."

      I never said that VBScript was an ideal language. How many programmers get to write in their favorite language?......and get paid.

      Do you have any figures in regard to this? If not, how does it matter? Who claimed you find VBScript to be ideal? In all honesty, I was simply taunting the limited selection of your knowledge.

      I got one. 3.8 GPA.

      From what University in what major? You are either the least-knowledgeable graduate prior to the CS curriculum degredation of the 90s, or you're a liar. If you'd scan your records, that would be excellent.

      It is not reasoning.

      I have read hundreds of the flamewars you've engaged in on numerous forums. Your opponents _do_ provide reasoning, you're just stupid. You simply ignore it with your "personal preference" which you mistake for "external truths."

      You are just not smart enough to see that this is what you are doing.

      I think it's you that isn't quite bright enough to see what I am doing. You've apparently mistaken me for someone that is trying to sell you a methodology, and I find that amusing. I've no intentions of getting sucked into such inane endeavors.

      You might be great at language and syntax trivia

      You have absolutely no idea who I am, least of all what my skills are. You're just being foolish.

      We can't all be good at everything.

      Which is why I'm willing to accept that you're not good at anything.

      but you suck at recognizing, finding, and presenting objective evidence.

      Let's see you provide evidence for a single one of your above positions. Since you seem to believe that objective analysis is your strong suit (it isn't, trust me), you should have no problems.

      Hurry Tablizer, you better get back to work making vaporware specifications that hightlight your idiocy.

    18. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      I think I know who you are. An iwe regular, arencha?

      No. Not only do you not know who I am, I do not recognize "iwe" at all.

      Red herring. I asked you guys for "good OO evidence" that YOUR OWN OO PEERS would agree is "decent OO evidence". You couldn't do it.

      You've asked me for nothing.

      So because I asked a question about function references in Python, I am a complete retard?

      Ahh, if it were only that simple.

      You are the nutcase, not me. You mistake personal emotion for science

      Let's see... 1. Paranoid delusions about my identity 2. Irrational, groundless claims about encounters with me 3. Paranoid associations of me with unidentified "peers."

      In this post alone, we can see that you've mistaken science for blind emotion. I'm simply warning others about what you are, which is a total headcase, so that they don't make the mistakes of others and attempt to reason with a lunatic.

      Though if you really must, you can continue to demonstrate how poorly hinged you are. And I must say, it takes some serious courage to post your comments anonymously when you would otherwise use a named account.

    19. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      (* Prove that I find Object Oriented Programming to be a good methodology. *)

      If you don't think highly of OO, then why are you pestering me?

      (* In all honesty, I was simply taunting the limited selection of your knowledge. *)

      Just because I did/do some VBS does not mean that is the only language I use. Besides, I tend to shift many things to the database that others tend to do in code. Thus, I don't need that "powerful" of a language. (VBS is missing some goodies that I think would be really helpful, though.)

      I find the majority of the gizmos in bloated languages to be for the purpose of reinventing a (bad) database in app code by hand. IOW, fat languages are for people who are skinney on databases.

      (* You are either the least-knowledgeable graduate prior to the CS curriculum degredation of the 90s, or you're a liar. *)

      What specifically are you complaining about? Lets take this flamewar to z.iwethey.org, okay?

      (* Your opponents _do_ provide reasoning, you're just stupid. *)

      I am not aware of such. It appeared to me that their reasoning simply sucked. Again, lets explore an alleged laspse at z.iwethey.org.

      (* Since you seem to believe that objective analysis is your strong suit *)

      Save it for OO evidence, not personal sh8t.

    20. Re:Joe Coder and OO by Anonymous Coward · · Score: 0

      Listen, just provide a link to "good" OOP evidence or shut up. You seem more interested in personal issues than tech stuff.

  37. Maybe it's just me by kfg · · Score: 3, Insightful

    But. . .

    This has the feel to it that the programing methodology is becoming religious dogma, rather than a useful tool.

    I've been getting that feel for a while now, as OOP languages start to compete on their "purity" or whether they're "real" OOP languages or not.

    I've been programing "Object Oriented" since the 70's. In languages, like APL, that no one would consider "Object Oriented." Object Orientation is an abstract concept in itself that allows us to more easily abstract real world items into virtual objects and to manipulate them in a virtual world.

    That's all. It is occasionally a very useful tool to have in one's bag of tricks. Sometimes it really doesn't apply at all and trying to force a fit just makes things labored and crude.

    Trying to turn the entire universe of thought and logic into formal objects ( such as the number 1, which is most definately *not* an object), is putting the dogma before the cart, which then drags the poor cart anywhere the dogma wants it to go.

    "Aspect" Orientation simply feels like a sect trying to break off from the Mother Church to me. This is not to say it may not be very useful, but that usefulness is needed because of doctrine in the first place.

    Some things are objects. Some things are just operations or functions that have to be tortured beyond recognition if they're to be objectified. The less "pure" an OOP language the more *useful* I tend to find it, because it allows me to choose my methodology based on the problem.

    Aren't there easier ways to add one and one and get two?

    KFG

    1. Re:Maybe it's just me by Rary · · Score: 1

      Actually, I think that's kind of the point of Aspect-Oriented Development. Basically, somebody ignored the dogmatic preaching of the OO-obsessed long enough to realize that there are some things that OO just doesn't handle properly. So he came up with a different way to do it, and it's AO. It's not a new dogma to replace OO, it's just a way to handle what OO is lacking in.

      --

      "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    2. Re:Maybe it's just me by Anonymous Coward · · Score: 0

      Actually, to a mathematician, numbers are objects. 1 and 2 just happen to be symbols that obey certain ordering principles in a certain kind of set of numbers.

      The fact that 1 + 2 = 3 is a consequence of the axioms of these sets for relating one of these objects to another.

      That the rules make it relatively easy for a computer to use algorithms to transform 1 + 2 into 3 a heck of a lot faster than looking it up in a table or something is just a convenient hack, invented by engineering types, from the perspective of a formal mathematician.

    3. Re:Maybe it's just me by kfg · · Score: 1

      I said number, not numeral. I understand the difference between a number and the symbol chosen to represent it. I am not a mathmatician, I am a physicist. As such I am often put into intimate contact with mathmaticians for hours at a time.

      They often spend much of this time berating physicists for treating numbers like objects. They are not. They are pure abstractions. You cannot show me a number one.

      The same goes for the rules and axioms of mathmatics. They have no existence outside of your brain.

      They are thoughts and ideas. Thoughts are not objects.

      When creating an object in a program, let's say a playing card for a poker game, you are *abstracting* the real object into. . . numbers, i.e., not actually an object.

      Numbers are an *abstraction,* by nature. To turn them into an object turns the raison d'etre of Object Oriented Programing on its head and "deabstracts" things that are already abstractions into real objects, and then abstracts them again.

      Of course this is necessary once you adopt the dogma that *everything* is an object, but as far as I've ever been able to discern this just proves reductio ad absurdum that the premise is deeply flawed.

      And it is ruining an entire generation of programers for abstract and critical thought. The very existence of "Object Oriented" databases is further proof of my position. The very concept is mathmatically provable as doofey, and has no mathmatical basis of its own at all.

      KFG

    4. Re:Maybe it's just me by efflux · · Score: 1

      My sentiments exactly.

      Let me point out for other readers though, that 1 + 2 = 3 does not mean that 3 is (1 + 2), but rather that 3 is related to 1 + 2 and that particular relation is equality. Properties of certain number systems then allow for substitution of 3 for 1 + 2. Let me also further stress that "3" is simply a symbol denoting a particular element of a set. 3 may not even be an integer, it may be an element in some other set.

      For example:
      Let S be any set, with |S| = 3 (it is understood that cardinality is a non-negative integer, so 3 here is not ambiguous)
      We may then denote the elements of S as follows: s= {1,2,3}.
      1,2, and 3 may very well be a function, or any other object for that matter (including other sets).
      If 1,2,3 are the equivalence classes [0],[1],[2] (respectively) created by [n] = {r ~ n mod 3|r is an integer}, and r ~ n mod 3 iff (r - n)/3 = an integer;
      Then:
      we can say things like "2 + 3 = 1", and "1 + 2 = 2".

      Furthermore, A(S)=S3(that is, subscript 3)= {(1),(12),(13),(23)(123),(132)}

      This should serve as an ample demonstration of a number as an object.

      --
      Do I contradict myself? Very well, then I contradict myself, I am large, I contain multitudes. -- Walt Whitman
    5. Re:Maybe it's just me by pkaminsk · · Score: 1
      Thoughts are not objects.

      Where did you get that idea? Every OO philosophy that I know of accepts (nay, encourages!) abstract concepts being modeled as objects. Without this, OO becomes useless and pointless -- just like you imagine it to be.

    6. Re:Maybe it's just me by kfg · · Score: 1

      One, every OO philosophy that you know of clearly isn't every OO philosophy. To the extent that OO philosophies encourage treating abstract concepts as objects, yes, that is my complaint. I've stated it more than once. Let me do so again:

      "The "pure" OO philosophy treats purely abstract thoughts as actual objects. They are not. This is a weakness of the "pure" OO philosophy that makes it less practically useful."

      I have nowhere said I find OO pointless or useless, I explicity said I've been programing in an Object *Oriented* ( as opposed to "required," it's labeled "oriented" for a reason) manner since before the concept was first formally codified. It is an *emensely* useful way of looking at certain things and procedures. It is *less* useful ( as distinct from "useless" or "pointless") the more and more it becomes *required* to treat everything as an object.

      Computers are not good at abstract thought. Brains are. Brains are actually not very good at computation. Computers ( go figure) are. To each its strength.

      KFG

    7. Re:Maybe it's just me by efflux · · Score: 1

      I said number, not numeral. I understand the difference between a number and the symbol chosen to represent it. I am not a mathmatician, I am a physicist. As such I am often put into intimate contact with mathmaticians for hours at a time.

      well said.

      They often spend much of this time berating physicists for treating numbers like objects. They are not. They are pure abstractions. You cannot show me a number one.

      No beef here.

      The same goes for the rules and axioms of mathmatics. They have no existence outside of your brain.

      The rules and axioms do not. However, they are meant to "represent" actual relationships. I see my computer screen with my eyes. What my brain is aware of is not the screen itself, but signals meant to represent the screen. This is an imperfect representation. Does this mean that the screen does not exist or that I should treat what I see as not actually existing?

      They are thoughts and ideas. Thoughts are not objects.

      They are objects as much as OOP objects are objects. They have properties. They can be compartmentalized. They can be combined with operators. To think of them as actual objects is just a conceptual tool.

      When creating an object in a program, let's say a playing card for a poker game, you are *abstracting* the real object into. . . numbers, i.e., not actually an object.

      Certainly I am abstracting the real object into something. This would likely be an object (oop) or a data structure without methods(top-down). Neither are "actual objects". Both are "conceptual objects". The primary difference with oop is the addition of methods. I know, I'm greatly simplifying things here but it's best that I leave more qualified people to disect the specifics of oop design.

      Numbers are an *abstraction,* by nature. Certainly.

      To turn them into an object turns the raison d'etre of Object Oriented Programing on its head and "deabstracts" things that are already abstractions into real objects, and then abstracts them again.

      Whoa! First, how does one turn "things that are already abstractions into real object"? This doesn't make any sense.
      Perhaps you mean, reconceptualize an abstraction as if it were a real object to determine how it would function in it's hypothetical world?

      But isn't this just associating properties and relationships with an "object"? Isn't this *exactly* the raison d'etre of Object Oriented Programing? To bring the properties and interactions of an object with its "world" all under the convenient shell of a class?

      And it is ruining an entire generation of programers for abstract and critical thought. The very existence of "Object Oriented" databases is further proof of my position. The very concept is mathmatically provable as doofey, and has no mathmatical basis of its own at all.

      Actually, a lack of a basis in mathematics is crippling most of a generation of programers--who now cannot think well, either critically or abstractly.
      Blame those damn "business programming" programs.

      --
      Do I contradict myself? Very well, then I contradict myself, I am large, I contain multitudes. -- Walt Whitman
    8. Re:Maybe it's just me by Anonymous Coward · · Score: 0

      1. It's mathematician
      2. Object-Oriented programming has nothing to do with physical objects. It isn't a contradiction to treat all types with the same subtyping semantics.
      3. All programs are abstractions. You can't show me "an instance of type C" or "the method Q of type B." They're simply ideas expressed in whatever language one uses, that represent concepts using physical state that isn't germane to the concepts expressed.
      4. Invariably all abstract things have a concrete form within the universe.
      5. Construct a formal proof that demonstrates that OODBs are "doofey."
      6. You seem thoroughly confused as to what Object Oriented programming is. You seem fairly confused about a lot of things, really.

    9. Re:Maybe it's just me by broter · · Score: 1

      I feel like I'm at a TOOLS conference with a lot of .5 hairs around :)

      "Computers are not good at abstract thought. Brains are. Brains are actually not very good at computation. Computers ( go figure) are. To each its strength."

      You got a point there. I believe it was pionted out (or maybe it was me screaming at my screen) that OOP were meant to make it easier on the humans to deal with the computers.

      That said, if you can avoid being abused by OO fundies for a while, you may find that AOP is a correction of some things that OOP does poorly - that's all.

      So, why stick to OOP if it has these flaws? Well, some don't. Some do, finding it easier to wrap their mind around "object" that are homogeneous to "real world" things.

      Yes, I know you were saying something like this in the origional post, but I felt the need for clarification....

      --
      "One man can change the world with a bullet in the right place."
      - Mick Travis, "If..."
  38. Spelling change... by Caoch93 · · Score: 1
    That should be "Rhetoric is cheap."

    Time to get new glasses. ;)

  39. Re:Hasn't CLOS had this sort of thing (15 years ag by iggymanz · · Score: 2, Interesting

    Yes, and languages like SmallTalk and Ruby also allow similar constructs.....the one advantage I can see from looking at the AO extensions to Java is perhaps a little more clarity in being able to quickly see the melds between methods of disparate classes, but the functionality is no different.

    I did see a project on sourceforge to add explicit AOP to Ruby, perhapss making code more understandable, but of course one can hook methods without it

  40. Re:Smelly by Anonymous Coward · · Score: 0
    Joke Odour

    It's 'odor', not 'odour'. Stop corrupting the fine American language.

  41. Books by alext · · Score: 3, Interesting

    A methodology hasn't made really made it until somebody has published a Proper Book.

    What, like The Art of the Meta-Object Protocol by the very same Gregor Kiczales et al, pub. MIT Press, 1991?

    Like most things, AOP is only new if you don't know LISP. :-)

  42. Great Review by Kragg · · Score: 1

    For a change - it's almost like you're a real writer. This review wouldn't even look out of place on a real site.

    --
    If you can't see this, click here to enable sigs.
    1. Re:Great Review by Phoukka · · Score: 1

      The author works for Dr. Dobb's Journal, and this is probably either a word-for-word copy of a book review in a recent copy of the magazine, or possibly got cut due to space and relevance issues.

      In other words, the review bloody well should be well-written, as the author gets paid for this sort of thing on a very regular basis.

    2. Re:Great Review by Kragg · · Score: 1

      That was kind of the joke...

      --
      If you can't see this, click here to enable sigs.
    3. Re:Great Review by RedWolves2 · · Score: 1

      Dude did you read yesterdays book review? This one is so much better.

  43. Only a small step in the right direction by Frans+Faase · · Score: 1
    IMHO, the problem with all existing programming pradigmas is that they fail to separate specification from implementation. The whole software industry seems to be one big cycle of reinventing the wheel. We all seem to work with low-level programming languages that are good for programming implementations, but what we really need is a frame work for mapping specification to implementations in such a way that you can start with a declarative description of your "application" and then implement it by specifying how the "specification" should be mapped ("implemented") into an execution environment.

    In this sense aspect programming is only a small step in the right direction, which is Generative Programming.

    1. Re:Only a small step in the right direction by Anonymous Coward · · Score: 0

      That's what users do (if you're lucky). They declare their requirements, and the programmers generate the implementation.

      In a perfect world, we'd have computers to do all of the code generation for us. And at that point, your average programmer is out of a job. :) That'd be a great thing, really--when anybody in the world, no matter their technical skills, will be able to use their computers to the maximum potential, which you can only get by exploiting the nature of a computer as a reprogrammable machine.

      We'll have to wait for a good AI, though. More human than human, and all that. At which point, we may be obsolete, anyway.

  44. Hidden Horror Show by piobair · · Score: 4, Insightful

    I took a look at AspectJ awhile ago and instantly spotted the hidden horror show for implementation: There is no test you can write to assure your aspect was applied appropriately. (at least there wasn't when I looked). Apparently nobody sees this as an issue? The application of aspects is essentially a blind process before compilation occurs. The best you can do is place errors in your aspect and break the compile. I can't imagine turning this tool loose on a development organization.

    --
    I have a second sig, I call it sig#2.
  45. AOP is useful, but not well suited to Java by kahei · · Score: 2, Interesting


    I think the reason there are so many 'huh? why do I want to do all this?' responses is that Java is not a language that lends itself to AOP, and that AspectJ therefore has to build this scary layer of 'pointcuts' and so on on top of it.

    With a language that lets you assembly types dynamically, like Ruby or Perl, AOP is much simpler and more natural, so it's easier to get a feel for the benefits.

    In particular I think Ruby is well-suited, although you do lose some type safety. There is a package called AspectR available, although you *could* do it all youself with mixins and the like.

    --
    Whence? Hence. Whither? Thither.
  46. Perl? by Anonymous Coward · · Score: 0

    I agree, Lisp and Scheme support every language feature you can think of. But I think Larry Wall said it best: "Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."

    And he thinks Perl is an improvement?

  47. Not quite.. by varjag · · Score: 1

    Aspect Oriented programming is a brand new programming paradign, kinda of like the switch you made when going from functional programming to object oriented programming.

    Aspect-oriented programming is a castrated version of a moderately old reflective programming paradigm: Metaobject Protocols. I won't go into lengthy explanations of that; it is suffice to mention though that Kizales, the father of AOP, is coincidentially published a book called "The Art of Meta-Object Protocol" in early nineties, and that, say, Lisp programmers use MOP for about decade now. So AOP is just yet another toy replica for people in the sandbox :)

    --
    Lisp is the Tengwar of programming languages.
    1. Re:Not quite.. by mvw · · Score: 1
      Lisp programmers use MOP for about decade now. So AOP is just yet another toy replica for people in the sandbox :)

      Than this link might interest you.

      Regards,
      Marc

  48. Re:first post??????? by Anonymous Coward · · Score: 0

    Keep trying... you will succeed soon.

    Oh, and VEGANS SUCK. Seriously. No joke. They SUCK complelely.

  49. A dinosaur writes: by Chocolate+Teapot · · Score: 3, Insightful
    OK, I confess. I didn't even bother to read the article, and will probably be ridiculed for not being up-to-date with hot new technologies (AKA 'fads'). I just skimmed through Verity Stobs' story and groaned. It seems that every few months there emerges a new programming language/methodology. Maybe, instead of devoting so much time to inventing new tools, people should invest their energy into learning to use the existing stuff properly. I wonder how many peoples resumés are littered with long-dead languages that 'seemed cool at the time'.

    P.S. I don't dress fashionably either, prefering to save valuable beer money.

    --
    Modest doubt is called the beacon of the wise. - William Shakespeare
    1. Re:A dinosaur writes: by Anonymous Coward · · Score: 0

      Exactly my sentiment :^)

      Tomcat logging example is something OOP was supposed to prevent, OOP is no pancea. Good code written using traditional functional construct beats bad OO code anytime.

    2. Re:A dinosaur writes: by Anonymous Coward · · Score: 0

      Beer is a money sink! Save it for a faster-compiling computer. Just the other day, I was trying to compile a program which required 512 MB of memory to compile ONE file. I kid you not. The source was only like 40kb, so beats me.

      Anyway, you have to realize that slashdot posts these sort of new programming methodologies because it's what substitutes for real news. Just filter them up, well aware that you'll never use them. :)

    3. Re:A dinosaur writes: by Rimbo · · Score: 1

      The trouble is, Mr. Dinosaur, that sometimes behind these fads are some really good ideas.

      The really good idea behind OOP, for example, was that you have language-level support for adding functionality to code without having to insert a call into that code.

      The really good idea behind AOP is that if you need to make a module that is orthogonal to your existing functional decomposition, you can.

      It doesn't matter in academia, where you largely make everything from scratch, but in the real world where code survives for ages, techniques like these are extremely helpful.

    4. Re:A dinosaur writes: by Tablizer · · Score: 1

      The really good idea behind OOP, for example, was that you have language-level support for adding functionality to code without having to insert a call into that code.

      I would like to see a semi-realistic example of this. Past similar claimers made some rather silly assumptions about non-OO approaches to the same thing.

      Regarding hyped articles, I think the problem is that magazines which don't push the idea that newer == better don't get sponsers. Thus, there is a monetary-based bias toward hyping something just because it is new (or sold as new).

    5. Re:A dinosaur writes: by Rimbo · · Score: 1

      I would like to see a semi-realistic example of this.

      Try GUI programming sometime.

      Let's say the default action of a button is to send a "clicked" signal or callback whenever the mouse button is released. Let's say I want to make a button that only does that when it's double-clicked.

      An OO GUI framework buys me two things in this instance. First, I only have to re-implement the functionality I want to re-implement; by making a subclass of the basic button class, all other functions revert to the old implementation. So I won't have to re-write how the button is drawn for example.

      And all I have to do to use my new button is to declare the buttons in my dialog as being of this class. I don't have to add code into the windowing system itself to make a call to the new code; it recognizes that it's the new code because of widget's type.

      The goal of AOP is to take this a step further, to where I wouldn't even need to create objects of the new type -- I could just specify the new behavior for all buttons. But both of these are big advantages over purely procedural mechanisms.

    6. Re:A dinosaur writes: by Tablizer · · Score: 1

      GUI setups should be meta-data IMO, not app code.

      For example, if we had a table-oriented GUI, then we just add code or a code reference in the "double_click" cell of the event table. (Ideally the IDE would manage some of this for us.)

      As far as making a "new type" of button, IMO in the long wrong hierarchical subtyping falls apart. The real world does not change in a tree-shape over the longer run in my observation. Yes, some OO fans claim it *does* change in a tree-wise fashion, but they have never identified the force of nature (human or mother nature) that "herds" things into a tree shape. Until they identify this mysterious tree force, I will assume it does not exist.

      For example, what if you later wanted a new button to respond to both single click and double click. BOTHness tends to bust hierarchies, requiring more code shuffling.

      If you can form a "type" theory based on sets instead of trees, I might be more interested. The real world changes fit sets better than trees IMO. Until then, don't push artificial structures on me.

    7. Re:A dinosaur writes: by Rimbo · · Score: 1

      That's a fine prescription. When you find an employer who is willing to pay and wait for you to make your own GUI toolkit from scratch, that will be a terrific way to go.

      If you're strapped for time and need to focus on the functionality of your application, you're probably going to use one of the pre-existing GUI toolkits -- MFC, Qt, whatever. And you may need to get it to do things where the properties and messages provided by the widgets aren't enough. And then you'll need to do this. It happens all of the time, and every time I've had to write a GUI.

    8. Re:A dinosaur writes: by Tablizer · · Score: 1

      If you're strapped for time and need to focus on the functionality of your application, you're probably going to use one of the pre-existing GUI toolkits

      If you are saying that *existing* OO GUI toolkits are better than existing procedural GUI toolkits, I will probably agree with you. However, this is mostly because research and attention is focused on OO. IOW, self-fullfilling prophecy.

      But anyhow, I really want to see how OO helps business modeling, not GUI's. Dividing entities into subtypes is usually a bad idea IMO. (Even some OO fans agree.)

      (I still say the ideal GUI system would not be tied to any ONE particular language. There is no reason it has to be that I can find.)

    9. Re:A dinosaur writes: by Rimbo · · Score: 1

      Oh, I completely agree with you about OO usage in that respect. OO was a revolution; as with all revolutions, there was a lot of hype and hoopla that wasn't really relevant, and the business model aspect was, imho, all hype.

      On the other hand we don't want to go all the way to the opposite extreme and say that OO is completely hype, and ignore the one simple idea -- that of being able to change the way an piece of code behaves without having to rewrite it completely or changing its source -- indeed, without even having access to the source. This is a very important step towards making code with resuable components.

      We're not completely there yet, but AOP is yet another step in that direction, to where we just wire bits of existing functionality together without having to do a lot of extra work.

  50. Re:first post??????? by Anonymous Coward · · Score: 0

    Your opinion is baseless and stupid because I am right and if you disagree with me it is because you know nothing and are an idiot.

    paraphrased from the average slashdot post

  51. I bought it - its worthless! by NovaX · · Score: 3, Interesting

    I bought it back in january, after first learning about AOP. At the time, it was the only book I could find directly on AOP, with a second coming in feb. Otherwise, the only other text source I could find was Generitive Programming.

    So I bought it, and I was excited when I began reading. Then I found out it was just a bunch of JSP and other then the first 25 pages, very little content. Now I admit I put it down a good 25 or so pages later and skimmed through the rest, but I was extremely disapointed in it. Instead I've been grabbing all of the ECOOP workshop documentation.

    In the end, it was worth the money. No, not for the book, god no! But by getting me excited and reading the ACM Communication articles and then talking to my adviser about it. It turns out the editor for the AOP material in the ACM communications is a professor at my school, and even better is happy to let me help her out next semester (I'm extremely swamped now). So now I'm considering doing the thesis option on my masters. I'll spend the summer reading REAL material.

    My opinion: AOP is awesome but the book is a waste of money. Here are a few good readings:

    Alternatives to AOP
    Generitive Programming chapter
    AOP publication
    AOD 2002 workshop
    ECOOP97

    --

    "Open Source?" - Press any key to continue
    1. Re:I bought it - its worthless! by Anonymous Coward · · Score: 0

      Obviously, you haven't read it. I did and never saw anything about JSPs. I suppose you skipped everything just to read the AOP chapter. Too bad.

      It simply presents the current 'state of the art' of the generative programming field.

      You may or may not agree with the ideas presented, but some are definitely interesting.

      For C++ users, I must mention mixin-layers, although the included example isn't very good IMHO.

      See: http://www.cc.gatech.edu/%7Eyannis/tosem01.pdf

      Tom.

    2. Re:I bought it - its worthless! by NovaX · · Score: 1

      umm, what are you smoking? I just opened to a random page and its right infront of me. Page 69 talks about registration. Here's an example of code on that page:

      Listing 5.8 register.jsp
      ------------
      <html>
      <body>
      <%@ include file='header.jsp'%>
      h1>Please, register yourself!<h1>

      <form method=post action="register">
      User: <input type=text name"user"><bd>
      Password:<input type=password name="pass"><br>
      <input type=submit value=" register ">
      </form>

      <%# inlude file="footer.jsp">

      </body>
      </html>

      I wont put down the java serlet that is shown on p. 69-70. But the book uses his JSP example throughout.

      I plan on reading the entire book this summer, since I did pay for it. It shows you an example of how aspects can be used, and how to program with them. I simply wanted more information on AOP, rather then an introduction and code. For my tastes in books, I found it disappointing. Obviously the reviewer here loved it, and probably bought it for learning how to program using AOP rather then the details of AOP. That's exactly what its meant for! I bought it simply because it had AOP in the name - my mistake.

      That's why I posted some of the resourced I found, so someone else wouldn't make the same mistakes. Buy the book if you want to do a project in AspectJ, know AOP, and want a light example.

      --

      "Open Source?" - Press any key to continue
  52. Re:first post??????? by Anonymous Coward · · Score: 0

    Your opinion is baseless and stupid because I am right and if you disagree with me it is because you know nothing and are an idiot.

    paraphrased from the average slashdot post

  53. Re:first post??????? by Anonymous Coward · · Score: 0
    You said (and I quote):
    Your opinion is baseless and stupid because I am right and if you disagree with me it is because you know nothing and are an idiot.

    paraphrased from the average slashdot post
    I think you are wrong. You have no foundation for any of the above claims. You should agree with me now or you are insane. Clinically.
  54. emacs by tonys1110 · · Score: 1

    I had never heard of AOP before this article, but it does sound familiar. This is one of the ways existing (elisp) code in emacs can be modified (see elisp docs). I have found it to be a very nice way to quickly make small modifications to large pieces of existing code.

  55. fair enough. by Anonymous Coward · · Score: 0

    And you don't bring your standard libarary, okay?

    1. Re:fair enough. by Cranx · · Score: 1

      No...I get to bring my libraries. That's sort of one of OOP's most useful aspects, good library mechanisms. Suck it up, proceduralist. You get to bring vi and one compiler/interpreter of your choice. I'm coming with Scite and a Java VM. Let's race to the Google API.

    2. Re:fair enough. by Tablizer · · Score: 1

      Java's API's are your showpeice? You have got to be kidding. They look to me like they are ment to lock you onto Sun by intertangling a bunch of protocols instead of making them self-standing. IOW, they are a sales tool instead of something meant to boost production.

      Aside from GUI's and DB, my domain does not use a lot of libraries anyhow. Maybe occassional file and say FTP every now and then. That is not where you are going to rack up big points.

    3. Re:fair enough. by Cranx · · Score: 1

      Yes, that's my showpiece. No, wait, or was I talking about a simple contest in jest? Yes, that's it. No, wait, you challenged me and called Java my showpiece. I must puff up my chest and let you morph my words and this discussion and argue against you now! No, that would be moronic! But wait, I must argue! I'm so confused! I cannot continue this discussion, you win.

    4. Re:fair enough. by Tablizer · · Score: 1

      Aside from GUI's and DB, my domain does not use a lot of libraries anyhow.

      Correction: I use a lot of "small" library functions, like string manipulation, etc.

      Anyhow, I am really interested in seeing how OO does better business modeling. I don't really care that much whether infrastructure libraries are OO or not. It does not make a lot of difference IMO.

    5. Re:fair enough. by Cranx · · Score: 1

      The term is "Object Oriented" not "Object Constrained." You don't use OO to do data modeling or system modeling or even runway modeling. OO is a paradigm for programming. It's a way to connect to whatever your real-world paradigms are, to grab hold of them and make it easier to work with them. Not completely encapsulate and govern them. Oriented. Not leather-straps-and-buckles constrained. Oriented. You make your real-world data structured how you need it to be; whatever is easiest to develop, maintain and extend. If you want to form it into an OO shape because you see it that way, do so. If you can't see the data in an OO way, then just do it how you see it, then use OO where applicable to help you keep your code organized, clean and functioning well.

      Also, try getting your head out of that mode. You seem to be arguing against some fixed notion you have about OO. Just go try it for yourself.

    6. Re:fair enough. by Tablizer · · Score: 1

      The term is "Object Oriented" not "Object Constrained." You don't use OO to do data modeling or system modeling or even runway modeling. OO is a paradigm for programming. It's a way to....

      Every OO fan has their own definition and characterization. "OO is this, no OO is that!" This lack of consistency is one of its biggest problems.

      Just go try it for yourself.

      I have, and don't like the results. I don't see what is magic about OO. I try to get articulation, and I either get unsettling notions of future change patterns that I don't find realistic, or vauge feelings from OO fans.

    7. Re:fair enough. by Cranx · · Score: 1

      Most novices come right out of the gate thinking OO is supposed to characterize EVERYTHING on a project, and it's not. I think when people are new to OO, the introduction material tends to be of the nature "you must do everything as OO and your entire project must become one giant reusable framework than can adapt to merge automatically with any other system at the flick of your pinky." That's a bit naive. At best, a real OO framework is designed as a library, but any given project is generally not a library, it's a project, so you do much less OO in it. You set up OO frameworks where it makes sense, otherwise you go with whatever works.

      Really give OO a try. You have to get past those initial academic/purist notions to find out how it's really useful. Encapsulation can steady a project like magic. The rest of it is useful in certain places for certain reasons, but encapsulation is useful everywhere.

    8. Re:fair enough. by Anonymous Coward · · Score: 0

      I will believe it when I see a decent example from my domain.

    9. Re:fair enough. by Cranx · · Score: 1

      You're waiting for a saleperson to come along and pitch one to you? Now that's lazy. No wonder you can't handle OO.

    10. Re:fair enough. by Anonymous Coward · · Score: 0

      If you claim OOP is objectively better, then then burden is on you to show it. Don't sluff it off to me.

    11. Re:fair enough. by Cranx · · Score: 1

      No, I have no burden to show you anything. If you don't want to get off your butt and try it for yourself, that's up to you.

  56. Re:first post??????? by Anonymous Coward · · Score: 0

    Hundreds and hundreds of people are reading this right now... how can you waste their time like this with a clear consience?

    All I have to say is that your opinion is baseless and stupid because I am right and if you disagree with me it is because you know nothing and are an idiot.

  57. Hold on a minute here by NDPTAL85 · · Score: 1

    Lets not turn this into an anti-newbie IRC channel where "RTFM" is spouted in response to any question you don't like. If you didn't want to answer the guy you didn't have to post anything in response but telling him to google something before they post to Slashdot is a bit much.

    --
    Mac OS X and Windows XP working side by side to fight back the night.
    1. Re:Hold on a minute here by ClosedSource · · Score: 1

      You're right. I wish anyone who is tempted to say "RTFM", read the FAQ, or google it would just remain quiet and move on. Chances are they didn't know the answer anyway.

    2. Re:Hold on a minute here by Minna+Kirai · · Score: 1

      Your name almost looks like the guy on #debian who argued about RTFM last night...

  58. Re:first post??????? by Anonymous Coward · · Score: 0

    Break the cycle, don't reply!!!


    Your opinion is baseless and stupid because I am right and if you disagree with me it is because you know nothing and are an idiot.

    paraphrased from the average slashdot post

  59. Some thoughts from somebody who's using the tech by Anonymous Coward · · Score: 3, Insightful
    1. Yes, it's powerful. Very, very powerful. Using Aspects, you can now centralize code that you would have had to manually put at the beginning and/or end of each method in class X, or each method Y in class X, or each method Y in classes X and Z, or whatever. Used properly, damn straight this makes your code more maintainable. However . . .
    2. The abuse potential is breathtaking. Most conspicuously, it introduces a ton of ambiguity to what's getting executed when. When tracing code execution, it's no longer adequate to simply follow what methods get called when; you now have to check to see if any of your Aspect classes are poking their fingers in anywhere. Which is a problem because . . .
    3. Figuring out what Aspects get executed when is not a trivial concern. You can definitely wind up with Aspects executing in places you don't expect, or ignoring places you think they should hit, just because there's some element to their behavior you don't quite understand perfectly.

    In short, used judiciously, this is a very, very handy tool. Used indiscriminately, this is an utter fscking nightmare. And anybody who lets the project's junior-level coders work with this should be taken out back and shot. Repeatedly.

  60. Re:first post??????? by Anonymous Coward · · Score: 0

    In soviet russia, the cycle breaks you...

    Ironically, that is a truthtitude.

  61. Re:first post??????? by Anonymous Coward · · Score: 0

    You breaks cycle the, russia soviet in.

    Truthtitude a is that, ironically.

    Hot petrified beowulf cluster natalie "grits" portman ???? profit.

  62. Breaking encapsulation by infinite+undo · · Score: 2, Interesting

    Modularity, encapsulation, separation of concerns or whatever you want to call it is still a good idea.

    Aspect Oriented Programming claims to support a new kind of modularity, but what it really does is break encapsulation.

    Imagine you're responsible for a module in a big system. Over the years, well meaning aspect oriented programmers stick more and more little hooks into your code. Eventually like Gulliver, when you try to move, e.g. fix or improve your code, you simply can't without breaking the hooks that tie you down.

    If they had used your published interface and you designed a good interface, you would have been ok, but no! They reached into your code and created dependences on your implementation. If it's production code and you break someone else's code, you'll be seen as the bad guy.

    Many years ago I used Xerox Lisp machines and worked near the inventors of Aspect Oriented Programming. I used two precursors of AOP. I used the advice mechanism in InterlispD and later Active Values in it's object oriented extension Loops.

    When used very sparingly, advice was useful, especially for debugging and working around bugs. The advise function allowed you to add wrappers to functions that would replace, preceed or follow the invocation of the function. You could further restrict the advice to apply only when a function was called from within another function.

    Active Values, on the other hand, were an advice mechanism applied to object field access. People quickly realized that the facility was a mess because there was rarely any hope that you could get your advice to run *only* when you wanted it to and rarely any hope that you could avoid a unreadable tangled mess. There were new getter and setter functions that didn't trigger the active values, but this just added even more complexity.

    It would be much easier to design an explict hooks than to worry about what happens if someone sticks an active value in any and every object field. Especially when the field may already have an active value.

    It's vital to be able to assume that when you read a line of code, you know what it means and if not, you know where to look up what it means. Rather than enabling hacks like aspect oriented programming, we need better tools for making clean changes that sweep across the source code and thereby do away with the urge for this perilous patching stratgy.

    1. Re:Breaking encapsulation by mvw · · Score: 1
      Imagine you're responsible for a module in a big system. Over the years, well meaning aspect oriented programmers stick more and more little hooks into your code. Eventually like Gulliver, when you try to move, e.g. fix or improve your code, you simply can't without breaking the hooks that tie you down.

      Not if you buy Irrational's SuperStitchItTogether (TM), a superb visual tool, that will draw impressive maps of the control flow of AOP projects which will make colleagues and visitors bow in awe once you printed them out and put them on the walls of your office. It offers reverse, forward, up and down engineering with roundtrip to Hawaii as well.

      Regards,
      Marc

  63. Re:Quite upset Ivan is getting this publicity by Anonymous Coward · · Score: 0

    I never realized this sleaze had this power! :o

  64. good luck... by Anonymous Coward · · Score: 0
    ....getting that to work in Java. I'm pretty sure the compiler won't know WTF you're talking about when you point it at a .h file. Or any file with #define in it, even. And there's no way #ifdef is going to fly either. Not everyone works in/likes C and C++.

    is it warm down there in your little shell?

  65. Re:first post??????? by Anonymous Coward · · Score: 0
    Hey there my friend, If you're celebrating a holiday - Happy holiday to you and yours. Hope this fins you in good health and spirits, Which brings me to the topic of this message - I was lucky enough to capture the light reflecting from A few spiritual beings And I'm glad to reflect it to you through my web site But before you go there, I'de like you to remember that Each of the 3 pages has 6 images (I made them large this time so you'll need to scroll) And that you can click on each image to see it Separately - if you wish. What I know of the human experience is That although we usually can't see , touch or Scientifically measure the spiritual world, It has much more influence on us humans Than the material world And as such, is more significant to us Than the material world. Hence, if we pay attention to it, learn it And how to work with it, The quality of our lives has more potential for Growth. Enjoy
  66. Dear Verity by judd · · Score: 1

    Yes, I got the classical allusion at the beginning.

    Will you marry me?

  67. More on AOP by RedWolves2 · · Score: 1

    I found more information on AOP here.

    "Aspect-oriented software development is a new technology for separation of concerns (SOC) in software development. The techniques of AOSD make it possible to modularize crosscutting aspects of a system.

    Like objects, aspects may arise at any stage of the software lifecycle, including requirements specification, design, implementation, etc. Common examples of crosscutting aspects are design or architectural constraints, systemic properties or behaviors (e.g., logging and error recovery), and features.

    Researchers in AOSD are largely driven by the fundamental goal of better separation of concerns. So while crosscutting tends to be a significant focus of their work, they also incorporate other kinds of SOC techniques, including such well established approaches as OO and good old-fashioned structured programming. This is reflected in the way much of the work in the field blends support for many different kinds of modularity including block structure, object structure, inheritance as well as crosscutting."

  68. Whatever by Anonymous Coward · · Score: 0

    AOP seems likes yet another over-hyped way of programming. I read about AOP and nothing jumps out at me why I really need to use this in my work. The average "Joe Coder" does not care for this crap; he has to get real work done.

  69. This is useful most everywhere? by medscaper · · Score: 1
    It sounds to me like the main selling points of AOP are that you don't have to design things well in the first place, because if you missed something, well then you can change how your objects behave without redesigning them.

    Just out of curiosity...isn't this a "Good Thing"(tm)?

    I mean, where I work, we've got 25+ year-old legacy code that is at the heart of our stuff, and it gets built on each year. Because of expanding features, new products, etc., we rely on the fact that we also have legacy programmers here that understand it.

    If we had the time and money to re-architect/re-design/re-code each release, we'd be in hog heaven when it comes to having a great opportunity to "design things well in the first place", because we could. But something designed well in the first place can't POSSIBLY make up for future enhancements and even really core code changes, because if you had the time to do such a good job in the first place, you usually lost money and went out of business. The attitude (and I don't support this, but it seems true) is "Make it work now, make it work better later" so that money can be made. Then, later really never rolls around, and it's ALWAYS there looming in the distance.

    So, this seems like a great idea, to me.

    --
    Any sufficiently well-organized Government is indistinguishable from bullshit.
  70. I hate aspect oriented programming... by Mysticalfruit · · Score: 3, Funny

    I work my ass off and write a program and when I send it to my boss he's always sitting infront of his monitor at a different angle and it looks and works totally different.

    --
    Yes Francis, the world has gone crazy.
    1. Re:I hate aspect oriented programming... by istartedi · · Score: 1

      And thats when you get your "ass pecked".

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  71. Debugging AOP? by radtea · · Score: 2, Insightful

    Aspect-oriented programming has been talked about for a while now, but it still isn't nearly ready for prime time. The obvious issues are that it will introduce bugs and that it will be at the same time very hard to debug.

    The first goes without saying: every new technique can be considered a collection of novel ways that things can go wrong. Insofar as AOP is powerful, it will create whole new classes of bugs.

    Things like AspectJ make things worse, though, because they are pre-processors. So debugging is going to involve tracing into machine-generated code. This does not need to be a nightmare, but somehow it almost always is.

    There is also the issue of debugging your aspect specifications themselves, alluded to briefly in the article with the point about infinite recursion. I'm sure there are many other subtle and interesting bugs that AOP can introduce, and I'm very grateful to all the eager souls who are going to find and fix them over the next few years.

    I think AOP solves a legitimate problem. I'm not by any means sure it's the best solution. In a few more years, when tools and techinques have matured a little, it may prove to be a valuable technique.

    --Tom

    --
    Blasphemy is a human right. Blasphemophobia kills.
    1. Re: Debugging AOP? by Black+Parrot · · Score: 1


      > The obvious issues are that it will introduce bugs and that it will be at the same time very hard to debug.

      Yes, I'm trying to imagine what a big application is going to look like a couple of years after it has been released, when it has collected a couple of years' worth of AO "quick fixes" for bugs and new feature requests.

      I'm not trying very hard to imagine it, because I really don't think it's something I want to see. Let alone maintain. Another popular "write only" programming paradigm that makes something incredibly easy for me now and incredibly difficult for someone else later. Fine and dandy, until it's my turn to be the someone else.

      But it makes a refreshing change to the buzzword landscape. Or rather, it did for the first 100 times I heard it hyped up.

      --
      Sheesh, evil *and* a jerk. -- Jade
  72. Re:first post??????? by Anonymous Coward · · Score: 0

    Doh.

  73. AOP in C++ by thedigitalbean · · Score: 2, Informative

    For those of you who are C++ programers and would like to see Aspects in C++ check out:

    aspectc.org

    They are at revision 0.6 but they do provide many of the useful features in AOP. My one beef is that they don't provide the ability to specify aspects based on the 'const-ness' of a function, but hey its only 0.6 and they have a way to go before 1.0

  74. (ot) Re:Yet another reason to switch to Lisp by antifuchs · · Score: 1
    Isn't there a joke out there about how some "top-secret" Department of Defense code got accidently released to the public?

    Now that you're asking, no, there isn't.

    --
    this post was brought to you by Andreas Fuchs.
    echo [Address] | sed s/[-a-z]//g | tr A-Z a-z
  75. Re:Some thoughts from somebody who's using the tec by Anonymous Coward · · Score: 0

    Object oriented code can be hard to follow for similar reasons. Operator overloading and implicit constructor calls combined with user defined types can make it tough to know what objects are invoked and where.

  76. Why is the number 1 not an object? by Merk · · Score: 2, Informative

    In Ruby:
    1.times { puts "Hello World!" }

    Now there are other ways of doing that that are almost as readable and almost as useful but isn't that neat? What makes treating everything as an object even more useful is that you can treat everything the same way. You can always say obj.inspect and get something useful out of it. This is great when you're debugging something and wonder: "What the heck is this function returning?", whether it's an integer, a hash or a complex object, object.inspect will always work.

    Java makes things confusing by having both primitive types (int) and object types (Integer), because in some situations you want to be dealing with an object, but the language isn't flexible enough to let you treat the object form of an Integer the same way you would a primitive int.

    What I think makes Ruby so cool is that essentially everything in Ruby is, or can be an object, but it doesn't get in the way.

    I agree that languages that are inflexible can be rough because they limit your options, but how is treating everything like an object inflexible?

    1. Re:Why is the number 1 not an object? by kfg · · Score: 1

      Hi, I knew as I was typing the above that you'd show up sooner or later. Glad to have you aboard, but. . .

      ". . . but how is treating *everything* like an object *inflexible*?"

      I'm totally buffaloed as to how to respond to the above statement. (Emphasis obviously added by myself).

      KFG

    2. Re:Why is the number 1 not an object? by xenocide2 · · Score: 1

      You know, you don't need objects to get polymorphism. And in statically checked languages like ML you get to know what the function is returning.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    3. Re:Why is the number 1 not an object? by Anonymous Coward · · Score: 0

      Neither SML nor CAML have ad-hoc polymorphism. Now Haskell...

  77. Technical Mistake by Anonymous Coward · · Score: 0

    you would have to write your code like so :

    when (!strcmp(time, "morning")) ...

    and what language are you coming from when you uppercase everything in WouldYouBeSoKindAsTo()? It should be would_you_be_so_kind_as_to() or simply:
    void please(void * callback) { *(callback)(); }

  78. Re:Overlooked macros for C by ReelOddeeo · · Score: 1

    There are also a few overlooked optimization macros that could be used in C.

    Just slip these into your header file and smoke it....

    #define struct union // saves memory
    #define while if // saves cpu time

    --

    Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
  79. Similar to C# Attributes??? by estoll · · Score: 1

    Aspects sound like they are similar to Attributes in C#

    --
    http://www.askthevoid.com
  80. Flamebait? by Chocolate+Teapot · · Score: 1

    Uh oh! A Fortran programmer with mod points. That's a dangereous combination!

    --
    Modest doubt is called the beacon of the wise. - William Shakespeare
  81. "comefrom" makes a comeback! by Anonymous Coward · · Score: 0

    Intercal, an old joke language, did Dijkstra one better with its innovative "comefrom" statement.

    AOP is to "comefrom" as function calls are to gotos - it's certainly an improvement. But...

  82. Even perl. by fizbin · · Score: 1

    I think the point is that, after looking at large chunks of lisp code, even perl is an improvement.

  83. Why it's useful by Coppit · · Score: 1
    Many people claim that AOP is just another way to break encapsulation. The point here is that for nontrivial systems, there is no good decomposition. You see, if you try to encapsulate one thing better, it forces you to expose other things. Or, if you encapsulate every little concern, then your module integration is a mess.

    Just think about support for tracing the execution of your program. Many applications support multiple levels of verbosity, and perhaps logging facilities. But this is largely orthogonal to the overt functionality of the system. If you tried to encapsulate tracing, you'd end up having to compromise the overall modularity.

  84. It's an OO form of "come from" by Anonymous Coward · · Score: 0

    What OO calls are to regular function calls, aspect hooks are to the infamous "come from" statement.

    Wow. I can see how this could make incredibly nasty code. On the other hand, it does model what a lot of programming is all about: adding more hooks to existing systems.

  85. Why LISP is not mainstream... by irritating+environme · · Score: 2, Interesting

    LISP programs are practically always unreadable. If it's unreadable, it's unmaintainable. Look at how all algorithms are laid out in CS books: that's structured programming. They certainly don't do a step, and then have you turn to another page to do the next step, and turn to another page to do the next step.

    (tail (make (get (blah (foo()), bar())))))

    In the end, this lang vs. that lang is "fundamentally superior" is all bullshit since practically all languages are Turing equivalent, so practical acceptance comes down to ease of learning, readability, API and platform support, speed, and sensible amounts of syntactic sugar.

    Java does all those things pretty well. LISP had 50 years to gain acceptance, and it hasn't. It has had numerous evangelizers, even whole tech startups, and all for naught.

    --


    Hey, I'm just your average shit and piss factory.
  86. I am also excited but... by s88 · · Score: 1

    from what I have read about it and how it works, I think think the indirection it adds may create some bugs which are very difficult to track down.

    I suppose I agree with one of the main axioms, which states it is inevitable that a properly deisgned OO program will have some methods which are scattered throughout many classes. What I have not been convinced of, is that good design is not sufficent to minimize these to a level at which they are more easily managed by "cross-cutting" than good refatoring tools and practices.

    Anyone have 2 cents?

    Scott

    1. Re:I am also excited but... by ebyrob · · Score: 1

      Ya, tracing and debugging.

      If these are going to include non-trivial information gathering and reporting in every object in the system, they are going to cause this "scattered code" no matter what kind of refactoring you use.

  87. You don't get out much, do you? by Chocolate+Teapot · · Score: 1
    Beer is a money sink! Save it for a faster-compiling computer
    Tut tut tut. Take a hint from an old pro, sonny. Turn off the computer and leave it turned off. If you like compiling code that much, go and find a job where not only will they pay you to persue your interest, but they will supply some decent kit to do so. With the cash you save on the computer, you can have a life.
    --
    Modest doubt is called the beacon of the wise. - William Shakespeare
  88. Where did you learn Lisp? by Anonymous Coward · · Score: 0

    (5 256 "Item" "Description") represents your base data type.

    Hmm, the Java version of this would be:

    x = new Object[] {
    new Integer(5),
    new Integer(256),
    "Item",
    "Description"
    };

    Does anybody actually write code like this?

    Sure, if you ignore all the features of Lisp, it's not going to be pretty, or easy to maintain. Replace "Lisp" with the name of any other language in that sentence and it's be equally true.

    Your "data morph issues" sound like "what happens if you don't use structs". If you don't use structs in C/C++, your code will be just as bad. Lisp has weaknesses, but this is not one of them.

    Go learn about defstruct. Then you'll be writing Lisp code that's at least as powerful as C.

  89. There is a big difference between should and does by ebyrob · · Score: 1

    This is a difference that can only be determined by going in and looking at the code that *actually controls your application*. Wherever it may reside.

    Especially in a world of runtime AOP, it's not possible for you to really have a reliable answer.

    Does this also imply that in certain situations it is not possible to have reliable behaviour?

    I guess I'm just a cynic when it comes to *good* practices...

    "Evil will always triumph because good is dumb."
    -Lord Dark Helmet.

  90. What is it with this intellectual snobbery... by ebyrob · · Score: 1

    it's a great tool until you get some inexperienced programmer who just knows how to program functionally, and thus doesn't use the advantages of aspect oriented programming

    I suppose this is in contrast to an AOP or OOP programmer who can't write procedural code to save their lives? (And hence write applications with unpredictable behavior and terrible performance)

    Every programmer needs a certain level of knowledge and expertise. Some do a better job than others at making sure they aquire this before "doing something stupid". Just as some working environments are more conducive than others to being able to avoid "doing something stupid". It's the lack of documentation and proper training as often as individual programmers that are at fault in these situations. All programmers in critical roles need to realize their training and leadership responsibilities as well as their technical ones...

    It would sure be nice if the bigotry could be left out of these discussions. Becoming an excellent functional, AOP, or OOP programmer even in lack of other skills is a non-trivial task. Excellence in any area is valuable, just as a strong foundation in all areas is important.

  91. very good by Anonymous Coward · · Score: 0

    first step toward enlightenment is to admit YOU FAIL IT, asshopper.

  92. Here is what it is: by Rimbo · · Score: 2, Informative

    I had a chance to read about AOP a few years ago, when it was first being introduced.

    Short answer: Yes, it is the Next Big Thing.

    In the same sort of way that procedures were already implemented by experienced programmers long before languages like Pascal came to be,

    In the same sort of way that experienced programmers used virtual function lookup tables and information hiding before OOP came about,

    So is AOP. It is program-language-level support for the sorts of things experienced programmers do already... namely, code generation and automatic code modification.

    Basically the reason OOP came about was that there was no means to add functionality to code without going into that code and inserting a call to the new functionality. Experienced programmers made virtual functions and lookup tables to solve this issue, but obviously this sort of code is complex and prone to error. So OOP brought forth program-language-level support for this sort of feature.

    The problem that AOP addresses is this: As powerful as OOP is, it still relies on functional decomposition. The trouble is, sometimes one thing changes that cuts across functional boundaries. For example, the performance of an application, when ported to a new system, may need an entirely different set of performance tuning for the new app. Or more likely, you simply didn't see some aspect (there's that word) of your code changing often, and it would be impossible to separate it into a module without restructuring your entire code.

    Now you can do a lot of inline #ifdef's and the like to do this by hand. Or, you can use some sort of dynamic code generation. But writing a dynamic code generator by hand is, like the virtual function table example above, tricky and always ad hoc.

    The ultimate goal behind AOP is to make code generation generalized and done at the language level. So that you can modify things that occur across the boundaries of the existing functional decomposition.

    Does that make any sense?

  93. COME FROM by Anonymous Coward · · Score: 0

    So a person can create a function which will be automatically called whenever some other set of 3 different functions is called, without having to go modify each one

    It's the COME FROM statement! Intercal has had this for years!

  94. Re:There is a big difference between should and do by Caoch93 · · Score: 1
    This is a difference that can only be determined by going in and looking at the code that *actually controls your application*. Wherever it may reside.

    In the case of AOP, the "control" of the application is distributed among several different concerns. When a pointcut is reached, many different "interceptors" or "advisors" get a shot at the context of this pointcut and may perform various operations on it. Depending on how AOP is implemented in this case, the advisors may or may not be able to actually alter the data flowing in and out of the pointcut. It's relative to the way your AOP is being done. In the case of AspectJ, if you want to know how your code behaves, you read your source code. In a more dynamic environment...say...the Interceptor stack in JBoss, you look in a config file and find out what's wrapping your application logic. If you're so inclined, you can then look up the source code of your interceptors. To be completely honest, you have about as much ability to know what's going on as you do anywhere else- things are just organized differently.

    Does this also imply that in certain situations it is not possible to have reliable behaviour?

    Sure. Here's one situation- a member on your team writes an interceptor that intercepts some other method call and scrambles the data entering the pointcut, then applies this interceptor to points of execution in the program. Even then, though, the behavior is reliable. Why? Because it's doing exactly what it's supposed to do- it's applying someone's destructive interceptor before executing a bit of code. In my opinion, someone who would actually do this to a project is also the same someone who probably would undocumentedly scramble a struct passed by pointer into a function or overload operators so that his code could look more like a game of Yahtzee.

    I guess I'm just a cynic when it comes to *good* practices...

    To me, it's not a simple matter of good practice. Your basic business/application logic developer isn't going to be writing and applying aspects. Instead, s/he just writes application logic, and your security expert writes a security subsystem, then applies it over the top of everyone's business logic.

    This isn't some everyday programming trick. It's designed for managing complexity and separation of concerns in large projects. To use the example of JBoss again, which is on a big AOP kick, the point is that an EJB developer just writes and EJB...the JBoss server then applies interceptors over it so that it has transaction support, caching, can be replicated across nodes of a cluster, etc.

    So, your average programmer isn't going to just pointcut everyone else willy-nilly. In fact, your average programmer is never even supposed to know s/he's being pointcut.

  95. For example squirrelmail plugins. by Vrihad+Shoonya · · Score: 1

    I find this is just a programming paradigm not dependent on any programming language. As you can do object oriented programming in C, you can do aspect oriented one in languages other than Java or C++. An excellent example of this implemented in PHP is Squirrelmail plugin architecture. It provides so many hooks for plugin developers that you can do amazing things with mail headers, body, addressbooks etc.

    The unclarity of code will always remain a problem for maintainers, as suggested by Minna Kirai.

  96. Re:Portable.NET uses AOP for the C# compiler: tree by Anonymous Coward · · Score: 0

    The text you quoted is a good example of why OO is an inconvenient development method for compilers and similar tools.

    Anyone writing a compiler for anything should have experience with implementing one using an ML-like language. People insisting on OO for everything, using Java or C# and quoting "design patterns" are not likely to have that kind of experience.

  97. Re:Hasn't CLOS had this sort of thing (15 years ag by sql*kitten · · Score: 2, Interesting

    If I remember correctly, in CLOS you can specify a method "foo", and then another method "foo" with the ":before" modifier that would be executed before the normal "foo" method. There is also an ":after" specifier.

    Yes, and relational databases have had trigger methods before and after different SQL operations. You can define 12 triggers on a table in Oracle, made out of combinations of (before, after) (insert, update, delete) (for each row, for each statement). You code them in PL/SQL which is a fairly comprehensive language similar to Ada. Is AOP merely triggers for Java methods? Because you could do that already, by subclassing, overriding the method, and calling the superclass method within your own code.

  98. Re: Logging in C++ by some+guy+I+know · · Score: 1
    Making the logging stuff into a class can be even less intrusive and more versatile:
    // In "logger.h++":
    class logger
    {
    private:
    char* name;
    public:
    logger(const char* s) : name(s)
    { clog << "Entering " << s << '\n'; }
    ~logger() { clog << "Leaving " << name << '\n'; }
    ostream& operator<< (const char* s)
    { return clog << name << ': ' << s << '\n'; }
    };

    class null_out
    {
    null_out& operator<<(short n) { return *this; }
    //...
    };
    null_out null_clog;
    class null_logger
    {
    public:
    null_logger(const char* s) {}
    null_out& operator<< (const char* s)
    { return null_clog; }
    }

    // In "sound.c++":
    #if LOG_SOUND
    class play_logger : logger {};
    #else
    class play_logger : nologger {};
    #endif
    //...
    Sound::Play()
    {
    play_logger log("Sound::Play");
    //...
    log << "The new value is " << ++i;
    //...
    }
    Note that with this method:
    1. A log message is printed when the function is entered, and when it exits (whether normally or by exception).
    2. The function name is printed before each debug line.
    3. The compiler should optimize out the "log" variable if debugging is turned off, but leave the "side effects" (e.g., "++i" in the above example).

    You can enhance the logger class to indent when entering a function and outdent when leaving it, thus showing the level of the call stack (among the traced functions).

    (Note: I typed this in off the top of my head, so there may be typos of which I am unaware.
    Also, slashdot is not indenting the "//..." lines for some reason.)
    --
    Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
  99. Re:Hasn't CLOS had this sort of thing (15 years ag by Anonymous Coward · · Score: 0

    AOP is user-defined method combination - a bit like ":before" and ":after" and ":around" in CLOS, but user-defined (like CLOS with MOP).

    Really it's a buzzword used by Kizcales (sp?)to introduce a significant fraction of the potential power of Lisp CLOS and MOP (which he also designed) to the minds of programmers of "lesser" languages. Bit like XML introduces a significant fraction of Lisp SEXPs to other languages, but makes it seem a bit more laborious so you can pretend to be doing hard work :-)

    Also, a large library of pre-defined aspects is presumably a goal. Just as the strength of Java is mainly in its standard libraries, not it's mediocre language, a large set of standardised aspects would be better than sitting down with MOP and writing them yourself from scratch, even if CLOS/MOP is ultimately more powerful.

  100. Re: Logging in C++ by Minna+Kirai · · Score: 1

    That's a fun method. I don't see how it would work if things like "endl" were injected into the stream (or other functions/constants which return an ostream), but you probably just omitted that kind of detail. However

    3. The compiler should optimize out the "log" variable if debugging is turned off, but leave the "side effects" (e.g., "++i" in the above example).

    An interesting technique, and I see it offers protection against someone accidently changing program behavior when log outputters have side effects. But, they shouldn't be doing that.

    Depending on side effects is sometimes a bad idea- especially if those side effects occur in a line that is primarily user-visible output. Suppose a someone decides the log doesn't need to show the value of "i" anymore. He's got to move the ++i somewhere else.

    If the ++i is needed for the function to be correct, I really think it should be kept away from the logging message. (There remains a moderate chance that a person pursuing a bug will want to see the log output from some functions, but not all of them, and will just throw "//" in front of those messages he doesn't want. Then the side-effect is gone again)

    As far as "compilers should optimize it out": many C++ compilers optimize less than it seems they should, especially if the classes are in separate object files. Keeping logger in a h++ file avoids that, and hopefully the compiler will notice when it is by inlining an identity function and remove it completely.

    About the only thing it might not optimize is the 1-4 bytes of extra stack used for the play_logger in each function. (Even though the object has no members, it still needs some space, if methods will be called on it). That won't matter to anyone with a "real" computer.

  101. For good reason... by danro · · Score: 1

    Their new guildline for variable-naming in .NET is to not use variable type notation.

    Doing otherwise would be braindead, dotNET is all about OOP if I'm not mistaken.
    So, as soon as you cast or convert a hungarian-notation-compliant reference it would be lying about it's objekt.
    Hello confusion!
    Imagine the horror of maintaining that code.

    Anyway, I am sure a lot of prople coming from VB backgrounds and not groking OOP will make this very mistake.
    I pity the one that has to maintain the crud they will produce...

    --

    "First lesson," Jon said. "Stick them with the pointy end."
  102. Re:.. or at the risk of flame-baiting.. by Anonymous Coward · · Score: 0

    Thank you for the -1! Ah, how sweet to be an anonymous coward!