Code Monkey home page Code Monkey logo

test-driven-development's Introduction

TDD Workshop

The workshop focuses specifically on test-driven development mantra and provides tips and tricks on how to achieve that. After the workshop you will be able to practice test-driven development with any language, it is not limited to Java.

Topics

  • 15' Min intro
  • 30' live hacking by the presenter
  • 45' Involving the audience, we do it together
  • 45' The audience works on their own and present the solution to the rest

We do 10' breaks between the blocks.

Your Tasks

Do the following steps before the workshop!

  • Import MoveIt_step0 in your IDE as a Gradle project and build it, Java 8 should be sufficient.
  • Run the application, you can move a square with WASD keys on the screen.
  • Make sure the dummy test is working!

The Whole Picture

We will program a turn-based mini-game with undo and redo. In the end, you can move around on an xz-plane and you can undo and redo the movements of your character. For this, we implement the command pattern from the gang of 4. See here if you want to read more about this pattern.

Command Pattern

We will capsulate every movement into a command in our case the MoveCommand, we do not reuse command objects. The command has two methods an execute() and an undo()

We store these commands into a history object. The History class does have execute(Command command), undo(), and redo() methods.

Example

The history object contains a list of commands and in this example the last executed command was command2

command1 *command2*

To execute a command we simply call history.execute(command) that then calls command.exectue() and store the command into a structure. We were initially on command2 and move on to command3

command1 command2 *command3*

To undo the current command, we simply call history.undo() that calls then command.undo() of command3 and move to the command before in our example to command2

command1 *command2* command3

To redo a command we undid we simply move one command further and call again command.execute() in our example it is command3

command1 command2 *command3*

test-driven-development's People

Contributors

ia97lies avatar

Watchers

James Cloos avatar  avatar

Forkers

adncli

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.