aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Some Terminology Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Some Terminology" Watch "Some Terminology" New topic
Author

Some Terminology

Vummidi Satya
Greenhorn

Joined: Aug 06, 2007
Posts: 7

Any one can give the meaning of Following Terminology
1.Factory Methods
2. Light Weight Component
3.Decorator Class
4. Functor
Thanks in advance for any help
------------------
-SaTyA-
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20532
    ∞

I'm gonna move this thread to the patterns forum where more people will see it.


permaculture Wood Burning Stoves 2.0 - 4-DVD set
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20532
    ∞

These are some BIG questions in a very small package.
A Factory Method is described in the GoF (Gang of Four) book. The method takes some parameters and returns an interface (or abstract class). The idea is that depending on the data that is passed in, objects of different class types are returned, although they must all implement the interface (or inherit the abstract class).
Light Weight Components: AWT is an example of heavy weight components - each AWT component is reliant on the underlying operating system for implementation. Swing is an example of lightweight components - each Swing component is made out of basic paint routines and events within Java and does not depend on the underlying operating system to specifically implement this component.
A Decorator Class (GoF) will provide the same interface as the class that is being decorated, but it will usually add some enhancement. A decorator class usually does not inherit what it decorates, rather, it contains what it decorates.
Functor is new to me, but I found a reference in the GoF book. Something about "objects that are functions". Apparently some guy named "Coplien" thought it up.
Doug Gschwind
Ranch Hand

Joined: Dec 17, 1998
Posts: 44
I have not heard of the use of functors in the Java arena. I had heard of it in the C++ arena, primarily for dispatching a callback to a member function.
Typically, C++ callbacks require a static member function to be used as the static binding mechanism is required. You can of course dispatch a callback to a member function, a non-static member function, but this requires you write some tricky code which is your functor implementation.
I conceptually view a functor as a function pointer that allows the developer the ability to dispatch a callback to a non-static member function. A functor is not a function pointer in reality though.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"Coplien" is Jim Coplien (http://student.vub.ac.be/~jcoplien/)
From Http://www.astray.com/dabot/ (a clever and useful source of info). I asked it "What is a Functor", it replied:
In category theory, a functor F is an operator on types. F
is also considered to be a polymorphic operator on functions
with the type
F : (a -> b) -> (F a -> F b).
Functors are a generalisation of the function "map". The
type operator in this case takes a type T and returns type
"list of T". The map function takes a function and applies it
to each element of a list.
(07 Feb 1995)

Does this help?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some Terminology