ga-wdi-boston / js-objects-modeling

Other
1 stars 169 forks source link

Notes on scaffolding #16

Open jrhorn424 opened 8 years ago

jrhorn424 commented 8 years ago

I really enjoyed @berziiii's presentation.

In particular, when demoing modeling a laptop, he scaffolded adding behavior like togglePower() and installSoftware() by defining these functions outside the object and referring to the previously created object literal inside the bodies of the function.

let laptop = { /*...*/ };
const togglePower = function () {
  laptop.status === 'on' ? 'off' : 'on';
}

This gave us a chance to talk about encapsulation. We're hiding the "JavaScript" details of toggling power inside a well-named function that made sense in our domain.

Next, we noted our functions were related to our laptop but we had no way of knowing that from the source code. So, we could further encapsulate our behavior by adding it to the laptop itself.

let laptop = { 
/* ... */
  togglePower: function () {
-    laptop.status === 'on' ? 'off' : 'on';
+    this.status === 'on' ? 'off' : 'on';
  }
};

And we were presented an opportunity to use this without explaining it (which is the domain of js-objects-this).

@ga-wdi-boston/core Where should we keep notes on scaffolding? Wiki? In the README source as HTML comments?

gaand commented 8 years ago

I think in the repo is preferable.

Will talk specific scaffolding get lost in the README? Should we have teaching notes alongside the README.md? On the solution branch?

raq929 commented 7 years ago

I added a commit by commit example of this on the tutorial branch using the crayon example from the README.

raq929 commented 7 years ago

Is it OK to close this issue?

gaand commented 7 years ago

@raq929 When asking that questions, please at the person who opened the issue.

@jrhorn424 ☝️

jrhorn424 commented 7 years ago

@gaand I'll give you final say, but I'd prefer to leave this open until we decide where we're keeping these sorts of notes.

We haven't decided on a process for knowledge transfer that isn't directly part of the README. I know we've talked about it a few times, but I think we need to make a decision.

gaand commented 7 years ago

:robot:

danman01 commented 7 years ago

Rachel said she wants to move towards putting these in the wiki, so I added it here: https://github.com/ga-wdi-boston/js-objects-modeling/wiki/Delivery-Notes