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


Groups > comp.lang.python > #59516

Re: understanding someone else's program

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'programmer': 0.03; 'preferably': 0.05; 'craft': 0.09; "people's": 0.09; 'satisfy': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'suggest': 0.14; 'wrote': 0.14; 'code?': 0.16; 'docstrings': 0.16; 'finney': 0.16; 'ideally,': 0.16; 'normally,': 0.16; 'programmers,': 0.16; 'sadly': 0.16; 'subject:program': 0.16; 'subject:skip:u 10': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'implementing': 0.19; 'written': 0.21; 'code,': 0.22; 'programming': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'certain': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'errors': 0.30; 'programming.': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'trace': 0.31; 'writes:': 0.31; 'url:python': 0.33; 'fri,': 0.33; 'level.': 0.33; 'something': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'interface,': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'method': 0.36; 'url:org': 0.36; 'should': 0.36; 'level': 0.37; 'ben': 0.38; 'improving': 0.38; 'nov': 0.38; 'enough': 0.39; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'read': 0.60; 'lower': 0.61; 'new': 0.61; 'simple': 0.61; 'making': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'side': 0.67; '8bit%:21': 0.69; 'confirming': 0.84; "else's": 0.84; 'experiment': 0.84; 'religion': 0.84; 'subject:else': 0.84; 'joel': 0.91; 'task,': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=hcODN9IOKxg2zYRzj+t1/lOb4nHjcJu2r6T2GLW0l6M=; b=zsi7lDbGyEiJUf1tG6P/vzBwKuIGBgBcXUeRnx8AiGwKXKhbuGCgQMSlCMzXMEuedr 210y2od8r2PmiJNYNpCpTALq/+jiStUQ7y7y0UhC5bzpjsgxET1VtuFoR1Z2lJIKddjt rSpOALyZ9pDAHsE8D/ZJu+RqMxm8UkDdEl6nT4uh3mFUBWflzy44C97+SqElRpienbjp l/+qrakJtNdflXqROmygJQ2P4BVx4QlVkfRxhRyG+VaGoUAzyDve4c42Nv6SUb+ssARv p0QG3TMo5Y3he0541yVhAIT+WTVpW5yiDlLEBWdGy/fhtTEQJLQlyHM6jIXBIKvlcW1N lVqw==
MIME-Version 1.0
X-Received by 10.58.255.71 with SMTP id ao7mr4674475ved.16.1384522774295; Fri, 15 Nov 2013 05:39:34 -0800 (PST)
In-Reply-To <7wsiuxvrna.fsf@benfinney.id.au>
References <19cb1c85-1c01-4c53-a26a-29f96c5926eb@googlegroups.com> <7wsiuxvrna.fsf@benfinney.id.au>
Date Fri, 15 Nov 2013 08:39:34 -0500
Subject Re: understanding someone else's program
From Joel Goldstick <joel.goldstick@gmail.com>
To Ben Finney <ben+python@benfinney.id.au>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2650.1384522783.18130.python-list@python.org> (permalink)
Lines 61
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384522783 news.xs4all.nl 15934 [2001:888:2000:d::a6]:57892
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59516

Show key headers only | View raw


On Fri, Nov 15, 2013 at 6:19 AM, Ben Finney <ben+python@benfinney.id.au> wrote:
> "C. Ng" <ngcbmy@gmail.com> writes:
>
>> Please suggest how I can understand someone else's program
>
> Welcome to this forum!
>
> I sympathise with this query. Much of the craft of programming is in
> understanding the code written by other programmers, and learning from
> that experience how to improve the understandability of the code one
> writes.
>
> In general, the answer to your question is: Read a lot of other people's
> code, preferably by the side of the programmer who wrote it. Experiment
> with a lot of code written by others, and test one's understanding by
> improving it and confirming it still works :-)
>
>> where
>> - documentation is sparse
>
> Sadly the case for the majority of software any of us will be involved
> with maintaining.
>
>> - in function A, there will be calls to function B, C, D.... and in
>> those functions will be calls to functions R,S,T.... and so on so
>> forth... making it difficult to trace what happens to a certain
>> variable
>
> This is normal modular programming. Ideally, those functions should each
> be doing one conceptually simple task, with a narrowly-defined
> interface, and implementing its job by putting together other parts at a
> lower level.
>
> Is there something particular about these functions that make them more
> difficult than good code?
>
> --
>  \          “Generally speaking, the errors in religion are dangerous; |
>   `\    those in philosophy only ridiculous.” —David Hume, _A Treatise |
> _o__)                                           of Human Nature_, 1739 |
> Ben Finney
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Much more time is spent figuring out old code than writing new code!
Python docstrings help a little.  Do you know about a utility called
pydocs?  If you don't, read about it.  Using pydocs you can produce
documentation for all the modules you need to understand.  It will
pull out the docstrings at the top of the module,and for each method
and function.  Normally, that level of documentation won't be good
enough to satisfy the needs of a new reader, so go through each
function and understand them one at a time.  Add to the docstrings.


-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

understanding someone else's program "C. Ng" <ngcbmy@gmail.com> - 2013-11-15 03:05 -0800
  Re: understanding someone else's program Ben Finney <ben+python@benfinney.id.au> - 2013-11-15 22:19 +1100
  Re: understanding someone else's program Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-15 08:39 -0500
  Re: understanding someone else's program William Ray Wing <wrw@mac.com> - 2013-11-15 08:50 -0500
  Re: understanding someone else's program Chris Angelico <rosuav@gmail.com> - 2013-11-16 01:03 +1100
  Re: understanding someone else's program Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-15 17:41 +0000
  Re: understanding someone else's program Laurent Pointal <laurent.pointal@free.fr> - 2013-11-18 23:42 +0100

csiph-web