So, to continue our discussion a bit on Groovy categories, here's what GinA has to say about when to use (some of these we actually touched on last night):
- Incomplete Libraries
- To provide special purpose methods (the example they use is a StringCalculator that overrides a calculate method specifically for handling strings as opposed to integers) - To provide a collection of methods on different receivers that work in combination - for example, a new encryptedWrite method on java.io.OutputStream and decryptedRead on java.io.InputStream
- Where you would normally use a Decorator pattern
- to split an overly large class into a core class and multiple aspect categories that are used with the core class as needed. Note that use() can take any number of Category classes.

And I also talked about importing libraries/classes with the "as" keyword, here's an example:
import java.awt.BorderLayout as BL

-warner

Warner Onstine - Programmer/Author
New book! Tapestry 101 available at http://sourcebeat.com/books/ tapestrylive.html
[EMAIL PROTECTED]
http://warneronstine.com/blog




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to