Giter VIP home page Giter VIP logo

design-patterns-exercise's Introduction

Design-Patterns-Exercise

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.

Picture contains

  1. Shape of picture frame.
  2. Color of picture.
  3. Text placed on picture.
  4. Name of operation to apply to the text before printing it.

Properties of creation:

  1. Left Frame.
  2. Right Frame.
  3. Color.
  4. Text.

Detailed information

  1. Left and Right frames are defined like: circle - '(' and ')', square '[' and ']', triangle '<' and '>'. There is an option to add another classes with different frames.
  2. Thickness defines how many times the symbol of frame is repeated.
  3. Color is just a text symbolising the color.
  4. Text is any text.

For example:

(red) HelloWorld (red) [[[]]] H e l l o W o r l d [[[]]] <> HelloWorld <>

Rules and restrictions

  1. Order of creation is like: color, text, framing.
  2. If the color is not specified, the color is blank.
  3. If there is no matching operation, the text remains unchanged.
  4. Picture can't be framed if text or color are nulls.
  5. If there is no matching shape it displays error message.
  6. Order has to validated during making process.
  7. Calling Print() method is mandatory.

Initial data

  1. Has red, green and blue colors.
  2. Three shapes: circle, square, triangle.
  3. Operation on text: spacing, uppercase.
  4. If picture has no color, thickness is set to 2.
  5. After spacing thickness is 2.
  6. If 4 and 5 occurs thickness is 3.
  7. In other cases thickness is 1.

Concept of solution let user to add any color, frame shape or operation.

design-patterns-exercise's People

Contributors

szymonsmagowski avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.