I'm asking a lot these days, but another #webdev question for the masses:
My HS web dev class is ready for a Javascript intro. I'm torn between:
- teaching the DOM and scaffolding off their HTML and CSS experience, or
- starting from the basics with variables, loops, and conditionals and work up to DOM interaction.
Any thoughts on pros/cons of each? Thanks in advance and feel free to boost for reach.
@brianb I think I'd be tempted to focus on the first. The second approach is about the fundamentals of programming, and is a whole course in its own.
Maybe start with the first and then give a very brief overview of all you can do in JavaScript, emphasizing that it's a full programming language in its own right?
I think if you start with the second it might be difficult to come back to the first.
@ehmatthes as I was typing it, I started to feel more the same. The document object is a good entry point and we can do little enhancements rather than full on apps.
When we get to data (fetch, arrays, etc) I think the other concepts come into play easily.
Thanks Eric.
@brianb I thought of you throughout the day. I was a classroom teacher for a long time. I was teaching in NYC on 9/11. I was teaching when Sandy Hook happened. I was teaching when the 2016 results came in.
It's so hard to go stand in front of young people on those days, and so necessary. Thank you for showing up today.
@brianb I think the former would feel smoother, building on what they already know.
And you don't have to do loops, conditionals, etc. all in one shot! You can sprinkle them in with the other stuff. Like, after doing "here's how you programmatically style an element/a DOM node", it's easy to do "here's how you do all the children of a node" (i.e., loop). Then do more of "the familiar stuff" and then come back and go, "what if we need to make a choice between things?"
Just an option.
@brianb Also note that if you do this, you can sort of sneak variables in as part of the other bits.
Another note: I'm not sure I'd explain variables as being "like the ones in algebra", because those are invariant, while programming variables are, well, more prone to varying their values. I feel like the only similarity between the two is that they use names to refer to things — but even that's not very similar, since algebra just uses letters and we prefer full words most of the time.
@kagan Good point. I did some very basic intro CS lessons at a MS a few years ago and variables were words that "represented other things," which worked well. Those other things can change, but it's a shorthand for other information you want to use. Kids seemed to pick up on it pretty quick as a concept.
@kagan Oh, for sure. We'll find times to do that kind of stuff.
I think our first demo will be to code along to make a simple dark mode toggle. Pick some colors, practice some layout options, but then throw a button in there to toggle a class which flips everything. It's a small touch, but it'll show what kinds of things JS could be used for.
@brianb Ooooh, that sounds like a great starting point! Easy, builds on what they already know, *actually useful*, and also visually dramatic! I love it.
@kagan I've just spent the last hour and a half writing up a lesson and wow, what a great reminder of how complicated some of these ideas are when you're first starting