Ruby, iOS, and Other Development

A place to share useful code snippets, ideas, and techniques

All code in posted articles shall be considered public domain unless otherwise noted.
Comments remain the property of their authors.

2007-10-18

The Magic in the Box

Disclaimer: This is a rant. If you are not interested in reading the rant, please don't, but please also do not comment unless you have read it all the way through.

I'm a pretty easy-going guy, and I like to be helpful on mailing lists (and in person), but I expect a basic level of knowledge from people, particularly about the tools they are using. For anyone writing software, the computer is their tool. (So is a text editor or IDE and compiler or interpreter, but that's not where I'm headed with this.)

A strong formal education in computer science provides an understanding of data representation, logic, memory hierarchies, algorithmic analysis (and common algorithms), concurrency, common/basic data structures, stack and heap layout, compiler design, and probably a dozen other things I'm omitting. (Ideally, program design and development is a part of that education, but it should not be at the expense of anything I mentioned.) It's challenging, but self-taught programmers can learn the same things on their own. And should. As a professional of any sort, one has a responsibility to understand both the unavoidable tools (in particular, memory and CPU details) and the available tools (go look up the heap data structure right now if you don't know what it is).

One can argue that newbies should be able to jump right into programming, but at the same time there really is such a thing as a stupid question. Nothing says, "I don't understand how computers work and shouldn't be paid to write software until I do," like a question that shows a complete unawareness of the accuracy limitations of floating point representation. There are certainly other stupid questions, but that one came up recently.

I could have ended this rant on the previous paragraph, but I was afraid it would come across as unreasonable and mean-spirited, and my goal is to express the reasoning behind the distress I feel when I read such questions. First, though, I want to address the newbie issue in greater depth. If one is teaching oneself how to program, that is to be encouraged, but it involves some work beyond following along in a book or online tutorial. For the floating point example above, the autodidact (great word, look it up) should be expected to follow roughly these steps:

  1. discover an anomaly in floating point arithmetic
  2. in irb, run something like "0.1.class" to discover that 0.1 is a Float
  3. ri Float to discover that "Float objects represent real numbers using the native architecture's double-prescision floating point representation"
  4. google for "floating point representation"
  5. Read the very first link in the results, which has a specific section on the issue
  6. achieve enlightenment

The point is that teaching oneself involves more than just reading a book and playing around, sometimes in involves taking time to investigate the parts that don't immediately make sense. (Note that those steps are the shortest, simplest path from confusion to understanding; it might take someone more work than that, but the fact remains that there is a simple and reasonable path to understanding and that it isn't particularly hard to find.) If one does not know how to learn on one's own, self-teaching is the wrong choice and it is time to go get that formal education.

A bit more on why these questions I'm calling stupid distress me so. Imagine yourself as a master carpenter who is training an aspiring apprentice. The apprentice has assembled some Ikea furniture and decided he likes carpentry, so he's going to give it a whirl. One day, he brings in a stool with a leg that needs replacing. He says, "I've been trying to remove the leg, but the screw is just stuck or something, and I think something is wrong with it." You look, and ask him to show you how he's tried to go about it. He picks up a screwdriver and desperately tries to fit its flat head into the cross of the phillips screw. You tell him to stop, take out a phillips screwdriver, and proceed to unscrew things easily. He gawks and asks, "There are different kinds of screws that need to be treated differently?"

Imagine your horror. How could he not know something so basic? Aspiring to be a carpenter requires understanding the tools a carpenter uses. Likewise, aspiring to be a programmer requires understanding the tools a programmer uses. Enjoy!

Labels:

5 Comments:

  • At 10/18/2007 06:10:00 PM, Anonymous Anonymous said…

    Bad analogy. In order for your example to be a good analogy, we would not be talking about a screw, but a screw driver that automatically changed the drill bit to fit the screw based on what it detected.

    That's essentially why the newbie didn't understand. His specific brand (Ruby) of drill (Float) didn't automatically adjust like every other drill he'd ever used (the other languages he tried that same problem with).

     
  • At 10/18/2007 06:44:00 PM, Anonymous Anonymous said…

    What books help the autodidact obtain enlightenment?

     
  • At 10/18/2007 07:21:00 PM, Blogger Gregory said…

    Concerning the analogy, I'm not convinced he'd ever used the tools before at all. But it was not intended to be perfectly analogous, nor did I present it as such.

    Concerning books for the autodidact seeking enlightenment, I have nothing to recommend. I have a formal computer science education, and I improved my learning ability every year I spent in school. I can't point you to a book that even approximates the same benefit as those years of school.

    I was able to pick up Ruby from the following sources: Why's Poignant Guide, the pickaxe book (reading almost exclusively in the bathroom over several weeks), lurking on the ruby-talk list, ri, and irb. That doesn't mean they are the right sources for everyone seeking to learn Ruby on his/her own, just that it worked for me given my self-teaching abilities. Your mileage may vary.

     
  • At 10/18/2007 11:04:00 PM, Anonymous Anonymous said…

    It's not correct to call it a stupid question. It is in fact true that there is no such thing as a stupid question. Let me explain...

    What there is, is an understanding of the right set of questions to ask, given the problem presented. In this case, you asked the question: "what type is 0.1?". Then, after you got your answer - a Float. You asked for more information about the Float. And finally, got to an understanding that there is an issue with the accuracy of a Float, inherent in how computers deal in floating point math.... You only got to that understanding because you knew the right question to ask initially. That is a skill that comes with practice.

     
  • At 10/19/2007 08:42:00 AM, Blogger Gregory said…

    Let us perhaps call it a question that is indicative of an intellectual laziness that serves the autodidact poorly. Wasting list members' time reading an intellectually lazy question, however, is stupid. Moreover, it gives the impression of intellectual laziness, which is often indistinguishable from stupidity. That's a pretty close approximation to a question being stupid.

     

Post a Comment

Links to this post:

Create a Link

<< Home