Develop using HTML, CSS and Javascript.
For better into development release cycle I'm sending you a Git repository tree. You can follow by log:
Branches
- master
- new-engine
Change Log
- styles change for html5 - header and footer
- bug fixed - float-point arithmetic
- bug fixed - negative number
- first good version - should fix negative number bug soon
I utilized tools, such as Intializr to obtain Twitter Bootstrap and HTML5+CSS files. There is a very interesting point about the code, which is the fact that the calculator component was made by using one table to group buttons. Some people recommend to use tables only when displaying tabular information. While I agree with this recommendation, I believe that the main point of this exercise is the unobtrusive Javascript and OOP, therefore I reused the HTML code from a calculator from Webestools site.
Testing
I selected Jasmine framework for BDD - behavior-driven development - because it has a clean, obvious syntax so that you can easily write tests. You can run the SpecRunner code by:
http://danielnegri.com.br/kaplan/js_code_test/js/SpecRunner.html
Reference
- Simple Calculator
- Simple Calculator - SpecRunner
- Webestools Calculator
- Intializr
- Twitter Bootstrap
- Why tables for layout is stupid
- Floating-Poing Arithmetic
Cross-browser compatibility
- Internet Explorer 7+: Windows
- Google Chrome: Windows Mac Linux
- Firefox 3+: Windows Mac Linux
- Safari 5+: Mac Windows
I utilized the same concept as the one I used with the Calculator. I tried to create the same example structure. As we can see, the original PDF has a screenshot probably from a Windows machine. I developed using Snow Leopard MacOS and tested using Windows XP with VirtualBox.
Considerations
The hardest part of this example was to decide how to reproduce shadows and rounded corners. We have two interesting situations, the first one for box-footer.jpg and other for titlebar-*. The box-footer.jpg is very useful because you don't need to setup various helper elements, just one is enough. The titlebar was more difficult to decide because I did not want to create different float DIVs just to represent borders, if you have some suggest please let me know. [:D]
- Simple Calculator: http://danielnegri.com.br/kaplan/js_code_test/calculator.html
- Simple Calculator - SpecRunner: http://danielnegri.com.br/kaplan/js_code_test/js/SpecRunner.html
- Mockup - HTML & CSS: http://www.danielnegri.com.br/kaplan/coding_test/mockup.html
Daniel Negri