Skip to content

Latest commit

 

History

History
56 lines (48 loc) · 1.69 KB

README.md

File metadata and controls

56 lines (48 loc) · 1.69 KB

Lambda University - July 27, 2017: Day 018, Thursday

Coding Challenge #14


1st Lecture w/Ben Nelson: Review Code Challenge #13 constructors

  • Object Oriented Design

  • the inheritance is like a tree

  • ES6 classes are syntactic sugar built upon ES5 Prototypes

  • constructor(options) vs constructor(props) vs constructor(foofie) same difference?

  • private methods? e.g. so only a DM can set character levels - JS uses pseudo privacy, just a convention. Something similar can be done with closure, or checking is caller is inrtended function otherwise returning false.

  • different syntax for node, but you could break down each class into a file, make import and export statements and then have a game.js file which runs the game and imports all the classes

    • /gameClasses/NPC.js
    class NPC {
      constructor(options) {
        ...
      }
    }
    
    export default NPC;
    • /gameClasses/Humanoid.js
    import NPC from './NPC'
    
    class Humanoid extends NPC {
      constructor(options) {
        super(options);
        ...
      }
    }
    
    export default Humanoid;
    • game.js
    import NPC from './gameClasses/NPC.js'
    import Humanoid from './gameClasses/Humanoid.js'
    
    ...do stuff
    
    run(game):
  • above is a React style import/export, but here's how with node: https://github.com/bpesquet/thejsway/blob/master/manuscript/chapter24.md#nodejs-modules


LUNCH


Brown Bag w/Lois Truby: ASL & Deaf Culture


2nd Lecture w/Ryan Hamblin: Sprint / Q&A


fin