freeCodeCamp / freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.
http://contribute.freecodecamp.org/intro
BSD 3-Clause "New" or "Revised" License
401.14k stars 37.06k forks source link

missed opportunity to teach ascii table character-to-number conversions in spreadsheet proj step 11 #55704

Open hbar1st opened 1 month ago

hbar1st commented 1 month ago

Describe the Issue

in the spreadsheet project (js beta), step 11 suggests to campers that in order to create a range of characters, they need to convert their characters to a number. But they never mention why. This would have been a great opportunity to talk about the ASCII table and discuss how letters and their number codes are related instead of just giving instructions that must make absolutely no sense to a beginner.

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-functional-programming-by-building-a-spreadsheet/step-11

Your code

n/a

Expected behavior

before telling the camper to use .charCodeAt() to convert their single character to "a number", the step should talk about the significance of that number and how it relates back to the character (via a lesson on the ASCII table hopefully). This may involve adding an extra step or two to complete this explanation well.

Screenshots

No response

System

N/A

Additional context

No response

naomi-lgbt commented 3 weeks ago

I'd be fine with expanding the text to mention a bit more:

Your range function expects numbers, but your start and end values will be strings (specifically, they will be single characters such as A).

Thankfully, every possible character has a corresponding ASCII character code. You can convert a character to its ASCII code with the .charCodeAt() method.

Convert your start and end values in your range() call to ASCII codes by using the .charCodeAt() method, passing the number 0 as the argument to that method.

hbar1st commented 3 weeks ago

I appreciate that but it would still leave everyone in the dark who has never heard of the concept of representing characters as numbers? A real lesson could cover it though.

naomi-lgbt commented 3 weeks ago

Sure, but I don't think it's a concept that necessarily warrants it's own step or lesson. I think it's important to remember that we aren't going to be the single source of information - there's too much to teach.

This seems like a case where providing more information ultimately distracts from the goal, which is teaching the camper how to code.

hbar1st commented 3 weeks ago

Can you elaborate more on why teaching this idea (that characters are represented as numbers) is not warranting of its own lesson.

There's no question that we cannot be the single source of information to all concepts that a programmer needs to know. It's just that in this case, it is such a basic concept that is taught in all intro to programming courses I'm aware of (even at a high-school level).

naomi-lgbt commented 3 weeks ago

Because the spreadsheet project is already overly complicated and shoving more into it isn't going to be helpful? And ASCII codes aren't a deep enough topic to create a whole new project from. And no other project in the curriculum uses charCodeAt - which might be something to fix, but honestly the only time I've ever used charCodeAt was for leetcode I don't think I've ever used it in production.

hbar1st commented 3 weeks ago

yeah I agree it is overly complicated. But I was of the opinion that explaining why it does things better would be helpful. I don't really have a comment on teaching charCodeAt per se but I will say that it seems the only time I have ever needed to use something like that in real life was to print out a copyright symbol (and to look up codes for symbols that I didn't want to get translated). That's pretty much it for me.