foundersandcoders / mc-waterfall-chaser

:droplet: ~~Don't~~ Go Chase[ing] Waterfalls :droplet:
1 stars 0 forks source link

London found this so hard! #5

Open developess opened 6 years ago

developess commented 6 years ago

Some ideas for improvement:

Eloquent JavaScript has a good little introduction to recursion:

It is perfectly okay for a function to call itself, as long as it doesn’t do it so often that it overflows the stack. A function that calls itself is called recursive. Recursion allows some functions to be written in a different style. Take, for example, this alternative implementation of power:

function power(base, exponent) {
  if (exponent == 0) {
    return 1;
  } else {
    return base * power(base, exponent - 1);
  }
}
console.log(power(2, 3));
// → 8

This is rather close to the way mathematicians define exponentiation and arguably describes the concept more clearly than the looping variant. The function calls itself multiple times with ever smaller exponents to achieve the repeated multiplication.

But this implementation has one problem: in typical JavaScript implementations, it’s about three times slower than the looping version. Running through a simple loop is generally cheaper than calling a function multiple times.

DenisKent commented 6 years ago

:thumbsup: Agreed, a brief introduction to simple recursion problems might make the solution here more intuitive.

MissArray commented 6 years ago

I think many people in FAC14 felt that, although the waterfall challenge has some value, on the whole it was so frustrating and so advanced, that it didn't make sense to include it in the curriculum, at least not as early as week 3.

arrested-developer commented 6 years ago

I added a short intro to recursion for FAC15 (writing a function to calculate factorials). The cohort got close, but nobody solved the challenge.

IMO This either needs to come much later in the course, or be removed entirely

tawfiknasser commented 5 years ago

For FACN5 we also made an introduction to recursion. 5 min : Small conversation on recursion, call backs and async code. 7 min : Fun fun video link simple example. 10 min : Code along solving factorial number with recursion. 10 min : Explaining the code and different perspective on looking and understanding the recursion. 3 min : Go through the existed watefall challenge code.

Half of the class managed to solve it while the others were close to the solution.