JS1 Week 1 - module restrucure #615
Replies: 5 comments 6 replies
-
I think this generally sounds very reasonable, and like it makes a lot of sense. Definitely a big improvement over what we have today! The other approach I've thought about for restructuring JS1W1 is to push everything into the browser with a lot of scaffolding. Maybe a simple HTML page which has an onClick handler or similar for some button, and have the trainees edit a .js file which has the onClick handler do something for them. Advantages of HTML:
That said, I think the proposal in this discussion is much more strong at being able to introduce concepts one at a time, and also strip away magic - not needing any scaffolding, not having the entwined complexity of a bunch of browser glue code, and being able to just do one thing at a time and reason about it - all really great properties. |
Beta Was this translation helpful? Give feedback.
-
I think this looks great and I think we should do it! For testing, I think we should be testing in js1 week 1, but I agree that if the tests are being run in the command line, that's a bit much |
Beta Was this translation helpful? Give feedback.
-
This all sounds good to me - I'd also agree that testing probably shouldn't come in the first two weeks, at least not before a decent introduction to functions (but yes, should ideally follow soon after that, because the idea that we can test a function as a black box is a powerful one, and can be easily demonstrated using e.g. I also think starting in the browser may risk being confusing at this stage, because of the somewhat magical scaffolding needed. So long as we do link back to what trainees have encountered before, and so long as it's clear that we will be returning to the browser (I assume to do DOM scripting), I suspect it wouldn't harm to do some "purer" first-principles programming stuff right at the start, and keeping in the REPL does have all the advantages described above. I'm very open to the possibility of that presenting conceptual hurdles, though. |
Beta Was this translation helpful? Give feedback.
-
Thanks for writing this up @Dedekind561 🙂 First of all, I think it is worth acknowledging that it sounds like we all have more radical ideas for the JS modules in general, but from what I'm understanding this proposal is scoped down to something achievable without throwing the whole content out. (Fwiw, my ideas are also around moving us to the browser. And heavily leaning into function calls, inspired by Processing 🙂) Within these constraints, I definitely think this would be an improvement over the current content and I'm in favour of moving forward with it. A couple of things I wanted to call out as particularly positive in my mind:
I have a couple of questions:
For next steps, I'd be keen to see some learning objectives 🙂 (Realise it's early days though!) |
Beta Was this translation helpful? Give feedback.
-
Hello folks, ✅ Things we agree on
❓ Questions for future discussion
🔨 Actions
|
Beta Was this translation helpful? Give feedback.
-
JS 1 Week 1 - thoughts on restructuring
The current JS1 Week 1 module is overloaded. Trainees are expected to learn about expressions,
console.log
, data types, variables, invoking functions, declaring functions, using NodeJS for the first time, side effects -return
vsconsole.log
. In addition to this, they're also expected to teach themselves about testing and test syntax too ( and this content is not on the JS 1 Week 1 syllabus page ). My proposal here is to completely remove function declarations out of this section and focus on this topic in another week.Proposal
Section 1
Topics covered
Creating and evaluating expressions; Introduction to data types - strings, numbers; using Node REPL, predict-observe-explain
Rationale
At the moment trainees are expected to start the course by executing a JS program with Node using the standard "hello world" program. This first lesson involves trainees calling
console.log
in order to get some terminal output.This section is taught whilst the following questions remain unanswered or partially unanswered:
It's worth noting that most trainees won't actually know the concepts that they don't know at this stage. However, by leaving the questions above unanswered, it implies we’re trying to introduce something without laying the proper groundwork. Does it make more sense for trainees to have some baseline intuition about a function and a function call before they start trying to understand what
console.log
does? I think a firstconsole.log
program is easier to understand when you’ve got the basic notion of a function and how it is called. Otherwise trainees are being expected to inspect some, at this stage, random syntax and remember what it does with very little context.Currently, we introduce a program like this:
but we can’t emphasise the fact that
console.log
is a function andconsole.log(“hello world”)
is a function call expression. It would be preferable to introduce some basic notion of a function and its call syntax before jumping straight to theconsole.log
program. By using the Node REPL, we can focus on executing JS code ( just by creating simple expressions ) without looking at: a)console.log
b) running a Node script b) function call syntax etc. Then when we coverconsole.log
for the first time we can connect this program to their previous knowledge of function calls.The other advantage of this approach is that the Node REPL evaluates code one line at a time. Trainees are forced to focus on the current expression they're writing and it becomes much easier for them to anticipate what will happen when Node evaluates their expression.
Section 2
Topics covered
Why use variables?; variable declarations anatomy: assignment,
let
,const
keywords;ReferenceErrors
; creating expressions using variables ( using Node REPL )Rationale
We can still rely on Node REPL too at this point in the lesson. I also think we could use this opportunity to introduce ReferenceErrors. Another advantage of the REPL here is that trainees don't need to parse a more complex error message with a potentially confusing stack trace. Trainees can focus on what is causing the error without having to track it down in the script at the same time. I think it's important to have errors and error messages embedded throughout the syllabus and not just an isolated section that we never refer back to.
Section 3
Topics covered
Introduction to functions - What are they and why do we need them?; invocation syntax - difference between
f
andf()
; function output/return values; calling functions likeMath.round
,Math.ceil
Rationale
At this point, we could introduce the notion of functions on a very general level. We could say something about functions being a unit of code that we can continually reuse to achieve some task in our program. ( I don’t think we should introduce function declarations at all at this stage). The beauty of the REPL is that we still don't need to introduce
console.log
at this point. Trainees can consider function call expressions likeMath.round(10.3)
andMath.floor(10.34)
without yet going toconsole.log
. I would argue thatMath.round(10.3)
is much easier to reason about initially thanconsole.log(10.3)
because trainees without a coding background are almost 100% likely to have some in-built intuition about rounding decimals numbers. Additionally,Math.round(10.3)
is easier to understand because it has a return value that we can store in a variable. This intuition will make the introduction of call/invocation syntax feel more intuitive itself as it is more closely tied to their prior knowledge. N.B. It's worth noting that"halden".toUpperCase()"
appears intuitive at first but is perhaps less so at this stage in the course; trainees should be developing an understanding that inputs are passed inside parentheses()
andtoUpperCase
breaks this pattern because it lives on theString
prototype.Section 4
Topics coveredRunning a script using Node; using
console.log
; side effects;return
vsconsole.log
, reading errors thrown by a scriptRationale
Finally we can now discuss the problem with using Node REPL as the only way to execute JS code. We can now show how to create more complex JS programs using files and then talk about how they are executed. It should now be much clearer why we need to appeal to
console.log
in order to get output in our terminals. In addition, trainees would already be aware of function call syntax and passing inputs into functions. With this knowledge already in mind, trainees can focus more clearly on what exactlyconsole.log
does in their program..Omissions
This approach would mean skipping tests at this stage in the course. I personally don’t think trainees should see tests till JS1 Week 4.
Beta Was this translation helpful? Give feedback.
All reactions