5 ms·
The new approach in mind is how many of us who learned basics of programming as kids have done it, or learned anything at all. Makes sense to me. Learning imme
by gdcbe 3y ago
The new approach in mind is how many of us who learned basics of programming as kids have done it, or learned anything at all. Makes sense to me.
Learning immediately about for loops, functions, variables, parameters, and any other concept you might consider basic, is putting a mountain of abstraction in front of someone that most are not prepared for.
As such i think within the context of your web course that new approach is going to make it a lot easier to get started. And I’m sure there are plenty of places for hooks for those students that want to go deeper :)
- karmakaze 3y agoIf we taught functional programming first, there's a log we can do without. We don't need variables that vary--only reference names that are assigned once within a scope. We can also eliminate loops and associated off-by-1 mistakes using map, reduce, etc. This of course puts different 'hard' things up front like applying a function over a collection of data, but that's one that scales well, IMO. But we also hit recursion sooner, that could be a difficult hurdle as it requires a big 'trust me this works' until a better understanding is gained. Again this scales better as it teaches making a smaller instance of the problem to solve at each level/layer that's universal in decomposing problem into similar and/or dissimilar parts.
- qaisjp 3y agoThat's what my university did. First semester was Haskell and Logic (truth tables, state machines), and some other stuff Second semester was Java, and some other stuff
- karmakaze 3y agoWere there many that seemed to have more difficulty with this introduction than if they were shown a procedural language, that you noticed? My hunch is that to complete beginners a declarative approach is simpler than a 'play computer' mental simulation to coding. We shouldn't be initially shown what's effectively a Turing machine and save that for a later Theory of Computation or intro to procedural languages.
- karmakaze 3y ago> And then came JavaScript. Well, along came real computer programming. It could have been Python or some other language, I think, but the transition to writing programs, even short bits of code, took the wind out of the students' excitement. The big change here is the procedural (time/execution steps, mutable variables) nature of these languages. Functional programming can be taught from a declarative perspective which is more along the lines of HTML/CSS.
- The_Colonel 3y ago> This of course puts different 'hard' things up front like applying a function over a collection of data, but that's one that scales well, IMO. I think this depends on the audience. If you want to teach programming to people with less talent/passion for math, I believe you can have more success with procedural/imperative programming, which IMHO requires less abstract thinking than functional programming.
- karmakaze 3y agoI'm on the fence about this, which is why I'm interested in hearing about cases where FP is taught as an intro. I sort of suspect that the younger folk (as in children) may be more comfortable with FP when you tell them that this phrasing does such-and-such without further explanation or understanding and be able to apply it. Grown-ups will question why a self-referential function can work at all and perhaps get hung up on it until they grasp recursion. In short it requires more abstract thinking to understand it, but understanding isn't necessarily required to apply it effectively.
- Tcepsa 3y agoI think in some ways functional programming is easier to understand conceptually; it's a closer match to how I think about things. Like if I want to transform an array, I don't think "I want to create a new, empty array and then loop over the first array and call a function on each value and put the result in the new array", I think "I want to run this function on all the values in this array" (same for filter, same for find...). Reduce is a bit trickier, perhaps, but if you start with the example of finding the sum of all the values in an array that probably lays a decently intuitive foundation for it as well. So yeah, I don't consider myself a particularly math-y person, but I find functional programming to be a more straightforward and less fiddly way of going from a design in my head to something the computer can execute.
- The_Colonel 3y ago> I want to run this function on all the values in this array I think most people get lost on the "run this function". My impression from high school math classes is that very few people understand the concept of a function in abstract terms. Like, they will learn that sin(90) = 1, because it's a particular, specific function, but they don't understand functions as "first class citizens" in the sense of "apply this function to this array". That seems like a new plane of abstraction to which many never get.
- dmitry-vsl 3y agoI am building an IDE for functional JS. It can visualise a call tree of a program, helping to understand execution of recursive functions http://leporello.tech/ http://leporello.tech/