File tree Expand file tree Collapse file tree 5 files changed +85
-3
lines changed
StructuralPatterns/Bridge Expand file tree Collapse file tree 5 files changed +85
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Design Patterns in C# / .NET
2222| | Pattern |
2323| ---| --- |
2424| :heavy_check_mark : | [ Adapter] ( /StructuralPatterns/Adapter ) |
25- | | Bridge | [ Bridge] ( /StructuralPatterns/Bridge ) |
25+ | | [ Bridge] ( /StructuralPatterns/Bridge ) |
2626| :heavy_check_mark : | [ Composite] ( /StructuralPatterns/Composite ) |
2727| :heavy_check_mark : | [ Decorator] ( /StructuralPatterns/Decorator ) |
2828| :heavy_check_mark : | [ Facade] ( /StructuralPatterns/Facade ) |
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace StructuralPatterns . Bridge
8+ {
9+ public class BasicRemote : IRemote
10+ {
11+
12+ public void PowerOn ( )
13+ {
14+ throw new NotImplementedException ( ) ;
15+ }
16+
17+ public void PowerOff ( )
18+ {
19+ throw new NotImplementedException ( ) ;
20+ }
21+
22+ public void VolumeUp ( )
23+ {
24+ throw new NotImplementedException ( ) ;
25+ }
26+
27+ public void VolumeDown ( )
28+ {
29+ throw new NotImplementedException ( ) ;
30+ }
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace StructuralPatterns . Bridge
8+ {
9+ public interface IDevice
10+ {
11+ void PowerOn ( ) ;
12+ void PowerOff ( ) ;
13+ int GetVolumen ( ) ;
14+ void SetVolume ( ) ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace StructuralPatterns . Bridge
8+ {
9+ // Abstraction
10+ public interface IRemote
11+ {
12+ void PowerOn ( ) ;
13+ void PowerOff ( ) ;
14+ void VolumeUp ( ) ;
15+ void VolumeDown ( ) ;
16+ }
17+
18+
19+ }
Original file line number Diff line number Diff line change @@ -25,9 +25,20 @@ This enables to configure an `Abstraction`(Interface) with an `Implementor`(Inte
2525
2626## Benefits
2727
28+ * Decouples an implementation so that it is not bound permanently to an interface.
29+ * Abstraction and implementation can be extended independently.
30+ * Changes to the concrete abstraction classes don't affect the client.
31+ * Allows building platform independent code
32+ * Hides the implementation details from client
2833
2934## Drawbacks
3035
36+ * Increases overall code complexity by creating multiple additional classes.
37+
38+ ## Known Uses
39+
40+ * Useful in graphic and windowing systems that need to run over multiple platforms
41+ * Useful any time you need to vary an interface and an implementation in different ways
3142
3243## Common Structure
3344
@@ -43,7 +54,11 @@ This enables to configure an `Abstraction`(Interface) with an `Implementor`(Inte
4354* ConcreteImplementor
4455 * implements the ` Implementor ` interface.
4556
46- _ [ Source: http://www.dofactory.com/net/memento-design-pattern ] _
47-
4857## Example
4958
59+ // TODO
60+
61+ ## Comparison with other patterns
62+
63+ * ** Adapter** makes the unrelated classes work together. Adapter makes things work after they're designed; Bridge is designed beforehand to let the abstraction and implmentation vary independently. * [ GoF, p219] *
64+
You can’t perform that action at this time.
0 commit comments