[PD] Good programming practice

Tom Schouten doelie at zzz.kotnet.org
Wed Oct 20 10:45:23 CEST 2004


On Wed, Oct 20, 2004 at 10:48:14AM +0900, rodney wrote:
> HI all, 
> 
> After a quick search through the archives, this is the link provided from an
> earlier discussion with the above subject.
> 
> http://www.earcatching.com/pdconv/
> 
> Pd allows a lot of different 'styles' of programming, some better for some
> things than others. All I know is that my style has left me strangled in
> invisible spagetti and hope to improve it by looking at how everyone else
> does it.
>

spaghetti isn't that bad. life comes from chaos and turbulence :)

anyway. the thing to do i think is simple. every time you see a
collection of things that looks like something you can give a name
as a whole, you put it in a subpatch or an abstraction.

if you got wires going everywhere, the essence of your patch is most
likely the network of wires, not the objects connecting them. this is 
very hard to chop up.

i usually leave it as it is, or i define some 'busses' using send/receive
or catch/throw that take the edge off a bit.

the whole idea is, that most systems made by man can be factored.
at least if the maker was thinking and not just acting incrementally 
intuitive. in this light, thinking is pruning: cutting wires.

this means the structure looks like:
(1) very closely connected modules (spaghetti)
(2) reasonably interconnect between the modules

this is how OO works for example. information hiding is actually
spaghetti hiding in practice.

in fact most computer programs have this structure.
the second step is absolutely necessary if you want to understand
what you've been doing. if you can't add that level of organization,
what you are doing might be incomprehensible voodoo anyway. and
this is not necessarily a bad thing. pd sort of promotes this i think.

in fact, this 2 part structure, or a recursion thereof, can be
found in most structures that are built by any evolutionary
(incremental mutate + test) process. i.e. math, the unix kernel, 
the human brain, the rest of the human body, etc..





More information about the Pd-list mailing list