-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Readme file -> shape-drawing-application
- Loading branch information
1 parent
827b206
commit 7af38d9
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Learning_2.0/Problems/Creational-pattern-problems/shape-drawing-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Prototype Pattern: Shape Drawing Application | ||
|
||
## Overview | ||
|
||
This project implements a **Shape Drawing Application** using the **Prototype Pattern**. The application allows users to create and manipulate various shapes (like Circle, Rectangle, and Triangle) using a prototype-based approach. By leveraging the Prototype Pattern, users can easily clone existing shapes and customize their properties without needing to instantiate new objects from scratch. | ||
|
||
## Features | ||
|
||
- **Multiple Shape Types**: Supports various shapes including Circle, Rectangle, and Triangle. | ||
- **Cloning Shapes**: Allows users to clone existing shapes and modify their properties. | ||
- **Shape Customization**: Users can customize the color, size, and position of each shape. | ||
- **Drawing Interface**: Provides a simple interface to display and manipulate shapes. | ||
|
||
## Internal Structure | ||
|
||
1. **Prototype (Shape)** | ||
- Defines an interface for cloning itself and includes properties common to all shapes (like color and position). | ||
|
||
2. **Concrete Prototypes (Circle, Rectangle, Triangle)** | ||
- Each shape class implements the `Shape` interface and provides its specific implementation of the cloning method. | ||
- Includes methods to customize shape properties. | ||
|
||
3. **Client (ShapeManager)** | ||
- Responsible for managing the creation and manipulation of shapes. | ||
- Uses the Prototype Pattern to clone shapes and customize them based on user input. | ||
|
||
## How to Use | ||
|
||
1. **Create Shapes**: Instantiate concrete shape objects (e.g., Circle, Rectangle). | ||
2. **Clone Shapes**: Use the cloning functionality to create copies of existing shapes. | ||
3. **Customize Properties**: Modify the properties of the cloned shapes, such as color and size. | ||
4. **Draw Shapes**: Visualize the shapes in a drawing interface. | ||
|
||
## Solution | ||
|
||
You can find the solution to this problem in the [solution folder](/Learning_2.0/Solutions/Creational-pattern-solutions/shape-drawing-application/). |