Giter Site home page Giter Site logo

jsconf2013-data-structures's Introduction

In this assignment, we'll implement and test a stack:

Requirements

  • Implement a stack class
  • Throughly test the functionality of your stack.

Tasks

  • Run the (mostly empty) test suite

    • This repo contains a mostly empty Mocha test suite. To run it, open up SpecRunner.html.
  • Refactor your stack to use the following methods of instantiation:

    1. Functional instantiation: a simple "maker" pattern (This is already done!)
      • Do:
        • Work within the src/functional/ folder.
        • Define all functions and properties within the maker function.
      • Don't:
        • Use the keyword new, the keyword this, or any prototype chains.
        • Capitalize the maker function name.
      • Example: The provided class makeStack already follows this pattern
    2. Functional instantiation with shared methods: same as step 1, but with shared methods
      • Do:
        • Work within the src/functional-shared/ folder.
        • Create an object that holds the methods that will be shared by all instances of the class.
        • You'll need to use the keyword this in your methods.
        • Use _.extend to copy the methods onto the instance.
      • Don't:
        • Use the keyword new or prototype chains
      • Example: functional instantiation example
    3. Prototypal instantiation: using Object.create
    4. Pseudoclassical instantiation: create instances with the keyword new
      • Do:
        • Work within the src/pseudoclassical/ folder.
        • Capitalize your function name to indicate that it is intended to be run with the keyword new
        • Use the keyword new when instantiating your class
        • Use the keyword this in your constructor
      • Don't:
        • Declare the instance explicitly
        • Return the instance explicitly
      • Example: pseudoclassical instantiation example

Extra credit

  • Use the Chrome profiling tools to compare the performance of each instantiation pattern.
    • Create a profiling test case in each of your test suites. It should instantiate and use a large number of stacks.
    • Comment out all but one test suite. Record the results of the profiler. Repeat for each step of the refactor.
    • Write a brief analysis of your results.

Copyright 2013, Hack Reactor, LLC. All rights reserved.

jsconf2013-data-structures's People

Contributors

sharksforcheap avatar lazd avatar shawndrost avatar ndhoule avatar marcusphillips avatar whoaa512 avatar

Watchers

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