GithubHelp home page GithubHelp logo

designpatterns_draw's Introduction

DesignPatterns_Draw

Case study to demonstrate interactions among a number of core design patterns

This repository contains a number of staged evolutions of a system, designed to showcase specific design patterns in context. Often design patterns are introduced to clean up some badly-written code. Here the initial design starts with the intention to make the system extensible. As you will see, this isn't just matter of creating some abstract classes. During the earliest stage of design in a system, you can already envision how a specific design pattern will be used.

For ease of deployment, this repository consists of an Eclipse project.

Entity-Boundary-Controller

The entire system is architected to conform to a style of programming called Entity-Boundary-Controller. While this is similar to the more commonly named Model-View-Controller, it differs in a number of fundamental ways. If you are interested, review two additional github repositories:

  • Tangram [https://github.com/heineman/tangram] - this case study shows a number of staged evolutions of a small application designed to support Tangrams, a two-dimensional dissection puzzle. Once the initial application is rapidly constructed, I extend the system systematically by applying design patterns to resolve coding problems encountered.
  • EBC [https://github.com/heineman/ebc-example] - this repository contains several tiny EBC examples, together with a more fleshed out example for an application that gives users the ability to solve a game consisting of sliding wooden pieces.

draw.0 (JavaDoc)

The first iteration includes the following design patterns

  • Singleton - draw.tools.Tools maintains the collection of available tools, and records which one is currently selected.
  • Adapter - draw.controller.handle.ActiveToolHandler adapts low-level mouse events into application-domain method invocations, to simplify how to handle user interactions
  • Chain of Responsibility - draw.controller.handler.Handler builds up a chain of event handlers that respond to the user interactions based on the active tool maintained by Tools.

Based on the Code Line Counting Tool [https://github.com/AlDanial/cloc] the initial system consists of

Version Files Blank Comment Code
draw.0 21 280 470 950

draw.1 (JavaDoc)

The second iteration includes the following design patterns

  • Composite - draw.model.Group represents a group of Element objects that is to be treated as a single Element.
  • Command - draw.controller.command represents the Command objects that will execute the user actions from the GUI
Version Files Blank Comment Code
draw.1 24 319 543 1104

draw.2 (JavaDoc)

The third iteration includes the following design patterns

  • Visitor - draw.controller.visitors contain the Visitor classes that encapsulate new operations without requiring changes to existing classes
Version Files Blank Comment Code
draw.2 30 408 656 1436

draw.3 (JavaDoc)

The fourth iteration adds Style features for all Elements. Some new Visitor and Command classes are designed.

Version Files Blank Comment Code
draw.3 34 482 839 1709

draw.4 (JavaDoc)

The fifth iteration adds capabilities to edit Elements including:

  • Moving selected Elements
  • Clipboard actions (Cut, Copy, Paste)
  • Editing actions (Delete, Duplicate)
Version Files Blank Comment Code
draw.4 42 571 949 1980

draw.5 (JavaDoc)

The sixth iteration adds persistent storage to Model by converting Element structure into JSON and vice versa.

  • Adds visitors to traverse Element Structure while creating JSON
  • Incorporates JSON-Simple open source library for convertin objects to JSON and parsing JSON strings into objects
Version Files Blank Comment Code
draw.5 50 689 1076 2395

designpatterns_draw's People

Contributors

heineman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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