Re: Teaching Programming

Discussion in 'Python' started by Ed Keith, May 4, 2010.

  1. Ed Keith

    Ed Keith Guest

    --- On Tue, 5/4/10, Stefan Behnel <> wrote:

    > From: Stefan Behnel <>
    > Subject: Re: Teaching Programming
    > To:
    > Date: Tuesday, May 4, 2010, 11:52 AM
    > Ed Keith, 04.05.2010 17:43:
    > > The PITA is having to keep track of the indentation of

    > each embedded
    > > chunk and summing it for each level of indentation.

    > This requires a fair
    > > amount of bookkeeping that would not otherwise be

    > necessary.
    > >
    > > The original prototype simply replaced each embedded

    > chunk with the text
    > > from the chunk definition, all indenting information

    > was lost. It worked
    > > for most languages, but not Python.
    > >
    > > In testing the program I used two languages, Python

    > and J.
    >
    > Well, then both of the language generators have benefited
    > from your effort because the generated complete code is
    > properly indented and therefore much more readable during
    > debugging. I'd say it was worth it.
    >
    > Stefan
    >
    > -- http://mail.python.org/mailman/listinfo/python-list
    >


    I agree, but some propellants of literate programming would not.

    Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code.

    -EdK

    Ed Keith


    Blog: edkeith.blogspot.com
     
    Ed Keith, May 4, 2010
    #1
    1. Advertising

  2. Ed Keith

    alex23 Guest

    Ed Keith <> wrote:
    > Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code.


    This is my biggest issue with Knuth's view of literate programming. If
    the generated source isn't readable, am I just supposed to trust it?
    How can I tell if an error lies in my expression of the algorithm or
    in the code generation itself?
     
    alex23, May 5, 2010
    #2
    1. Advertising

  3. Ed Keith

    Dave Angel Guest

    alex23 wrote:
    > Ed Keith <> wrote:
    >
    >> Knuth wanted the generated source to be unreadable, so people would not be tempted to edit the generated code.
    >>

    >
    > This is my biggest issue with Knuth's view of literate programming. If
    > the generated source isn't readable, am I just supposed to trust it?
    > How can I tell if an error lies in my expression of the algorithm or
    > in the code generation itself?
    >
    >

    Do you think a compiler is required to make its object file conveniently
    readable? Do you regularly read the machine code generated by your C
    compiler? I admit I've frequently studied compiler output over the
    years, but I think I'm very unusual in that respect. I've never
    disassembled a python byte code file, though I wrote tools to display
    and manipulate both java byte code files and dot-net (before it was
    called that).

    I think the question really boils down to whether you trust the compiler.

    DaveA
     
    Dave Angel, May 5, 2010
    #3
  4. Ed Keith

    Terry Reedy Guest

    On 5/5/2010 4:50 AM, Dave Angel wrote:
    > alex23 wrote:
    >> Ed Keith <> wrote:
    >>> Knuth wanted the generated source to be unreadable, so people would
    >>> not be tempted to edit the generated code.

    >>
    >> This is my biggest issue with Knuth's view of literate programming. If
    >> the generated source isn't readable, am I just supposed to trust it?
    >> How can I tell if an error lies in my expression of the algorithm or
    >> in the code generation itself?
    >>

    > Do you think a compiler is required to make its object file conveniently
    > readable? Do you regularly read the machine code generated by your C
    > compiler? I admit I've frequently studied compiler output over the
    > years, but I think I'm very unusual in that respect. I've never
    > disassembled a python byte code file,


    The output from dis.dis() is quite readable, and people (developers and
    others) have used it to check on what the compiler is doing.
     
    Terry Reedy, May 5, 2010
    #4
  5. alex23 wrote:

    > This is my biggest issue with Knuth's view of literate programming. If
    > the generated source isn't readable, am I just supposed to trust it?
    > How can I tell if an error lies in my expression of the algorithm or
    > in the code generation itself?


    Knuth would say that the code generator should itself be
    a literate program, so that it's obviously correct. :)

    --
    Greg
     
    Gregory Ewing, May 8, 2010
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    14
    Views:
    557
    Sean Ross
    Dec 18, 2003
  2. Wingware
    Replies:
    0
    Views:
    401
    Wingware
    Aug 3, 2007
  3. Samuel Williams

    Re: Teaching Programming

    Samuel Williams, May 3, 2010, in forum: Python
    Replies:
    22
    Views:
    618
    Martin P. Hellwig
    May 5, 2010
  4. Ed Keith

    Re: Teaching Programming

    Ed Keith, May 4, 2010, in forum: Python
    Replies:
    8
    Views:
    245
    Dave Angel
    May 4, 2010
  5. Stefan Ram

    Teaching Java, teaching what?

    Stefan Ram, Dec 8, 2013, in forum: Java
    Replies:
    57
    Views:
    611
    Ali Sh
    Dec 18, 2013
Loading...

Share This Page