Is this a Facade ?

Hello friends,

Should I say that the Manager acts as a Facade ?

publicclass A

{

publicvoid methodInClassA()

{

}

}

publicclass B

{

publicvoid methodInClassB()

{

}

}

publicclass Manager

{

privatefinal A a;

privatefinal B b;

public Manager()

{

a =new A();

b =new B();

}

publicstaticvoid main(String args[])

{

Manager manager =new Manager();

manager.execute();

}

publicvoid execute()

{

a.methodInClassA();

b.methodInClassB();

}

}

Thanks in advance.

[1860 byte] By [SrikanthBasa] at [2007-10-2 19:50:39]
# 1

I don't think so. a facade makes an API or a set of related objects easier to use. since the "API" in this example is just a couple of void methods, with no parameters, you're not simplifying anything, merely cutting down on keystrokes to invoke those methods; even then, the overhead in creating the Manager class outweighs those keystrokes. but a facade is not about cutting down keystrokes

also, since there is no apparent relationship between classes A and B, we can't really consider their respective methods to constitute an API

georgemca at 2007-7-13 22:29:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

You should think of OO terms more artfully than scientifically. You may call it a facade if you wish. If that is what you designed it to be. It helps to communicate the intent. its rather simplistic and not very useful as a facade IMHO. nevertheless, if that was your intent, then yes, you may call it a facade.

_dnoyeBa at 2007-7-13 22:29:36 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
You may just as easily call it an adapter.
_dnoyeBa at 2007-7-13 22:29:36 > top of Java-index,Other Topics,Patterns & OO Design...