Facade in VB.NET
A single class that represents an entire subsystem
ReturnProvide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use. Facade pattern provides a simplified and uniform interface to a large subsystem of classes.
Please download project with this source code from https://github.com/ViacheslavUKR/StandardDisignOopPattern
1: ' Facade Design Pattern.
2: ' See description in //www.vb-net.com/ProgramTheory/Facade.htm
3: Class MainApp
4: ' Entry point into console application.
5: Public Shared Sub Main()
6: Dim facade As New Facade()
7: facade.MethodA()
8: facade.MethodB()
9: ' Wait for user
10: Console.ReadKey()
11: End Sub
12: End Class
13:
14: ' The 'Subsystem ClassA' class
15: Class SubSystemOne
16: Public Sub MethodOne()
17: Console.WriteLine(" SubSystemOne Method")
18: End Sub
19: End Class
20:
21: ' The 'Subsystem ClassB' class
22: Class SubSystemTwo
23: Public Sub MethodTwo()
24: Console.WriteLine(" SubSystemTwo Method")
25: End Sub
26: End Class
27:
28: ' The 'Subsystem ClassC' class
29: Class SubSystemThree
30: Public Sub MethodThree()
31: Console.WriteLine(" SubSystemThree Method")
32: End Sub
33: End Class
34:
35: ' The 'Subsystem ClassD' class
36: Class SubSystemFour
37: Public Sub MethodFour()
38: Console.WriteLine(" SubSystemFour Method")
39: End Sub
40: End Class
41:
42: ' The 'Facade' class
43: Class Facade
44: Private _one As SubSystemOne
45: Private _two As SubSystemTwo
46: Private _three As SubSystemThree
47: Private _four As SubSystemFour
48: Public Sub New()
49: _one = New SubSystemOne()
50: _two = New SubSystemTwo()
51: _three = New SubSystemThree()
52: _four = New SubSystemFour()
53: End Sub
54: Public Sub MethodA()
55: Console.WriteLine(vbLf & "MethodA() ---- ")
56: _one.MethodOne()
57: _two.MethodTwo()
58: _four.MethodFour()
59: End Sub
60: Public Sub MethodB()
61: Console.WriteLine(vbLf & "MethodB() ---- ")
62: _two.MethodTwo()
63: _three.MethodThree()
64: End Sub
65: End Class
See also:
Creational Patterns
- Abstract Factory in VB.NET - Creates an instance of several families of classes.
- Builder in VB.NET - Separates object construction from its representation.
- Factory Method in VB.NET - Creates an instance of several derived classes.
- Prototype in VB.NET - A fully initialized instance to be copied or cloned.
- Singleton in VB.NET - A class of which only a single instance can exist.
- Adapter in VB.NET - Match interfaces of different classes
- Bridge in VB.NET - Separates an object???s interface from its implementation
- Composite in VB.NET - A tree structure of simple and composite objects
- Decorator in VB.NET - Add responsibilities to objects dynamically
- Facade in VB.NET - A single class that represents an entire subsystem
- Flyweight in VB.NET - A fine-grained instance used for efficient sharing
- Proxy in VB.NET - An object representing another object
- Chain of Resp. in VB.NET - A way of passing a request between a chain of objects
- Command in VB.NET - Encapsulate a command request as an object
- Interpreter in VB.NET - A way to include language elements in a program
- Iterator in VB.NET - Sequentially access the elements of a collection
- Mediator in VB.NET - Defines simplified communication between classes
- Memento in VB.NET - Capture and restore an object's internal state
- Observer in VB.NET - A way of notifying change to a number of classes
- State in VB.NET - Alter an object's behavior when its state changes
- Strategy in VB.NET - Encapsulates an algorithm inside a class
- Template Method in VB.NET - Defer the exact steps of an algorithm to a subclass
- Visitor in VB.NET - Defines a new operation to a class without change
Comments (
)
Link to this page:
//www.vb-net.com/ProgramTheory/Facade.htm
<SITEMAP> <MVC> <ASP> <NET> <DATA> <KIOSK> <FLEX> <SQL> <NOTES> <LINUX> <MONO> <FREEWARE> <DOCS> <ENG> <CHAT ME> <ABOUT ME> < THANKS ME> |