Exercise about use of design patterns. Pictures factory. Using my own idea agreed with SOLID. Well, maybe it is not really single responsible for all classes, but You get my point. The task is to simulate multistage picture production process.
- Shape of picture frame.
- Color of picture.
- Text placed on picture.
- Name of operation to apply to the text before printing it.
- Left Frame.
- Right Frame.
- Color.
- Text.
- Left and Right frames are defined like: circle - '(' and ')', square '[' and ']', triangle '<' and '>'. There is an option to add another classes with different frames.
- Thickness defines how many times the symbol of frame is repeated.
- Color is just a text symbolising the color.
- Text is any text.
For example:
(red) HelloWorld (red) [[[]]] H e l l o W o r l d [[[]]] <> HelloWorld <>
- Order of creation is like: color, text, framing.
- If the color is not specified, the color is blank.
- If there is no matching operation, the text remains unchanged.
- Picture can't be framed if text or color are nulls.
- If there is no matching shape it displays error message.
- Order has to validated during making process.
- Calling Print() method is mandatory.
- Has red, green and blue colors.
- Three shapes: circle, square, triangle.
- Operation on text: spacing, uppercase.
- If picture has no color, thickness is set to 2.
- After spacing thickness is 2.
- If 4 and 5 occurs thickness is 3.
- In other cases thickness is 1.
Concept of solution let user to add any color, frame shape or operation.