Code Monkey home page Code Monkey logo

klondike-patterns's Introduction

klondike-patterns

Introduction

Project belonging to the Master in Software Craftmanship, in which we apply the knowledge of software analysis and design. To do this, an mvc-based application must be created in which the SOLID principles and the Clean Code guide must be used, in addition to using Gamma design patterns (or suitable adaptations thereof) in C ++.

MVC - Model-View-Controller

Model

model

Patterns

  • Builder (BoardBuilder)
  • Singleton (FrenchDeckUtils)
  • Fachade (Game)

Relevant principles

  • SOLID - >Liskov substitution

    If Deck, Tableau and Foundation inherits from CardList then we should assure that the preconditions of derived classes are equal or weaker than those of Base. This can not be guaranteed for the push() and pushlist() methods where in cardlist it is possible to insert any letter but in the derivatives not.

    • Before: model
    • After: model

Controller

model

Patterns

  • Builder (LogicBuilder)
  • Visitor (GameControllerVisitor, GameController and deriveds, and implements view)

Relevant principles

  • DRY (Don't repeat yourself)

    In order for all game controllers to have a common code, a base class must be created, called GameController, to which everyone will extend, thus avoiding repetition of the code.

  • SOLID -> DIP (Dependency inversion)

    To avoid cycles in the implementation of the visitor pattern , dependency inversion is applied on GameController and its derivatives and KlondikeView adding an interface called GameControllerVisitor.

  • Double Dispatch

    For the implementation of the ** visitor ** ** pattern *, ** double ** ** dispatch ** must be applied between the corresponding implementation of the GameControllerVisitor and KlondieView.

View

model

Patterns

  • Singleton Multitone (KlondikeRegistry, KlondikeView and deriveds)
  • Singleton (IOUtils)
  • Visitor (KlondikeView, KlondikeViewConsole implements GameControllerVisitor from controller model)
  • Command (CommandDispatcher, Command and deriveds)
  • Template method (Command and deriveds)
  • Fachade (CommandDispatcher)

Relevant principles

  • DRY (Don't repeat yourself)

    In order for all command to have a common algorithm but implementing its own part, a base class must be created, called Command, to which everyone will inherit, thus avoiding repetition of the algorithm structure (Template method) .

  • Double Dispatch

    For the implementation of the ** visitor ** ** pattern *, ** double ** ** dispatch ** must be applied between KlondieView and the corresponding implementation of the GameControllerVisitor

MVC DIAGRAM

model

klondike-patterns's People

Contributors

marcocaballero avatar

Stargazers

 avatar  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.