On the weekend I was helping my youngest daughter with an unfairly difficult programming project for Gr 11 Computing Science. They were expected to write a web application that retrieves data from a data source on the internet. A list of potential datasources was given, but they hadn't been well tested since several we tried wouldn't answer the programs request. The truly unfair part was that they were expected to understand how to retrieve data asynchronously. Too bad they had never been taught about async. Our final body of code was 100 lines of JavaScript and another 100 of html/css.
?
On the way we encountered a JavaScript function that took a boolean parameter, so the code read like: FooBar(..., True). We discussed why this is a poorly written function and then I promised: "I promised even if I'm fifty years dead, I will return from the grave too haunt her if she ever writes a method that accepts a boolean parameter." The laughter that followed is what started our quest. She would like a book(s) that will help learn to be a good programmer. We already have Petzold's Code 2nd Edition on order. (Her call not mine).
?
Where else would you go for: program design, opinion around good/bad practice (and why)? Strong preference for an example driven book. As it stands?
?
So far I've looked at:
- Headfirst JavaScript - Chapter 8 before we start building something noticeable
- Joy of JavaScript - Larsen (Manning) - starts with a solid example in ch1. _This could be good, although I already see the code is missing modern things like let _
- Wes Bus online courses - I've seen two people suggesting his material is it good?
- https://www.educative.io/courses/the-complete-javascript-course-build-a-real-world-app-from-scratch - _can't tell if it is good or just long_
?
Discarded:
- https://www.codecademy.com/catalog/language/javascript - Not convinced the quality is even
?
Along with JavaScript, Java is the other programming langauge that she will learn next year, any books there??
On Jun 22, 2023, at 3:24 PM, Mark Levison <mark@...> wrote:
?
On the weekend I was helping my youngest daughter with an unfairly difficult programming project for Gr 11 Computing Science. They were expected to write a web application that retrieves data from a data source on the internet. A list of potential datasources was given, but they hadn't been well tested since several we tried wouldn't answer the programs request. The truly unfair part was that they were expected to understand how to retrieve data asynchronously. Too bad they had never been taught about async. Our final body of code was 100 lines of JavaScript and another 100 of html/css.
?
On the way we encountered a JavaScript function that took a boolean parameter, so the code read like: FooBar(..., True). We discussed why this is a poorly written function and then I promised: "I promised even if I'm fifty years dead, I will return from the grave too haunt her if she ever writes a method that accepts a boolean parameter." The laughter that followed is what started our quest. She would like a book(s) that will help learn to be a good programmer. We already have Petzold's Code 2nd Edition on order. (Her call not mine).
?
Where else would you go for: program design, opinion around good/bad practice (and why)? Strong preference for an example driven book. As it stands?
?
So far I've looked at:
- Headfirst JavaScript - Chapter 8 before we start building something noticeable
- Joy of JavaScript - Larsen (Manning) - starts with a solid example in ch1. _This could be good, although I already see the code is missing modern things like let _
- Wes Bus online courses - I've seen two people suggesting his material is it good?
- https://www.educative.io/courses/the-complete-javascript-course-build-a-real-world-app-from-scratch - _can't tell if it is good or just long_
?
Discarded:
- https://www.codecademy.com/catalog/language/javascript - Not convinced the quality is even
?
Along with JavaScript, Java is the other programming langauge that she will learn next year, any books there??
David - thanks as always for responding in any context.
I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use.
Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group.
JavaScript the Good Parts - I know it. I’ve skimmed it myself.?It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth.
(Sad note - 15yrs after Crockford’s book, JavaScript is no better)
On the way we encountered a JavaScript function that took a boolean parameter, so the code read like: FooBar(..., True). We discussed why this is a poorly written function and then I promised: "I promised even if I'm fifty years dead, I will return from the grave too haunt her if she ever writes a method that accepts a boolean parameter."
Alright, I'll bite: what is the issue you see with having a boolean parameter?
A boolean parameter means you have two functions crammed together, and they should therefore be two different functions.
Most importantly though, nobody reading the code can know what that boolean means without diving deep, and could easily use it backwards or understand it backwards.
On Fri, Jun 23, 2023, 17:36 David Rosenstrauch <darose@...> wrote:
On 6/22/23 5:23?PM, Mark Levison wrote:
> On the way we encountered a JavaScript function that took a boolean
> parameter, so the code read like: FooBar(..., True). We discussed why
> this is a poorly written function and then I promised: "I promised even
> if I'm fifty years dead, I will return from the grave too haunt her if
> she ever writes a method that accepts a boolean parameter."
Alright, I'll bite:? what is the issue you see with having a boolean
parameter?
On Thu, Jun 22, 2023 at 7:43?PM Mark Levison <mark@...> wrote:
David - thanks as always for responding in any context.
I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use.
Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group.
JavaScript the Good Parts - I know it. I’ve skimmed it myself.?It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth.
(Sad note - 15yrs after Crockford’s book, JavaScript is no better)
A boolean parameter means you have two functions crammed together, and they should therefore be two different functions. Most importantly though, nobody reading the code can know what that boolean means without diving deep, and could easily use it backwards or understand it backwards.
Hmmm ... just my $0.02, but I don't really agree with either one of those.
* It *could* mean that you have 2 functions crammed together. Or it could not.
* Depending on the language, readability is not necessarily an issue.
A boolean value is just ... a particular type of value, just as an int is. I don't see that it should be considered or treated any differently. And you could make both of those same arguments for an int values. (Say, if you were passing an int parameter for "record_type".)
Seems like this is a case where an effort to address a fairly narrow use case is being unnecessarily and erroneously widened to become a pretty arbitrary and onerous blanket rule.
On Fri, 23 Jun 2023 at 18:30 David Rosenstrauch <darose@...> wrote:
On 6/23/23 11:44?AM, Avi Kessner wrote:
> A boolean parameter means you have two functions crammed together, and
> they should therefore be two different functions.
>
> Most importantly though, nobody reading the code can know what that
> boolean means without diving deep, and could easily use it backwards or
> understand it backwards.
Hmmm ... just my $0.02, but I don't really agree with either one of those.
* It *could* mean that you have 2 functions crammed together.? Or it
could not.
* Depending on the language, readability is not necessarily an issue.
A boolean value is just ... a particular type of value, just as an int
is.? I don't see that it should be considered or treated any
differently.? And you could make both of those same arguments for an int
values.? (Say, if you were passing an int parameter for "record_type".)
Seems like this is a case where an effort to address a fairly narrow use
case is being unnecessarily and erroneously widened to become a pretty
arbitrary and onerous blanket rule.
David - I will share the original context and my thinking. I ask a favour. In returning for hijacking my thread whose purpose was to help a 16yr old, please offer a book recommendation.
Background: Neither of us know JavaScript well. We're battling a foreign language and so we're searching for tutorials etc. We don't know about async await() - I figured that out late on Saturday.
Our first attempt found a tutorial with code for: XMLHttpRequest().open() can take a boolean parameter. The tutorial passed in true. Not variable=True, just true. What did this mean? It cost another five minutes of searching and reading.?
Imagine the fun:? - We know we need some form of async because I know you can't block the main thread of page loading data - We search and find XMLHttpRequest().open(...., True); - Now we need to search the docs.
We ended up 3 levels deep just trying to solve a simple problem. -- Even your clever?sort_keys=True trick is just a convention. If people don't obey the convention the code is harder to read.
My rule people writing code - your job to is reduce the cognitive load for the reader. At any one time we can realistically keep track of 2-3 concepts. Is keeping track of a boolean really what you want their brain to be doing??
To set aside the discussion for a moment? Are you using intellj? The warnings alone saved me from some missing awaits. And always worth exploring the suggestions.?
IntelliJ - I assume you mean webstorm? Or is this regular IntelliJ with a plugin?
Either way, no. Programming is no longer my professional work. I dabble:?, but would rather leave the paid technical coaching/training work to people like JB, Jeff, Tim, Mike etc. (I went to the dark side a few years ago).
So I don’t pay for an IDE. I’ve been using VS Code and my daughter thinks that it is massively better than the “Blackboard” tool the teacher provided.
On Jun 23, 2023, at 6:18 PM, Mark Levison <mark@...> wrote:
?IntelliJ - I assume you mean webstorm? Or is this regular IntelliJ with a plugin?
Either way, no. Programming is no longer my professional work. I dabble:?, but would rather leave the paid technical coaching/training work to people like JB, Jeff, Tim, Mike etc. (I went to the dark side a few years ago).
So I don’t pay for an IDE. I’ve been using VS Code and my daughter thinks that it is massively better than the “Blackboard” tool the teacher provided.
On Fri, Jun 23, 2023 at 8:44?AM Avi Kessner <akessner@...> wrote:
A boolean parameter means you have two functions crammed together, and they should therefore be two different functions.
Most importantly though, nobody reading the code can know what that boolean means without diving deep, and could easily use it backwards or understand it backwards.
On Fri, Jun 23, 2023, 17:36 David Rosenstrauch <darose@...> wrote:
On 6/22/23 5:23?PM, Mark Levison wrote:
> On the way we encountered a JavaScript function that took a boolean
> parameter, so the code read like: FooBar(..., True). We discussed why
> this is a poorly written function and then I promised: "I promised even
> if I'm fifty years dead, I will return from the grave too haunt her if
> she ever writes a method that accepts a boolean parameter."
Alright, I'll bite:? what is the issue you see with having a boolean
parameter?
I've never used Java much, nor JavaScript, so the good books on becoming a good programmer I can think of don't give examples in those languages, and they also tend to use the idioms of the languages they do use for examples, and those idioms don't always have an analog in Java (modern JavaScript has adopted many of them, though).? But IIRC, the examples in??are in Java.
Al
On Thursday, June 22, 2023 at 04:43:28 PM PDT, Mark Levison <mark@...> wrote:
David - thanks as always for responding in any context.
I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use.
Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group.
JavaScript the Good Parts - I know it. I’ve skimmed it myself.?It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth.
(Sad note - 15yrs after Crockford’s book, JavaScript is no better)
The book “?Software Design by Example: A Tool-Based Introduction with JavaScript : Wilson” seems to match what you’re looking for; I only just started reading it but I like it so far
On Sat, 24 Jun 2023 at 01:23 Al Chou via <hotfusionman=[email protected]> wrote:
I've never used Java much, nor JavaScript, so the good books on becoming a good programmer I can think of don't give examples in those languages, and they also tend to use the idioms of the languages they do use for examples, and those idioms don't always have an analog in Java (modern JavaScript has adopted many of them, though).? But IIRC, the examples in??are in Java.
Al
On Thursday, June 22, 2023 at 04:43:28 PM PDT, Mark Levison <mark@...> wrote:
David - thanks as always for responding in any context.
I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use.
Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group.
JavaScript the Good Parts - I know it. I’ve skimmed it myself.?It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth.
(Sad note - 15yrs after Crockford’s book, JavaScript is no better)
JavaScript, particularly front-end JS, is a tyre fire. I've been a part of the JS community since 2010. Common usage is driven by fashion (currently React) and tooling is ferociously complicated. There don't appear to be any books that teach JavaScript by using TDD, because TDD is (still, after >20 years) an incredibly niche practice. Most front-end peeps still don't TDD, as such book publishers probably recognise that if you want to learn JS, you probably aren't interested in TDD. There are plenty of books that teach TDD, and plenty of books that teach JS. You'll have trouble enough finding a book that teaches front-end JS that is anywhere near current practice, because current practice changes so quickly. Crockford's book is great, but you surmised correctly that it is only useful once you've already learned JS. All I can offer you is the advice that if you search for 'JavaScript', you will get everything from latest (ES2023, or ES14) to original JS circa 1995. At least if you search for 'ES6' instead, or even 'ES2020' you are going to get more relevant search results.
We used to say "don't start by teaching people Java, try something simpler, like JavaScript', but now JS is IMHO more complicated than Java. I'm sorry it is not what you wanted to hear, but my advice would be to get through the JS portion of the course and to concentrate on Java. Personally I think Python is a better introduction to programming than either JS or Java, but if your daughter is learning to pass exams, then you need to stick to the curriculum :( Head-first Java by Kathy Sierra is an excellent introduction, and Effective Java by Joshua Bloch is the definitive next step guide to idiomatic Java programming.
On Sat, 24 Jun 2023 at 07:27, Matteo Vaccari <matteo.vaccari@...> wrote:
The book “ Software Design by Example: A Tool-Based Introduction with JavaScript : Wilson” seems to match what you’re looking for; I only just started reading it but I like it so far
On Sat, 24 Jun 2023 at 01:23 Al Chou via groups.io <hotfusionman@...> wrote:
I've never used Java much, nor JavaScript, so the good books on becoming a good programmer I can think of don't give examples in those languages, and they also tend to use the idioms of the languages they do use for examples, and those idioms don't always have an analog in Java (modern JavaScript has adopted many of them, though). But IIRC, the examples in are in Java.
Al
On Thursday, June 22, 2023 at 04:43:28 PM PDT, Mark Levison <mark@...> wrote:
David - thanks as always for responding in any context.
I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use.
Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group.
JavaScript the Good Parts - I know it. I’ve skimmed it myself. It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth.
(Sad note - 15yrs after Crockford’s book, JavaScript is no better)
I enjoy the PragProg series.? They have a book of testing and JS
<IMG_1258.PNG>
And three others on pure JS (I have read the the second and third)
<IMG_1259.PNG>
On June 24, 2023, Sleepyfox <sleepyfox@...> wrote:
JavaScript, particularly front-end JS, is a tyre fire. I've been a part of the JS community since 2010. Common usage is driven by fashion (currently React) and tooling is ferociously complicated. There don't appear to be any books that teach JavaScript by using TDD, because TDD is (still, after >20 years) an incredibly niche practice. Most front-end peeps still don't TDD, as such book publishers probably recognise that if you want to learn JS, you probably aren't interested in TDD. There are plenty of books that teach TDD, and plenty of books that teach JS. You'll have trouble enough finding a book that teaches front-end JS that is anywhere near current practice, because current practice changes so quickly. Crockford's book is great, but you surmised correctly that it is only useful once you've already learned JS. All I can offer you is the advice that if you search for 'JavaScript', you will get everything from latest (ES2023, or ES14) to original JS circa 1995. At least if you search for 'ES6' instead, or even 'ES2020' you are going to get more relevant search results.
We used to say "don't start by teaching people Java, try something simpler, like JavaScript', but now JS is IMHO more complicated than Java. I'm sorry it is not what you wanted to hear, but my advice would be to get through the JS portion of the course and to concentrate on Java. Personally I think Python is a better introduction to programming than either JS or Java, but if your daughter is learning to pass exams, then you need to stick to the curriculum :( Head-first Java by Kathy Sierra is an excellent introduction, and Effective Java by Joshua Bloch is the definitive next step guide to idiomatic Java programming.
On Sat, 24 Jun 2023 at 07:27, Matteo Vaccari <matteo.vaccari@...> wrote: > > The book “ Software Design by Example: A Tool-Based Introduction with JavaScript : Wilson” seems to match what you’re looking for; I only just started reading it but I like it so far > > On Sat, 24 Jun 2023 at 01:23 Al Chou via groups.io <hotfusionman@...> wrote: >> >> I've never used Java much, nor JavaScript, so the good books on becoming a good programmer I can think of don't give examples in those languages, and they also tend to use the idioms of the languages they do use for examples, and those idioms don't always have an analog in Java (modern JavaScript has adopted many of them, though). But IIRC, the examples in https://www.goodreads.com/book/show/387190.Test_Driven_Development are in Java. >> >> >> Al >> >> >> >> On Thursday, June 22, 2023 at 04:43:28 PM PDT, Mark Levison <mark@...> wrote: >> >> >> David - thanks as always for responding in any context. >> >> I haven’t so much decided on the programming language, as her class taught her JavaScript. Next year they will do Java. I’ve started to investigate JavaScript because it is the language I’m weakest in. In addition, while I don’t like JavaScript, as a young programmer it will part of what she is paid to use. >> >> Her overall goal become a good programmer and learn good habits early. I came here (and not Reddit) because I trust the technical acumen and general taste of this group. >> >> JavaScript the Good Parts - I know it. I’ve skimmed it myself. It doesn’t fit (from what I can tell), because it doesn’t teach much about the basics of programming, It assumes you know JavaScript. She knows variables, functions, conditionals, loops. She has used objects but only has a passing understanding. She really needs a good example that pulls her through learning JavaScript/Java in depth. >> >> (Sad note - 15yrs after Crockford’s book, JavaScript is no better) > >?
Test-Driving JavaScript Applications (started, have not finished) https://pragprog.com/titles/vsjavas/test-driving-javascript-applications/
Simplifying JavaScript (I have read) https://pragprog.com/titles/es6tips/simplifying-javascript/
Rediscovering JavaScript (I have read) https://pragprog.com/titles/ves6/rediscovering-javascript/
Modern Asynchronous JavaScript (started, have not finished) https://pragprog.com/titles/fkajs/modern-asynchronous-javascript/
As for a book on TDD, I found Kent Beck's TDD By Example great (but it's using C#) https://www.goodreads.com/book/show/387190.Test_Driven_Development
Although not about "development" the updated Refactoring Book is JavaScript (I think the original was Java) https://martinfowler.com/books/refactoring.html
On June 24, 2023, Mark Levison <mark@...> wrote:
Charlie - code smell is a better choice. However the impassioned answer about haunting her from beyond the grave was way more fun.