Skip to content

A Go project demonstrating the Facade pattern with a hierarchical structure management system. This repository showcases how to provide a simplified interface to complex subsystems, emphasizing best practices in design patterns and unit testing.

Notifications You must be signed in to change notification settings

arthurfp/Go_Facade_Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facade Pattern in Go

Overview

This repository demonstrates the application of the Facade design pattern in Go. The project highlights how to provide a simplified interface to a complex subsystem, showcasing flexibility and best practices in design patterns and unit testing.

Pattern Description

The Facade pattern provides a simplified interface to a complex subsystem, making it easier to use and understand. In this project, we have implemented subsystems and a Facade to demonstrate this pattern effectively.

Project Structure

  • cmd/: Contains the application entry point (main.go), demonstrating the creation and usage of the Facade.
  • pkg/facade/: Houses the Facade implementation and its subsystems.
    • component.go: Defines the Component interface.
    • subsystem_a.go: Implements the SubsystemA.
    • subsystem_b.go: Implements the SubsystemB.
    • subsystem_c.go: Implements the SubsystemC.
    • facade.go: Implements the Facade.
    • subsystem_a_test.go: Unit tests for SubsystemA.
    • subsystem_b_test.go: Unit tests for SubsystemB.
    • subsystem_c_test.go: Unit tests for SubsystemC.
    • facade_test.go: Unit tests for the Facade.

Getting Started

Prerequisites

Ensure you have Go installed on your system. You can download it from Go's official site.

Installation

Clone this repository to your local machine:

git clone https://github.com/arthurfp/Go_Facade_Pattern.git
cd Go_Facade_Pattern

Running the Application

To run the application, execute:

go run cmd/main.go

Running the Tests

To execute the tests and verify the functionality:

go test ./...

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues to discuss proposed changes or enhancements.

Author

Arthur Ferreira - github.com/arthurfp

About

A Go project demonstrating the Facade pattern with a hierarchical structure management system. This repository showcases how to provide a simplified interface to complex subsystems, emphasizing best practices in design patterns and unit testing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages