src/
├── domain/ # Core business logic
│ ├── aggregates/ # Aggregate roots
│ │ └── Circuit.js # Circuit aggregate root
│ ├── entities/ # Domain entities
│ │ ├── Resistor.js # Resistor entity
│ │ └── Capacitor.js # Capacitor entity
│ ├── value-objects/ # Value objects
│ │ ├── Position.js # Position value object
│ │ ├── Resistance.js # Resistance value object
│ │ └── Capacitance.js # Capacitance value object
├── application/ # Application services
│ └── CircuitAppService.js # Circuit application service
├── infrastructure/ # Adapters and repositories
│ ├── adapters/ # Adapters for external systems
│ │ ├── CanvasAdapter.js # Adapter for canvas interactions
│ │ └── CircuitExporter.js # Adapter for exporting circuits
│ ├── repositories/ # Data persistence
│ └── CircuitRepository.js# Circuit repository
├── gui/ # Graphical user interface
│ └── index.html # Main HTML file for the GUI
- Aggregates: Encapsulate entities and value objects, ensuring consistency within the aggregate.
Circuit.js
- Entities: Represent core business objects with a distinct identity.
Resistor.js
,Capacitor.js
- Value Objects: Represent immutable concepts with no distinct identity.
Position.js
,Resistance.js
,Capacitance.js
- Application Services: Manage use cases and orchestrate domain operations.
CircuitAppService.js
- Adapters: Convert data between the domain and external systems.
CanvasAdapter.js
,CircuitExporter.js
- Repositories: Handle data persistence and retrieval.
CircuitRepository.js
- GUI: Interacts with the user and connects to the application layer through adapters.
index.html
Hexagonal Architecture allows us to isolate the core business logic from external concerns, making the system more modular and easier to maintain. By organizing the code into distinct layers, we can ensure that changes in one part of the system do not affect other parts, promoting a clean separation of concerns and enhancing testability.