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


Groups > comp.lang.python > #59509

Re: understanding someone else's program

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: understanding someone else's program
Date 2013-11-15 22:19 +1100
References <19cb1c85-1c01-4c53-a26a-29f96c5926eb@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2645.1384514391.18130.python-list@python.org> (permalink)

Show all headers | View raw


"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

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