|
1 | 1 | # ☕ Java Design Patterns |
2 | 2 |
|
3 | | -## About |
| 3 | +## Flyweight |
4 | 4 |
|
5 | | -This application is a simple Java Console Application that aims to implement design pattern examples to a Programmin Language Class. A set of design patterns will be developed |
6 | | -each week, and they are divided in different [branches](https://github.com/LBeghini/Java-Design-Patterns/branches). |
| 5 | +Fliweight pattern defines an object that minimizes memory use by sharing the same object in varios different locations. |
7 | 6 |
|
8 | | -The main branch is just a template for every other branch. |
9 | | - |
10 | | -Also, to make it easier to download the source code, [releases](https://github.com/LBeghini/Java-Design-Patterns/releases) are created related to the task of the week, giving a snapshot of the code for that specific implementation. |
11 | | - |
12 | | -## Implemented design patterns |
13 | | - |
14 | | -### Behavioural patterns |
15 | | - |
16 | | -- [x] [Chain of responsibility](https://github.com/LBeghini/Java-Design-Patterns/tree/4-chain-of-responsibility) |
17 | | -- [x] [Command](https://github.com/LBeghini/Java-Design-Patterns/tree/6-command) |
18 | | -- [x] [Iterator](https://github.com/LBeghini/Java-Design-Patterns/tree/4-iterator) |
19 | | -- [x] [Memento](https://github.com/LBeghini/Java-Design-Patterns/tree/5-memento) |
20 | | -- [x] [Observer](https://github.com/LBeghini/Java-Design-Patterns/tree/5-observer) |
21 | | -- [x] [State](https://github.com/LBeghini/Java-Design-Patterns/tree/3-state) |
22 | | -- [x] [Strategy](https://github.com/LBeghini/Java-Design-Patterns/tree/6-strategy) |
23 | | -- [x] [Template method](https://github.com/LBeghini/Java-Design-Patterns/tree/4-template-method) |
24 | | -- [x] [Mediator](https://github.com/LBeghini/Java-Design-Patterns/tree/9-mediator) |
25 | | -- [x] [Interpreter](https://github.com/LBeghini/Java-Design-Patterns/tree/9-interpreter) |
26 | | - |
27 | | -### Creational patterns |
28 | | - |
29 | | -- [ ] Abstract factory |
30 | | -- [x] [Builder](https://github.com/LBeghini/Java-Design-Patterns/tree/1-builder) |
31 | | -- [x] [Factory method](https://github.com/LBeghini/Java-Design-Patterns/tree/2-factory-method) |
32 | | -- [x] [Prototype](https://github.com/LBeghini/Java-Design-Patterns/tree/2-prototype) |
33 | | -- [x] [Singleton](https://github.com/LBeghini/Java-Design-Patterns/tree/1-singleton) |
34 | | - |
35 | | -### Structural patterns |
36 | | - |
37 | | -- [x] [Adapter](https://github.com/LBeghini/Java-Design-Patterns/tree/7-adapter) |
38 | | -- [x] [Bridge](https://github.com/LBeghini/Java-Design-Patterns/tree/7-bridge) |
39 | | -- [x] [Composite](https://github.com/LBeghini/Java-Design-Patterns/tree/8-composite) |
40 | | -- [ ] Decorator |
41 | | -- [x] [Facade](https://github.com/LBeghini/Java-Design-Patterns/tree/8-facade) |
42 | | -- [ ] Flyweight |
43 | | -- [ ] Proxy |
44 | | - |
45 | | -## Technologies |
46 | | - |
47 | | -- Java |
48 | | -- JUnit |
49 | | -- Maven |
50 | | - |
51 | | -## Requirements |
52 | | - |
53 | | -To run and edit the project, be sure to have installed in your computer the following softwares: |
54 | | -- A code editor |
55 | | - |
56 | | -After that, you'll need to clone this repo: |
57 | | - |
58 | | -```bash |
59 | | -git clone https://github.com/LBeghini/Java-Design-Patterns.git |
60 | | -``` |
61 | | - |
62 | | -## Change branch |
63 | | - |
64 | | -To change to a different branch, run the command: |
65 | | - |
66 | | -```bash |
67 | | -git checkout name-of-the-branch |
68 | | -``` |
69 | | - |
70 | | -The branch names have the pattern: |
71 | | - |
72 | | -```bash |
73 | | -{number-of-the-week}-{pattern-name} |
74 | | -``` |
75 | | - |
76 | | -> `number-of-the-week` corresponds to the week asked to be implemented certain pattern |
77 | | -
|
78 | | -## Testing |
79 | | - |
80 | | -This project has no aim to run any of the implemented classes, as the goal is the code itself. However, the classes will be tested to visualize the behaviour and implementation |
81 | | -of the patterns. |
82 | | - |
83 | | -You can run the tests using the maven wrapper: |
84 | | - |
85 | | -```bash |
86 | | -./mvnw test |
87 | | -``` |
88 | | - |
89 | | -## :balance_scale: License |
90 | | - |
91 | | -[MIT License](https://github.com/LBeghini/Java-Design-Patterns/blob/main/LICENSE) |
| 7 | +For example, when creating a characters to a game, a pre defined color is something all characters might share. You can have a character with a red hair and blue eye and yellow skin, and have another character with yellow hair, red eye and blue skin. Even in different attributes, the color is the same, and doesn't need to be kept in memory for every character you create: just create one color (let's say blue) and them for all the objects that uses this color, call the same object. |
0 commit comments