Debugging

Summarized using AI

This is the problem

Drew Neil • October 26, 2012 • Earth

In his talk 'This is the Problem' delivered at the Rocky Mountain Ruby 2012 conference, Drew Neil explores the concept of ambiguity in both programming and writing, using JavaScript and CoffeeScript as primary examples. He begins by discussing a bug he encountered with CoffeeScript, where the context of 'this' was misunderstood, leading to unexpected behavior. Neil explains that in this case, the issue is easily fixed by scoping 'this' correctly, illustrating how JavaScript's scoping rules are consistent and learnable.

However, Neil points out that true ambiguity can arise in human communication, particularly in writing, unlike in programming where specifications exist. He shares a personal experience from his writing process, recalling feedback from an editor regarding a vague pronoun in his text. This highlights how poor writing can lead to confusion similar to programming issues.

Key points discussed in the talk include:
- Ambiguity in Programming: Use of 'this' in JavaScript and CoffeeScript demonstrates that programmers can experience confusion due to scope, yet this is usually a manageable issue.
- Writing and Clarification: Neil discusses a note from his editor that pointed out an ambiguity in his writing, illustrating the need for clarity in human communication. This issue of clarity is akin to programming bugs but more complex due to the nature of language.
- Human Communication: Neil emphasizes that unlike programming languages, human language relies on mutual understanding and context, which makes it fascinating yet challenging to communicate effectively.
- Realizations in Writing: He recounts instances where significant rewrites were necessary to achieve clarity, indicating that evolving from unclear to clear writing requires effort and reconsideration.

In conclusion, Neil does not provide a definitive solution but rather invites the audience to reflect on the nature of ambiguity in both coding and writing. He leaves the audience with the thought that understanding and clarity are continuous challenges in both fields and prompts them to consider their own experiences with these issues.

This is the problem
Drew Neil • October 26, 2012 • Earth

Help us caption & translate this video!

http://amara.org/v/FGgN/

Rocky Mountain Ruby 2012

00:00:06.399 Hello, my name is Drew Neil. You might know me as the voice of Vimcast. I've been writing a book about Vim, but this talk isn't going to be about that. The title of this talk is, 'This is the Problem.' I'm not going to describe exactly what I mean by this, but I'm going to ask this question again a little bit later.
00:00:19.920 Here is some CoffeeScript, and there’s a bug in it. Did anyone see it? Probably not. When I wrote this, I thought that 'this' was referring to the form when, in fact, in this context, 'this' actually refers to the button. Therefore, saying 'this.submit' does not perform as I expected. It’s easily fixed by adding a line to scope 'this'. Since this is CoffeeScript, you could also use a fat arrow instead of a regular arrow, and that would fix it too. That makes 'this' refer to the thing that I originally thought it referred to when I was writing this code.
00:01:09.520 In this case, this isn't really a problem. We are dealing with JavaScript here. The scoping rules of JavaScript can be a bit confusing at first, but you can learn them, and they are consistent across runtimes. They are specified. There are other things to worry about in JavaScript between different runtimes, but this is not one of them. This is not the problem.
00:01:39.360 As I mentioned earlier, I’ve been writing a book, and in the last couple of years, I haven’t written much code. But I feel like I’ve improved as a writer while slightly deteriorating as a coder. There are common good practices in writing and coding. This is an excerpt from my book, and when I got this back from the editor, there was a note in the margin: 'I think we have to restate what it is; it’s not clear to me.' Now, when I wrote this, it was perfectly clear in my head that it referred to 'insert normal mode.' However, when you read it through, there’s actually another noun it could be referring to. It is a pronoun—a shorthand for something we’ve already discussed—and it’s ambiguous whether it refers to a single command or insert normal mode.
00:02:05.200 So, this is poor writing; it’s a little like that problem earlier in JavaScript – it’s a problem of scope. The solution was simply to rewrite it. I got rid of the ambiguity, and I think it reads better now. This really is a problem because, whereas in JavaScript we have a runtime and a specification, in human language, we all sort of agree on the meanings of words. Most of the words in our vocabulary we have never actually looked up in the dictionary. Isn’t that fascinating? We understand the meanings of certain words because we hear them used in many different contexts, which allows us to extract their meanings. When you think about that, it’s kind of miraculous that we can communicate at all.
00:03:27.440 This is another excerpt from my book, and it came back with another note in the margin. I’m not even going to show you how I rewrote this; I just had to throw it out and start again because it was a mess. I wasn’t clear on what this referred to and what the range of text was matching. This is the problem. I said earlier I wasn't going to tell you what I mean by this. You decide.
Explore all talks recorded at Rocky Mountain Ruby 2012
+16