Public · Protected · Private
Facade
Type: Public  |  Created: 2008-03-30  |  Frozen: Yes
« Previous Public Blog Next Public Blog »
Comments
  • class SubSystemOne { public void MethodOne() { Console.WriteLine(" SubSystemOne Method"); } } // Subsystem ClassB" class SubSystemTwo { public void MethodTwo() { Console.WriteLine(" SubSystemTwo Method"); } } // Subsystem ClassC" class SubSystemThree { public void MethodThree() { Console.WriteLine(" SubSystemThree Method"); } } // Subsystem ClassD" class SubSystemFour { public void MethodFour() { Console.WriteLine(" SubSystemFour Method"); } }
    2008-07-15 20:42
  • class Facade { SubSystemOne one; SubSystemTwo two; SubSystemThree three; SubSystemFour four; public Facade() { one = new SubSystemOne(); two = new SubSystemTwo(); three = new SubSystemThree(); four = new SubSystemFour(); } public void MethodA() { Console.WriteLine("\nMethodA() ---- "); one.MethodOne(); two.MethodTwo(); four.MethodFour(); } public void MethodB() { Console.WriteLine("\nMethodB() ---- "); two.MethodTwo(); three.MethodThree(); } }
    2008-07-15 20:42
  • This is an irresistable pattern for many developers. This is like a mashup of web 2.0 APIs. Use some class to zipcode of a given city Use some class to get weather data of a given zipcode Use some class to convert temperature from C to F .... SO ON But do you see a burden of loading so many Loaded objects into a single class? If you are using static methods of the subsystems -- Yo are doing Great!! Otherwise.. Caution with your memory.
    2008-07-15 20:47
This blog is frozen. No new comments or edits allowed.