Re: German 'duzen' and 'siezen' - etymology ?
From: | Mark J. Reed <markjreed@...> |
Date: | Tuesday, October 24, 2006, 13:54 |
On 10/24/06, Benct Philip Jonsson <bpjonsson@...> wrote:
> BTW: can someone of you computer people explain to me why it
> would be a good idea to write a program almost entirely
> consisting of subroutines -- i.e. the 'main' program
> practically only calls a single subroutine, which then calls
> a number of other subroutines, which in turn call other
> subroutines...?
Well, there are lots of possible reasons. The most likely one is that
the main activity consists of repeatedly performing essentially the
same series of steps with slightly different parameters, so you put
those steps in a subroutine and call it multiple times. Even if
"multiple times" means only "twice", it's much clearer what's going on
than if you copied and pasted those lines of code with slightly
different numbers.
The goal of putting code into subroutines/procedures/functions/methods
is to abstract out a piece of functionality so that it becomes a
Thing. It's psychological chunking; that functionality as a whole then
becomes a single 'action' to be used to build up more complex actions.
It's like you start out with bricks and mortar, but once you've
assembled a bunch, you start thinking in terms of walls, and once you
have walls, you start thinking in terms of rooms, and then floors, and
then homes, and then subdivisions. City planners don't deal in terms
of bricks, and programmers working on large systems don't think in
terms of individual primitive instructions.
--
Mark J. Reed <markjreed@...>