{"id":28348186,"url":"https://github.com/waltermillan/bridgepatternapp","last_synced_at":"2025-07-03T11:02:34.418Z","repository":{"id":293151264,"uuid":"983112889","full_name":"waltermillan/BridgePatternApp","owner":"waltermillan","description":"the idea is to implement the Bridge design pattern in the creation of geometric shapes of different colors. In addition we want to use the Factory design pattern","archived":false,"fork":false,"pushed_at":"2025-05-13T23:15:34.000Z","size":119,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-27T18:11:25.284Z","etag":null,"topics":["bridge-pattern","console-application","csharp","factory-pattern","netcore","patterns-design"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waltermillan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-13T22:39:19.000Z","updated_at":"2025-05-13T23:15:37.000Z","dependencies_parsed_at":"2025-05-14T00:33:05.901Z","dependency_job_id":"9a4c0fbd-8b73-484b-9d4b-a94147508788","html_url":"https://github.com/waltermillan/BridgePatternApp","commit_stats":null,"previous_names":["waltermillan/bridgepatternapp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/waltermillan/BridgePatternApp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waltermillan%2FBridgePatternApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waltermillan%2FBridgePatternApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waltermillan%2FBridgePatternApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waltermillan%2FBridgePatternApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waltermillan","download_url":"https://codeload.github.com/waltermillan/BridgePatternApp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waltermillan%2FBridgePatternApp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263314092,"owners_count":23447289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridge-pattern","console-application","csharp","factory-pattern","netcore","patterns-design"],"created_at":"2025-05-27T18:10:32.109Z","updated_at":"2025-07-03T11:02:34.404Z","avatar_url":"https://github.com/waltermillan.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BridgePatternApp\n\nThe idea of this application is to implement the **Bridge Design Pattern** in the creation of geometric shapes with different colors. Additionally, we use the **Factory Design Pattern** to handle the creation of the shapes.\n\n## Bridge Design Pattern\n\nThe **Bridge** pattern is used to separate the abstraction of an object from its implementation, allowing them to vary independently. In this case:\n\n- The abstraction is the **Shape** (geometric shapes like `Triangle`, `Square`, `Circle`, and `Rectangle`).\n- The implementation is the **Color** (colors like `Red`, `Blue`, and `Green`).\n\nBy using the Bridge pattern, we can change the **Shape** without affecting the **Color** and vice versa. Each shape can have different colors, and the color can be applied to any shape.\n\n### Classes\n\n- **Shape** (abstract class): Defines the interface for shapes that can be drawn.\n- **Triangle**, **Square**, **Circle**, **Rectangle**: Concrete shapes that inherit from `Shape` and implement the `draw()` method.\n- **IColor** (interface): Defines the method `applyColor()` which concrete color classes must implement.\n- **Red**, **Blue**, **Green**: Concrete color classes implementing the `IColor` interface.\n- **ShapeFactory**: Implements the **Factory Design Pattern** to create shapes with a specified color.\n\nThe **ShapeFactory** is responsible for creating the shapes and assigning them a color.\n\n## Factory Design Pattern\n\nThe **Factory Design Pattern** is used to create objects without specifying the exact class of the object that will be created. In our case, we use a factory method `createShape()` in the `ShapeFactory` class to create shapes based on the specified type (e.g., `Triangle`, `Square`) and assign them a color (e.g., `Red`, `Blue`).\n\n## Implementation\n\nThe application is implemented in **C#** as a console application. The shapes (abstractions) are created with a specified color (implementations), and the **Factory** pattern is used to instantiate the shapes. This ensures that new shapes can be created easily with different color combinations.\n\n## UML Class Diagram\n\nHere is the class diagram representing the relationship between the classes:\n\n![UML Class Diagram](images/UMLClassDiagram.png)\n\n## Conclusion\n\nBy combining the **Bridge** and **Factory** design patterns, this implementation allows for a flexible and maintainable solution for creating shapes with different colors. The **Bridge** pattern enables the independent variation of shapes and colors, while the **Factory** pattern simplifies the creation of these objects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaltermillan%2Fbridgepatternapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaltermillan%2Fbridgepatternapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaltermillan%2Fbridgepatternapp/lists"}