Coder Social home page Coder Social logo

planning-calc-mvclh's Introduction

Planning an MVC-LH calculator

More practice with MVC-LH, reverse-engineering/tdd, & story-focues development.


A user can ...

  1. add two numbers & see result
  2. subract two numbers & see result
  3. chain operations (ie. use last result instead of 2 args)
  4. general purpose controller method
  5. multiply two numbers & see result
  6. divide two numbers & see result
  7. provide an expected value and see if they were right
  8. see a history of all operations
  9. clear the history of all operations
  10. reset last_result

story UI handler controller model logic view
1: + two inputs, add button, output area call_add: reads, cleans & passes on inputs add: passes two numbers through logic.add & calls view add: adds two numbers & returns the result render: draws result to the UI
2: - subtract button call_subtract: reads, cleans & passes on inputs subtract: passes two numbers through logic.subtract & calls view subtract: subtracts two numbers & returns the result
3: chain refactor call_add & call_subtract to read from model when needed, and write new result to model set_last_result, read_last_result
4: generalize both buttons call the new generalized handler method operate: reads operation, a, b. calls controller operate: args - operation(str), a(num), b(num). uses indicated operation & reads/writes last_result
5: * mulitply button multiply: multiplies 2 numbers and returns result
6: / divide button divide: divides 2 numbers and returns result
7: expected values expected input field, test_it check-box, results output field test: reads input, operation & expected value. passes on to controller test: caries out the indicated operation, then compares the result & expected. calls view.render & view.render_test test: takes args, exected & actual, returns pass/fail message render_test: draws pass/fail message in test space
8: history of operations button to read history, space to display it read_history: calls controller read_history: reads history and passes to view. refactor operate to save each call to the model as a string add_call, read_all_calls render_history: renders an array of strings to the history space
9: clear history "clear call history" button clear_call_history: calls controller clear_call_history: clears the model's call history clear_call_history
10: set last_result a "set last_result" input field & button set_last_result: calls the model set_last_result: resets it to the new value


planning-calc-mvclh's People

Contributors

colevanderswands avatar

Watchers

James Cloos 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.