Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47891

Re: My son wants me to teach him Python

Newsgroups comp.lang.python
Date 2013-06-12 21:00 -0700
References <575a3a4c-b99f-43b4-aa2b-84dfaf3e89b4@googlegroups.com>
Message-ID <0d636b8f-09fa-43d0-8795-29485e4edb5e@googlegroups.com> (permalink)
Subject Re: My son wants me to teach him Python
From Rick Johnson <rantingrickjohnson@gmail.com>

Show all headers | View raw


On Wednesday, June 12, 2013 2:46:13 PM UTC-5, John Ladasky wrote:
> [...]
> He's a smart kid, but prefers to be shown, to be tutored,
> rather than having the patience to sit down and RTFM.
> Have any of you been down this road before?  I would
> appreciate it if you would share your experiences, or
> provide resource material.

Hello John. 

I'm going to suggest a completely different path to enlightenment for the lad. A path that has the potential for semi-instant gratification whilst also humbling the boy to the grim realities of computer graphics and application development. *evil grin*

Since your son has zero experience with both graphical and application based programming i would suggest starting at (near) the very bottom of the GUI spectrum, which, in the Python world would be the Tkinter Canvas. 

Some people would suggest starting with "turtle.py", and yes this is a good suggestion, however, i highly suggest that he begin by coding a python turtle program HIMSELF. 

But first i would let him use the existing turtle program, play around with it, understand some of the commands, etc... but whatever you do: DON'T LET HIM SEE THE SOURCE CODE! Then i would ask him to think about how this program works in a general manner (psst: remember, he's not a programmer "yet"!). 

For starters we know we need to create a "window" (this is where you would explain what a GUI library is. And to satisfy the instant gratification, we should create a window very soon. 

After we can create a blank window, we should take this opportunity to quickly cover some of the common subwidgets that can be placed into a window, such as:: "Text", "Entry", "Label", "Button", etc.., and maybe some simple code to display each of them will be fun.

Now that we know "generally" what a GUI is, and we know about windows and sub-widgets, it's time to refocus on the turtle program. We will need to create a drawing area within the window for which to draw the turtle -- enter the Tk::Canvas!

Next we can take a slight tangential meandering and learn about common Canvas primitives (like rectangles and lines and whatever!) Then we should decide which primitive would best suit a turtle, and draw that primitive.

Once we have drawn the turtle, we quickly realize that it needs to sprout some legs and move around. This is where the fun really starts to begin... I think you can figure out where to go from there. Math functions, event processing... fun times!

After he gets a simple turtle program running i would point out that even though he went to quite bit of work to solve this fairly simple problem, most of the really difficult code, like turning pixels on and off, drawing and ordering GUI windows, event loops, etc, etc...  has been abstracted away into multiple layers of low level code. Even though the starting point of our project could be considered "slightly low level" relative to Python, there are vast libraries of millions of lines of code, layered one atop the other, making all this possible.

The point of this exercise would be to get him thinking about solving problems instead of just reaching for a prepackaged library, and then not fully appreciating (or furthermore, truly *understanding*) the vast scope of *real* software design. 

Anybody can grab PyGame and start making simple games, but do they understand what is going on under the hood? I don't think they need to understand the science behind the internal combustion engine, however, if they cannot explain the basics of how the major components like: electrical, fuel, suspension, drive-train, braking, etc... work, then they lack a fundamental insight into solving complex problems that can arise later. 

For instance, if you hear a knocking sound whilst driving but the sound is absent whist idling, you can deduce that the problem most likely exists in the drive-train. From there you'd need to focus in at an even smaller level of detail -- but you could not come to that conclusion if you did not possess (at minimum) a basic understanding of the underlying component systems. 

Of course some might say:  "Rick, why go to all that trouble when you could traumatize him with openGL instead". And to that i would reply: "Save OpenGL for lesson number two!" 

*wink*




Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

My son wants me to teach him Python John Ladasky <john_ladasky@sbcglobal.net> - 2013-06-12 12:46 -0700
  Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 06:02 +1000
    Re: My son wants me to teach him Python John Ladasky <john_ladasky@sbcglobal.net> - 2013-06-12 15:07 -0700
  Re: My son wants me to teach him Python Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-12 16:23 -0400
  Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 06:34 +1000
    Re: My son wants me to teach him Python John Ladasky <john_ladasky@sbcglobal.net> - 2013-06-12 15:06 -0700
      Re: My son wants me to teach him Python Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-12 16:22 -0600
  Re: My son wants me to teach him Python Ethan Furman <ethan@stoneleaf.us> - 2013-06-12 14:31 -0700
  Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 09:34 +1000
  Re: My son wants me to teach him Python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-12 21:00 -0700
    Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 14:08 +1000
      Re: My son wants me to teach him Python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-12 21:47 -0700
        Re: My son wants me to teach him Python Andrew Berg <robotsondrugs@gmail.com> - 2013-06-13 00:23 -0500
        Re: My son wants me to teach him Python Modulok <modulok@gmail.com> - 2013-06-12 23:30 -0600
        Re: My son wants me to teach him Python Ethan Furman <ethan@stoneleaf.us> - 2013-06-12 22:48 -0700
        Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 14:53 +1000
        Re: My son wants me to teach him Python Cameron Simpson <cs@zip.com.au> - 2013-06-14 11:05 +1000
  Re: My son wants me to teach him Python TP <wingusr@gmail.com> - 2013-06-13 01:35 -0700
  Re: My son wants me to teach him Python Chris Angelico <rosuav@gmail.com> - 2013-06-13 18:43 +1000
  Re: My son wants me to teach him Python rusi <rustompmody@gmail.com> - 2013-06-13 06:01 -0700
    Re: My son wants me to teach him Python Roy Smith <roy@panix.com> - 2013-06-13 09:07 -0400
      Re: My son wants me to teach him Python rusi <rustompmody@gmail.com> - 2013-06-13 06:37 -0700
        Python biases [was Re: My son wants me to teach him Python] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 00:44 +0000
          Re: Python biases [was Re: My son wants me to teach him Python] rusi <rustompmody@gmail.com> - 2013-06-13 20:31 -0700
    Re: My son wants me to teach him Python Tomasz Rola <rtomek@ceti.pl> - 2013-06-13 17:37 +0200
      Re: My son wants me to teach him Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 01:23 +0000
        Re: My son wants me to teach him Python Ben Finney <ben+python@benfinney.id.au> - 2013-06-14 12:43 +1000
        Re: My son wants me to teach him Python Ethan Furman <ethan@stoneleaf.us> - 2013-06-13 18:44 -0700
        Re: My son wants me to teach him Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-14 20:00 -0400
    Re: My son wants me to teach him Python Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-13 21:08 +0100
  Re: My son wants me to teach him Python Mark Janssen <dreamingforward@gmail.com> - 2013-06-13 10:34 -0700
  Re: My son wants me to teach him Python russ.pobox@gmail.com - 2013-06-13 12:03 -0700
  Re: My son wants me to teach him Python aliencat777@gmail.com - 2013-07-27 05:25 -0700

csiph-web