This web application will help you keep fit on your lunch-break by designing and running a workout for your to perform. You are able to configure how long you want your workout to go for, and how intense you want it to be.
Once your ready, click start workout, and quickly follow the instructions marked in blue, make sure you pace yourself as even a 10 minute workout can be difficult.
Other than the libraries I used, the only code I did not write was the CSS - CSS styling is very time consuming and depending on what your doing, you can spend 3 hours trying to got even a small part of an application to look right. In-spite of all the RAD software \ languages and libraries I used - this application still took me appx 12 hours to build.
This application was developed inside a Vagranted Environment, so it will require Vagrant to be installed for the following commands to work http://www.vagrantup.com/ has information on how to install vagrant
######To Begin unzip the project and cd into the project directory ######Execute: vagrant box add precise64 http://files.vagrantup.com/precise64.box vagrant plugin install vagrant-salt ) This will download an ubuntu virtual machine and install a plug-in required for salt to be used a provisioning system
I actually have created a pull request on the vagrant repo that allows salt to come as a pre-installed provisioning system for Vagrant (fingers crossed its included in the next version of vagrant! see - hashicorp/vagrant#1626)
######Finally Execute vagrant up
This may take a while, but it should download all required software (node.js, mysql and dependencies OS libraries) to a guest vm, and start the application.
Navigate to http://localhost:3200 in a browser to see everything in action.
Test can be run at http://localhost:3200/SpecRunner.html
-
entry.js - Application entry point, takes to arguments, init (populates the database) and start (runs the application)
-
package.json - Details information about the project, and lists dependand node.js libraries
-
public - Where all static content is located
-
public/app.coffee - Code that runs the web client
-
public/spec/ApplicationSpec.coffee - Contains the web clients test cases
-
views/index.jade - This gets processed into HTML and served to the client
-
srv/salt/node.sls - Specifies what needs to be installed and run inside the guest vm
This is were I justify my technology choices, however I will try and avoid reasons such as - I can develop the application faster, as ultimately many reasons will boil down to this anyway.
#####Coffee-script: Coffee-script is used client side and for tests, it was chosen mainly because it makes it easy to embedded HTML and interpolate variables without a template engine inside a script,As for the test cases they were written in coffee script as they are much easier to read than javascript test cases
#####Javascript: Javascript is the language that runs inside Node.js so it was mostly influenced by the want for Node.js
#####Jade: Jade is used to compose the root wepage, it was chose as it acts as a alternative syntax for html with a little extra features, this was used to allow rapid prototyping of the UI
###Software #####Mysql: Easy setup, and good support by many libraries
#####Node.js: A Very large number of great RAD frameworks run in node.js
#####Vagrant + Salt: This will make getting this application up and running (so it can be evaluated \ improved) on other pc's much easier
###Client-side libraries #####JQuery\Jquery-ui Makes DOM manipulation \ ajax \ and event binding easier and cross platform
#####Underscore Needed to compile client side coffee-script and has some really cool helper functions to help help with my FP approach (did not use any of them however)
#####Nothing Else? I was thinking of using backbone, however I was not doing anything that would warrant overhead of defining everything under the backbone structure, however I did copy its core philosophy so I guess its there in spirit!
###Server-side libraries #####Express.js Its a very well established web application framework although it is lightweight it has alot of support baked in, and extending it on the chance that it did not do what I needed would not be difficult.
#####Sequelize This is an ORM framework that makes working with databases very easy and efficient, this made defining a setup process for the database very easy.
Rendering components client-side is required for real-time applications, and allows for better separation of concerns between the Server and Client, The server now became only responsible for API access and serving static content, and the client responsible for processing data from the API and communicating with it.
I Moved all application state to Model and Model.state and had the rest of the application either manipulate that or base its own state upon it. This made developing this application easy and resulted in less time troubleshooting bugs as there is less that can be caused by taking this approach.
This application was designed to be run on a mobile phone and the design involved large portions of the screen being re-rendered every second. DOM manipulation can be expensive, and managing state in a UI can become difficult and hard to troubleshoot (page taken out of the backbone.js book).
The phone interview alluded to heavy application of REST, and Cross origin resources, so I thought I would make my application Cross origin friendly, which it is entirely.
I used a CSS Theme similar to Twitters Bootstrap, this was entirely to allow for the delivery for a visually pleasing product without having to sacrifice time from other area's of the application. However this did require an understanding of CSS to build the interface correctly.