Keyboard Shortcuts
Likes
- Testdrivendevelopment
- Messages
Search
Re: Searching for a book that helps introduce JavaScript or Java Programming?
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?? |
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
One problem with Boolean parameters is that it¡¯s hard to evolve them when the two cases become three :) On Fri, 23 Jun 2023 at 18:30 David Rosenstrauch <darose@...> wrote: On 6/23/23 11:44?AM, Avi Kessner wrote: |
|||||||||||
Re: Does an AI assistant help with learning/using TDD?
My experience is different¡ª I had GPT or copilot help me in some relatively hairy algorithms; it saved me a ton of time. Eg loading a bunch of bitmaps in JavaScript and then executing a callback when the last has finished loading. A moderately skilled is dev can do this blindfolded I suppose but the complicated contortion I was going to try to do on my own would have taken me off track for long. And it was much faster than searching stackoverflow. Another instance was when it suggested that I reset a variable I was going to forget to reset.? Now when I need something even a little complicated I start by writing the comment for what it¡¯s supposed to do; when it works it¡¯s a lot of fun. Working alone is boring, I keep repeating the same coding patterns I am used to do; with copilot I¡¯m curious to see what it proposes me. On Fri, 23 Jun 2023 at 15:18 Avi Kessner <akessner@...> wrote:
|
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
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.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. For example, in Python: db_connection.connect(url, debug=True) week.find_appointments(user_id, workdays_only=True) json.dumps(out_data, sort_keys=True) sorted(my_list, key=val, reverse=True) etc. 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. But again, just my $0.02. DR |
|||||||||||
Re: Now that Reddit is dying...
¿ªÔÆÌåÓýYes - few Swift/SwiftUI devs doing unit testing¡ ?I cast blame upon the leadership of this ecosystem¡ for setting a poor example (as leader).Imagine if every App Apple produced since 2007 had a published set of test to prove it¡¯s behavior¡ if most every WWDC talk touched a few of those test...
|
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
Programming JavaScript Applications by Eric Elliott may have what you're looking for. Some of the chapter headings include, but aren't limited to : Functions, Objects, Modules, and Separation of Concerns. Furthermore, he discusses TDD and the book contains multiple examples. On Thu, Jun 22, 2023 at 7:43?PM Mark Levison <mark@...> wrote: David - thanks as always for responding in any context. |
|||||||||||
Re: Now that Reddit is dying...
I'm also currently working on platform work.? How do you use tdd in platform work? I'm struggling with it. Or do you setup chaos engineering instead? On Fri, Jun 23, 2023, 17:42 Sleepyfox <sleepyfox@...> wrote:
|
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
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:
|
|||||||||||
Re: Now that Reddit is dying...
I've spent the last 15+ years teaching people TDD. When I'm engaged by clients on other work i.e. where teaching TDD is not my main brief, I invariably find that poor test-after (if at all) is the norm. At the moment I am working in a gov department doing platform work. The only tests I see app dev teams doing are E2E, these are defined by BAs (outside the app dev teams), implemented by testers (outside the app dev teams) and only fed back to app dev teams if there is a failure. It is positively barbaric. Fox ---
|
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
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? DR |
|||||||||||
Re: Now that Reddit is dying...
¿ªÔÆÌåÓýFor years, across multiple employers, I actually had a fair bit of success in evangelizing TDD.?I noticed two keys: 1. There was an objective measure of quality that everyone monitored and cared, and we were far more consistent than other groups in keeping quality high, and 2. I was able to work in person with developers who wondered how we were doing it.? Since we moved to remote, and in a process that makes it much harder to assign blame for failures, I have found it much harder to interest developers in learning. I have also found, in working with others, that the very idea of a test is, to most people, something that is inherently done to check a built product, not something that guides it. That has had me trying to think of another approach to selling it. In a Twitter conversation, I learned that some have suggested changing the terminology. One suggestion has been ¡°Example-guided development,¡± but a friend who has followed my suggestion, and used to teach math in college found that his students generally thought of examples as necessarily very simple. I have another idea that I am looking to write up, and would require some background to develop, but I agree that a basic problem is the way most people learn to program: syntax first and then play. It is not helped by university computer science programs which generally involve working on programs far smaller than those professional developers tend to work on - and where you can actually just keep the program in your own memory the whole time.?
|
|||||||||||
Re: Now that Reddit is dying...
¿ªÔÆÌåÓý June
22, 2023 at 7:59 PM Had I to guess, and I've had other of us first-generation
graybeards guess, too, with similar response: I'd guess that?TDD as a
practice has well under 1% mindshare. Very bad test-after is the trade
norm these days. I assent. Russell Gold--As far as "reaching the rest:" I'm not sure, but here's what will always be an uphill (and losing) battle: - teach people a programming language but let them figure out their own approach for how to put solutions together with code - let them run wild with their homegrown skillz, building production software for any number of years, with few agreed-upon standards and minimal emphasis on quality and collaboration - later tell them "you're doing it all wrong" and expect them to change their ingrained habits. Way back when, I put my hand into an attempt to get the habituation started out of the gate. No one else came along. Across a couple decades+ of teaching TDD, perhaps the best class I ever had was one complete full of developers with exactly 3 months of professional experience. Cheers, Jeff
|
|||||||||||
Re: Does an AI assistant help with learning/using TDD?
All of my attempts to use chatgpt to help with real coding problems have resulted in failures for me.? Test scenarios with well known problems like fuzzbuzz have been fun and I was amazed at the good results originally. However, I either lack the prompting skills or the patience to use the AI for real problems.? My biggest problem has been imagined APIs that don't really exist, or the api exists but doesn't actually do what chatgpt is imagining it should do.? That's the problem with probabilistic answers. It's only probably right. On Fri, Jun 23, 2023, 14:21 Matteo Vaccari <matteo.vaccari@...> wrote:
|
|||||||||||
Re: Does an AI assistant help with learning/using TDD?
On Thu, 22 Jun 2023 at 21:36 Jeff Langr <jeff@...> wrote:
I have used GitHub Copilot in my hobby project¡ª it¡¯s javascript and I don¡¯t know the language well, so it often suggests code that¡¯s better than what I would write. It does work with TDD, sort of. ?The main issue is that it will suggest production code that does more than strictly needed for the current test; often guessing the complete function on a single shot.? Then I have the choice to delete it and write the bare minimum, or to keep it and ask Copilot to write the missing tests.
|
|||||||||||
Re: Now that Reddit is dying...
Mike Hill
Had I to guess, and I've had other of us first-generation graybeards guess, too, with similar response: I'd guess that?TDD as a practice has well under 1% mindshare. Very bad test-after is the trade norm these days. On Thu, Jun 22, 2023 at 4:14?PM Russell Gold <russ@...> wrote:
|
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
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) |
|||||||||||
Re: Searching for a book that helps introduce JavaScript or Java Programming?
¿ªÔÆÌåÓýWell it appears you have selected JavaScript. So I¡¯d read about its few good qualities? |