-
Map the student's request for help to one of the underlying problems listed below.
-
Apply one of the suggested solutions.
-
Ask the student for feedback on your help.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var landscape = new Landscape(); // one actor | |
// make instance of Machine and get the root nodes for each actor | |
var machine = new Machine(); | |
landscape.state = machine.generateTree(landscapeJson, landscape); | |
// every second, something happens in the ecosystem | |
setTimeout("step()", 1000); | |
var step = function() { | |
// trigger the next state transition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
identifier: "idle", strategy: "prioritised", | |
children: [ | |
{ | |
identifier: "spot", strategy: "sequential", | |
children: [ | |
{ identifier: "callRange" }, | |
{ identifier: "stopSpotting" }, | |
] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use test-driven development to write a method that: | |
# * Takes an array of numbers. | |
# * Returns the sum of the numbers in the array. | |
# * e.g. | |
# * Input: [1, 2, 3, 4, 5] | |
# * Return: 15 | |
# * Make sure to create a separate project directory for your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use test-driven development to write a method that: | |
# * Takes an array of numbers. | |
# * Returns an array of the same numbers, except each number has had 1 added to it. | |
# * e.g. | |
# * Input: [1, 2, 3, 4, 5] | |
# * Return: [2, 3, 4, 5, 6] | |
# * Make sure to create a separate project directory for your code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OVERVIEW OF THE WEEK | |
- Encapsulating Single Responsibilities (rather than just common behaviour) into classes | |
- makes code easy to reuse | |
- makes code easy to change | |
- makes code easy to understand | |
- Refactoring code for SRP | |
- Adopt this code writing process |
This Gist was automatically created by Carbide, a free online programming environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A practical introduction to functional programming | |
Many functional programming articles teach abstract functional techniques. That is, composition, pipelining, higher order functions. This one is different. It shows examples of imperative code that people write every day and translates them to a functional style. | |
The imperative examples are all loops. The first section of the article takes short, data transforming loops and translates them into functional maps and reduces. The second section takes longer loops, breaks them up into units and makes each unit functional. The third section takes a loop that is a long series of successive data transformations and decomposes it into a functional pipeline. | |
The examples are in Python, because many people find Python easy to read. A number of the examples eschew pythonicity in order to demonstrate functional techniques common to many languages: map, reduce, pipeline. | |
## A guide rope |
NewerOlder