[Tutor] Linear programming - is it bad?
Mike Hansen
mhansen at cso.atmel.com
Tue Aug 10 16:46:10 CEST 2004
I've been making my way through Steve McCoonnell's Code Complete(2nd
Edition). There a good section in it with reasons to write
functions/procedures/routines. It's not just to eliminate repeating
code, but also to reduce complexity. Our brains can only load so much
into our organic buffers, so it makes programs easier to read if you
break it up into functions.
> Subject:
> [Tutor] Linear programming - is it bad?
> From:
> Eric Belanger <bilange at gamebox.net>
> Date:
> Mon, 09 Aug 2004 19:30:34 -0400
> To:
> Tutor at python.org
>
> To:
> Tutor at python.org
>
>
> Hi!
>
> This is my first post here (ive been reading this list for a few
> weeks, interesting content!).
>
> So my question: is it bad to write a python program/script in a linear
> way? By linear, I mean: the code is executed line by line, without any
> (programmer defined) classes or functions, a bit like [Q]BASIC without
> GOTO's, or , while we're at it, HTML. I could also compare it to Doom
> 3: going from A to B, then C, without any choices or options, until Z.
>
> I assume that by writing huge projects/programs, im assured
> programmers *needs* to use functions and classes. But since Im
> beginning, I dont see the point.
>
> For example, I made a small program that modify a few registry strings
> to be able to login automaticly in Windows NT/2000/XP (Registry trick
> explained at: http://www.winguides.com/registry/display.php/13/ ),
> asking the user his login name and password. In this case, I didnt
> stored a part of my own code into functions/classes. (For the console
> version of it, that is. Using wxPython, guess I didnt have the choice ;)
>
> I dont know what to add, except asking whats your opinion about this
> topic.
>
> Last thing - I would add my source code of that program i was talking
> about, but I dont know if you guys do like to have attachments in
> messages from mailing list. If you'd like to see the source code,
> heres a link to it. (Hope my old pentium who hosts the file will
> survive the slashdot effect ;)
>
> http://home.bilange.ca/files/index.php?dir=&file=AutoLogC.py
>
> Thanks!
>
> Eric Belanger - bilange A gamebox _ net
>
>
More information about the Tutor
mailing list