4 ms·
I’ve taught programming to people who struggled because they were misusing JS and the answer they were getting back coincidentally worked for some inputs but no
by asimpletune 5y ago
I’ve taught programming to people who struggled because they were misusing JS and the answer they were getting back coincidentally worked for some inputs but not others.
Imagine trying to explain to them that this was their fault? Even trying to find the words to explain what happened made me feel bad that their first experience programming was tarnished by a language that will gladly allow you to do nonsense.
- ozim 5y agoCan it be that JS is not good starting language then? Maybe strongly typed compiled languages would be a better fit? One can argue that if you want to program it might be too much information for starters - but IMO basic types are such a fundamental concept that it would be better to teach that concept early on. It also clears up a lot of newbie confusion as you cannot assign string to an int by mistake with strongly typed language. Such scenarios are then handled by compiler so newly starting dev has quick feedback on fundamental issues with his code without having to ask people around.
- asimpletune 5y agoYeah, pretty much everything you mentioned was made clear to me after this.
- darksaints 5y agoThe problem with strongly typed languages is that it makes it infuriating whenever you have to work in a language without the same type guarantees. JavaScript made me want to throw my computers off the top of a skyscraper until I discovered typescript, and typescript just barely makes things slightly tolerable.
- denton-scratch 5y ago> Can it be that JS is not good starting language then? @ozim, I don't believe you are trolling! JS is an absolutely awful language for beginners; it's a 155mm howitzer pointed at your foot. Although you can get the hang of the basics quickly, AND it runs in the browser (super-convenient unless you're headless), those "basics" that you thought you'd got the hang of turn out to have semantics that make sense, but are not what you expected. I wrote JS (about 0.2 of my time, I guess) for my job, for about 20 years. I got 18 out of 25 on that test. Now, I think it was actually an easy test; I got a third of my answers wrong because I haven't learned about a third of JS semantics. I'm either not very good, or not as smart as I like to think. A certain recent colleague of mine would probably have got 25/25; he was cleverer than me, and he was REALLY into Javascript. Try a Pascal-type language, to learn an imperative-type language. Modula2 is better. Learning Prolog is (I think) purely declarative, so it gives you the view from the other side of the curtain - as it were. Forth is a perfectly-feasible beginner's language; it was the second language I learned. I can't recommend any OO language for beginners. Not because I think all OO languages are way too difficult, only all the ones I've used. I haven't used Smalltalk. I haven't used any flavour of Lisp. That language is so pliable that I'm sure there's a flavour that would be good for beginners. [edit] Actually, I wish I had learned a functional language like Lisp as my starting language; I strongly suspect that would have made me a better programmer throughout my career.
- ozim 5y agoI am not trolling just a honest question based on parent poster experience. I agree OO is too much for any beginner. Getting started with procedural thinking + basic types is in my opinion a requirement. I agree nice parts about starting with JS is that basically only things you need is text editor and a browser. Unfortunately data types will show up one way or the other so there is no need of hiding those. Even in Excel creating formulas one has to understand text vs number and difference between '.' and ',' and how operating system configuration make sometimes '.' to be decimal separator and sometimes ','.
- Hermitian909 5y agoHaving designed programming curriculum, I have to disagree that the language is a bad language for beginners (though it is very far from ideal). To be fair the primary reason is not really a virtue of Javascript per se, but the fact that it runs in the browser is a large pedagogical gain that no other language can easily match and is hard to overstate. Learning to program is overwhelming for most students, and setting up your environment is a major component of that. Being able to run your code natively in the browser is a huge boon. Even better, having that code immediately be useable in a very real sense boosts motivation significantly. For most students it really is preferable to let students get very comfortable with basic code constructs before having to interact with the underlying system in any meaningful way. At the language level, Javascript also has some nice affordances that let you treat constructs as simpler than they are in your curriculum and expand on them later. I think the best example of this is `var`. Viewing variables as uncomplicated "buckets" that happily contain any data you want to shove in them is a good starting place when introducing the very first building blocks of something like if/else control flow. Most languages are built with semi-experienced programmers in mind and are ill-suited for many beginners and actively bad for children. As an easy example: as a developer I like seeing type specifications for numbers, but pedagogically having to introduce the difference between ints and floats on the first day is just empirically confusing for most students. Much better for them to be "magic" until you can properly motivate them to care (which can be just a few weeks in!) I could write on this topic far longer than I have, but the short of it is that Javascript has done a truly surprising number of things right for a teaching language. I'd still love to remove some of the zany examples here if I could though.
- SavantIdiot 5y agoThis is why Pascal and COBOL were the CS101 languages at my college. (RPI class of '85)