Giter Club home page Giter Club logo

numberconverter's Introduction

NumberConverter

##Introduction The number converter takes any integer from 1 to 999,999,999 and converts it to an english equivalent. It was far more involved than I initially anticipated, especially converting thousands (where do the hundreds start?).

##Implementation For the conversion work I have gone for a composite pattern with a printer being composed of other printers that know how to handle numbers with a lower value. The controller depends on a factory that knows how to create printers based on the size of the number to convert. The controller will then call print on the returned printer resulting in a text representation.

##Testing I used Specflow to write acceptance tests based on the examples in the requirements document. I have also used spec salad that allows me to avoid using step definitions (which can get very unwieldy quite quickly). I concentrated on the happy path for the acceptance tests, in a real system I would have written examples of behaviour with invalid input.

For the unit level tests I have used MSpec, fairly standard stuff not much to say on the matter.

##What I should have done if I had time

  • Created a view
  • Put autofac in to inject the dependency into the controller
  • implemented a build that builds the solution and runs the tests
  • Implemented equality on Number (value object) and not exposed the underlying value
  • Validated the input - this would be the responsibility of Number to handle
  • Moved the printer creation into factory methods? (maybe)

numberconverter's People

Contributors

thehumbleprogrammer avatar

Watchers

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