Git Product home page Git Product logo

calculator's People

Stargazers

 avatar  avatar

Watchers

 avatar

calculator's Issues

button clicking sound delay

and it is annoying a lot
will change the outlet event type to "touch down" .. someday..

.. getting super lazy

also, will investigate little bit more gradient layer on button ... sometime soon..

regression. sign button

enter digit + sign + enter more digits
will revert sign

damn. why every simple change introduces bugs -_-

retrospection

๋ฐ˜์„ฑ

  • design rather driven by ui, than by function ..
  • state pattern not really open to change, unless each states / state transitions carefully defined in the first place. didn't foresee memory function would change the state, nor some inputs would cause multiple state transitions. the reason i call it multiple state transitions is that one state can not access another state property, so it had to pass through.. means that, probably i should have defined all the properties in brain, so that every state can modify the values. omg. yes maybe, states work on behalf of the brain. may not make much sense to hide/abstract data from each other.. one supporting evidence of this is after exiting a state, that state's property is still alive, e.g., left operand is valid and accessed until the calculation is performed.
  • it would be better that each state more focuses on its own error handling, and examining exit criteria, rather than trying to pass verified data to other state. in other words, mind your own business. unless, it becomes untraceable as more reqs are revealed.
  • if something happens in a state which was not supposed to happen, do not workaround by if-else's .. time to new start -_-

core properties..

  1. left operand
  2. operator
  3. right operand
  4. result
  5. memory
  6. user input string (number)
  7. display string

user input string becomes either left operand, right operand, or memory
-> should convert and store before leaving the operand state

result becomes left operand
-> wait, do not push the value to left operand, until exiting the operand state.

memory becomes left operand, or right operand
-> again, wait until user finally decide to accept that value by exiting the operand state.

display string : ui dependent. coming from user input, memory or result.
-> let controller compose the presentation using 1-6

๐Ÿ˜ฟ

Hopefully the last functional bug

Press
12.3
M+
Mr
0.345

-> Displays 12.30.345

Because isDecimalPressed == No

Simplest fix might be scan for dot in mr value, and turn the decimal flag on.
But as in ios, i will prohibit altering mr value on the display. Any attemp to entering digit will discard the mr value.. sign change will be allowed.

mr + - / *

on iphone cal.
these buttons have toggle state

sign / decimal issue

decimal - not implemented
sign - signed number, followed by digit input

need to redesign the way getting user input

why don't i create unit tests

state transition and exceptional case handling became so dirty, requires extensive manual tests on every code change, so now it makes perfect sense to generate unit tests .. dammit

category

I was curious if there was "C++ friend" equivalent in Objective C. Stack overflow says Category is one way to mimic it.

So, let's try it.

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.