Skip to content

billingb/bowling-scorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bowling-scorer

Intro

A javascript utility to score a bowling game interactively. Created for a challenge provided as part of the interview process for a software engineering position.

Challenge Definition

Create an application to score a bowling game, first for a single player and then for multiple players. Full challenge details

Notes and Questions

The basic version was completed at hash 1171112

I decided to use JavaScript to complete this challenge as I’ve been wanting a good small problem to write functional JS and I have also wanted to use ES6 (ES2015). This code is my first interactive JS program and the first time I have done a purely functional javascript approach. I'm proud of what I've produced here, but I’m sure there are improvements that can be made.

The one thing I would raise for code review is a question, am I being too clever with the scoring by keeping it all as a string for each player? More generally, should the data structure contain more explicit data such as current player turn, frame, ball number, etc? If I had been developing this with a team I would definitely have talked over this design aspect with team members. On one hand I really like how it turned out, but I’m not sure if I’m sacrificing code readability.

Continuous Integration

Travis CI is running continous integration for this project at https://travis-ci.org/billingb/bowling-scorer

Developer Quick Start

for full instructions see the "Full Installation Instructions" at the bottom of this page

Prerequisites

  • node.js version 4 or newer (this project uses ES6)

Running the utility

  • npm install to fetch the dependencies
  • npm start

Working on the project

Workspace Setup

  • Run npm install to fetch the dependencies

Linting

  • Run npm run lint

Unit Testing

  • Run npm test or npm test:watch

Full Development Instructions

Install node.js

This program requires the node.js JavaScript runtime and node package manager (npm). A good beginners guide for these technologies is available at https://nodejs.org/en/about/. There are a few options for installing the runtime:

After installing make sure node and npm are on the path by running node -v and npm -v. If either of these commands fails then something went wrong in the installation. Recheck that the node and npm executables are in place and you have added them to your path.

Installing application dependencies

After NPM is installed execute npm install to install all the dependencies for this application.

Running the program

To run the program execute npm run exec

Testing

This application was written using test driven development (TDD) with the Mocha test framework (https://mochajs.org/) and the Chai Assertion Library (http://chaijs.com/). The tests are all written using the should syntax provided by Chai. There are unit and acceptance tests, with the acceptance tests in a file Acceptance_spec.js and all other spec file containing unit tests. To run the tests execute npm test. To run the tests in watch mode, so they will re-run whenever a file is changed, execute npm run test:watch

Linting

When developing on this application the linter, jshint (http://jshint.com/docs/) should be run to help keep the code clean. JSHint can be run by executing npm run lint

Development Thoughts

ES6 (ES2015)

This is the second application I have had the opportunity to use the new ES6 standard for. I wanted to take this opportunity to learn more about the new language features that have been introduced and start getting comfortable with those features. I still have some inconsistency in using the new features and figuring out how they best fit, for instnace I use the arrow functions in the code (=> syntax) but in the tests I wrote the older syntax in the it and describe lines.

Functional Style, Immutable.js

I wanted to use a functional style in this program as I have been learning Clojure lately and really like the functional paradigm. I decided to use Immutable.js (https://facebook.github.io/immutable-js/) to get Clojure style data structures that are much safer to write functional code with since they prevent accidental side effects.

About

Input pins knocked down and the application will score the bowling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published