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


Groups > comp.lang.python > #72456

Choosing good names for things is difficult (was: Strange Behavior)

From Ben Finney <ben@benfinney.id.au>
Subject Choosing good names for things is difficult (was: Strange Behavior)
Date 2014-06-03 10:57 +1000
References <CANYcpZy3qZHRORFPTnvPcSV+uU2MHHPPcKuDXXuRvjNJBnKJKg@mail.gmail.com> <mailman.10571.1401732331.18130.python-list@python.org> <538d1532$0$29978$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.10582.1401757062.18130.python-list@python.org> (permalink)

Show all headers | View raw


Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes:

> On Mon, 02 Jun 2014 20:05:29 +0200, robertw89 wrote:
>
> > I invoked the wrong bug.py :/ , works fine now (this happens to me
> > when im a bit tired sometimes...).
>
> Clarity in naming is an excellent thing […] Programs should be named
> by what they do […] or when that isn't practical, at least give them a
> unique and memorable name […].

It's worth noting, along with this useful admonition, that naming things
well is one of the most difficult things to do.

It is especially difficult in computer software, while also being rather
more important than the typical problem of naming, because of the
simultaneous constraints that the names within computer software should
be:

* Memorable and evocative of the meaning to humans, who have a limited
  capacity for remembering large sets of different names exactly, but a
  high tolerance (even fondness) for multiple-meaning and ambiguous
  words.

  So, choosing unique names is difficult, and the set of memorable names
  is severely limited.

* Starkly unique and exact every time for the computer's use, without
  regard to meaning, and any name is just as memorable to a computer as
  any other.

  So, choosing unique meaningful names is crucially important in working
  with computer software.

That combination – difficult but important to do well – is a perennial
bugbear for programmers.


You can find many essays on the “naming things is difficult” theme, with
the most concise and pithy being attributed to Phil Karlton (RIP) of
Netscape in the 1990s. Another wit takes that to its logical conclusion:

    A well known aphorism attributed to Phil Karlton is:

        There are only two hard things in Computer Science: cache
        invalidation and naming things.

    I realized yesterday that this is really only one hard problem: much
    of the reason that naming things is hard is that changing names is
    hard, so you'd better name something right the first time. Why is it
    hard to rename things? Poor cache invalidation.

    <URL:http://www.jefftk.com/p/cache-invalidation>

-- 
 \              “In the long run, the utility of all non-Free software |
  `\      approaches zero. All non-Free software is a dead end.” —Mark |
_o__)                                                    Pilgrim, 2006 |
Ben Finney

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


Thread

Re: Strange Behavior robertw89@googlemail.com - 2014-06-02 20:05 +0200
  Re: Strange Behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-03 00:22 +0000
    Re: Strange Behavior Chris Angelico <rosuav@gmail.com> - 2014-06-03 10:30 +1000
    Re: Strange Behavior Igor Korot <ikorot01@gmail.com> - 2014-06-02 17:49 -0700
    Choosing good names for things is difficult (was: Strange Behavior) Ben Finney <ben@benfinney.id.au> - 2014-06-03 10:57 +1000
      Re: Choosing good names for things is difficult (was: Strange Behavior) Rustom Mody <rustompmody@gmail.com> - 2014-06-02 19:06 -0700
        Re: Choosing good names for things is difficult (was: Strange Behavior) Chris Angelico <rosuav@gmail.com> - 2014-06-03 13:33 +1000
    Re: Strange Behavior Peter Otten <__peter__@web.de> - 2014-06-03 10:01 +0200
      Re: Strange Behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-03 11:44 +0000

csiph-web