bridge

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bridge implements the Bridge design pattern. In the context of woodworking projects, the bridge is implemented through dependency inversion. The specific projects (Desk, Chair) are not tightly coupled to a particular tool set (ManualToolSet or PowerToolSet), but instead depend on an abstract interface (ToolSet). Each project conforms to the ProjectBuild interface and inherits from the Project struct, which encapsulates the abstract ToolSet and validation method, allowing for flexible tool swapping without modifying the project logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type Chair

type Chair struct {
	Project
}

Chair is the specific Project that can be built through the bridge to the tool sets

func (*Chair) Build

func (c *Chair) Build()

Build implements the building algorithm

type Desk

type Desk struct {
	Project
}

Desk is the specific Project that can be built through the bridge to the tool sets

func (*Desk) Build

func (d *Desk) Build()

Build implements the building algorithm

type ManualToolSet

type ManualToolSet struct{}

ManualToolSet is the concrete implementation of ToolSet interface for the manual working processes

func (*ManualToolSet) Cut

func (s *ManualToolSet) Cut()

func (*ManualToolSet) Drill

func (s *ManualToolSet) Drill()

func (*ManualToolSet) Finish

func (s *ManualToolSet) Finish()

func (*ManualToolSet) Joint

func (s *ManualToolSet) Joint()

func (*ManualToolSet) Plane

func (s *ManualToolSet) Plane()

func (*ManualToolSet) Resaw

func (s *ManualToolSet) Resaw()

func (*ManualToolSet) Route

func (s *ManualToolSet) Route()

func (*ManualToolSet) Sand

func (s *ManualToolSet) Sand()

type PowerToolSet

type PowerToolSet struct{}

PowerToolSet is the concrete implementation of ToolSet interface for the electric instruments operated processes

func (*PowerToolSet) Cut

func (s *PowerToolSet) Cut()

func (*PowerToolSet) Drill

func (s *PowerToolSet) Drill()

func (*PowerToolSet) Finish

func (s *PowerToolSet) Finish()

func (*PowerToolSet) Joint

func (s *PowerToolSet) Joint()

func (*PowerToolSet) Plane

func (s *PowerToolSet) Plane()

func (*PowerToolSet) Resaw

func (s *PowerToolSet) Resaw()

func (*PowerToolSet) Route

func (s *PowerToolSet) Route()

func (*PowerToolSet) Sand

func (s *PowerToolSet) Sand()

type Project

type Project struct {
	Tools ToolSet
}

Project is the abstract Project type that stores the specific ToolSet field

func (*Project) CheckTools

func (p *Project) CheckTools()

CheckTools it the validation method for the Tools presence

type ProjectBuild

type ProjectBuild interface {
	Build()
}

ProjectBuild defines the abstraction for any woodworking project that can be built using a ToolSet.

type ToolSet

type ToolSet interface {
	Cut()
	Resaw()
	Joint()
	Plane()
	Drill()
	Route()
	Sand()
	Finish()
}

ToolSet defines a set of woodworking operations regardless of tool type (manual, power etc.).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL