Sunday, December 31, 2017

Tractability and learning programming


My oldest son, currently in 3rd grade, is enthusiastically learning programming from Code.org. He has completed Courses 2 and 3 and is currently working on Course 4.

I was having a conversation with my colleague Brent Yorgey about the sudden increase in difficulty in the introductory CS class when we get to while loops. We spent some time discussing the fact that there is no getting around it being hard. He then pointed out that this is the concept that causes the difficulty of algorithm analysis to transition from completely tractable to undecidable. 

Interestingly, so far in Code.org every problem my son has had to solve has been in the logically-tractable category.

Related to this, I saw this interesting answer by Barry Roundtree to a question on Quora about what it takes to become a programmer:
In my experience, good programmers don’t bother asking if they can do something or not, and they don’t spend a lot of thought on whether or not they’re wasting time.
There are a lot of professions out there where learning skill x is expected to take yhours and lead to salary z. Music, math and chess are not those kind of professions, and programming is more like those than dentistry, auto body repair or being a CPA.
As to brain wiring: if you have an unusually high level of curiosity and (for tasks that interest you) an exceptional capacity to tolerate failure, you’re good to go. Curious people don’t tend to be overly concerned with wasting time, and people who tolerate failure well don’t spent a lot of effort wondering if they can do something. They just start, and if they fail (and fail repeatedly), no big deal.
It seems, then, that succeeding in programming is about having the right attitude. This attitude of curiosity and willingness to fail enable us to persevere in finding heuristic solutions forward even to logically intractable problems. 

Interestingly, many useful applications (e.g. spreadsheets, computer animation software) all enable users to do things that once required programming in the full sense. What they represent are domain-specific languages with a tractable logic. This enables them to be used by a wide audience of non-programmers.

2 comments:

  1. (I think I commented before, but it got lost)

    I don't think I understand your definition of "logically tractable". Shouldn't _every_ intro assignment, whether from Code.org or from a course we teach, be giving students something that is possible for them to do?

    ReplyDelete
    Replies
    1. Hi Sean, What I mean is that when the linguistic tools provided to the student are sufficiently limited, the problem they are asked to solve is decidable. Even if the problem is relatively easy to solve, once we provide constructs like while loops the problems become undecidable. I was using "logically tractable" as a synonym for "decidable" in this sense.

      Delete