atom feed55 messages in at.iem.pd-listRe: [PD] Idiomatic Pd
FromSent OnAttachments
Luke IanniniJul 27, 2008 6:33 pm 
Luigi RensinghoffJul 28, 2008 4:01 am 
Hans-Christoph SteinerJul 28, 2008 1:39 pm 
Chris McCormickJul 28, 2008 7:48 pm 
Luke IanniniJul 28, 2008 9:48 pm 
Frank BarknechtJul 28, 2008 10:31 pm 
Luke IanniniJul 28, 2008 11:07 pm 
Luke IanniniJul 28, 2008 11:29 pm 
Frank BarknechtJul 28, 2008 11:53 pm 
IOhannes m zmoelnigJul 29, 2008 12:13 am 
Matt BarberJul 29, 2008 12:18 am 
Frank BarknechtJul 29, 2008 1:04 am 
Enrique ErneJul 29, 2008 5:01 am 
marius schebellaJul 29, 2008 7:01 am 
Matt BarberJul 29, 2008 7:28 am 
Frank BarknechtJul 29, 2008 8:39 am 
Matt BarberJul 29, 2008 9:41 am 
Hans-Christoph SteinerJul 29, 2008 10:29 am 
Hans-Christoph SteinerJul 29, 2008 10:33 am 
Hans-Christoph SteinerJul 29, 2008 10:34 am 
Frank BarknechtJul 29, 2008 11:04 am 
marius schebellaJul 29, 2008 11:23 am 
marius schebellaJul 29, 2008 11:25 am 
Hans-Christoph SteinerJul 29, 2008 12:09 pm 
Hans-Christoph SteinerJul 29, 2008 12:10 pm 
Mike McGonagleJul 29, 2008 12:40 pm 
Matt BarberJul 29, 2008 12:43 pm 
Thomas MayerJul 29, 2008 12:53 pm 
Matt BarberJul 29, 2008 1:28 pm 
Hans-Christoph SteinerJul 29, 2008 4:47 pm 
Frank BarknechtJul 30, 2008 12:16 am 
Frank BarknechtJul 30, 2008 1:01 am 
Chris McCormickJul 30, 2008 1:46 am 
Hans-Christoph SteinerJul 30, 2008 9:12 am 
Frank BarknechtJul 30, 2008 10:10 am 
marius schebellaJul 30, 2008 12:14 pm 
Frank BarknechtJul 30, 2008 12:34 pm 
Roman HaefeliJul 30, 2008 4:49 pm 
marius schebellaJul 30, 2008 6:08 pm 
Hans-Christoph SteinerJul 30, 2008 8:31 pm 
Hans-Christoph SteinerJul 30, 2008 8:44 pm 
Frank BarknechtJul 30, 2008 11:20 pm 
IOhannes m zmoelnigJul 31, 2008 12:33 am 
Damian StewartJul 31, 2008 1:11 am 
Roman HaefeliJul 31, 2008 1:16 am 
Matt BarberJul 31, 2008 1:24 am 
Roman HaefeliJul 31, 2008 1:56 am 
Matt BarberJul 31, 2008 3:29 am 
Frank BarknechtJul 31, 2008 8:14 am 
Hans-Christoph SteinerAug 1, 2008 1:48 pm.pd
Luke IanniniAug 3, 2008 2:02 am 
marius schebellaAug 3, 2008 12:32 pm 
Luke IanniniAug 7, 2008 11:36 pm 
IOhannes m zmölnigAug 7, 2008 11:54 pm 
Luke IanniniSep 19, 2008 4:53 am 
Subject:Re: [PD] Idiomatic Pd
From:Enrique Erne (enri@netpd.org)
Date:Jul 29, 2008 5:01:33 am
List:at.iem.pd-list

Hi Luke

Luke Iannini wrote:

There are some amazing sets of abstractions being released recently, which has served to highlight the many extant styles of patching. I was wondering if there was interest in establishing a set of guidelines for patching in the vein of PEP 8 for Python; I've found that document to be very relaxing as it is a standardized approach to OCD. More seriously, it greatly helps when reading other people's code or collaborating. http://www.python.org/dev/peps/pep-0008/

The only one I have seen so far for Pd covers best practices for layout. I'd want to include that, but also codify naming, arguments, common idioms, and so on.

I've begun to collect some of my practices to start things off. I was hoping we could all lazy-vote the document together in this thread and I'll then compile it into a PdPedia/Pd.info document. So, feel free to object to or replace my propositions.

Style: * If giving $0 as an argument to an abstraction, it is always first in the argument list [1] * * When possible, pass parent arguments in numeric order, like [child $0 $1 $2 other1 other2] etc. * Sends and Receives are written in camelCase, with "R" appended to complementary receives (e.g. in GUIs, $0mySlider for the send and $0mySliderR for the receive) * When prepending $0 to a symbol, only add a "-" to separate it from another number, like [r $0-1stSend]. Otherwise the symbol should immediately follow, like [r $0mySend].

i arbitrary use ".", "-" and "_" . IMO a separator in a send/receive name is needed when you use a dollar, and i would welcome a guideline, especially if there is a certification and quality brand for pd-patches :)

but there are so many styles and i don't even know which way to declare an external.

now a bit personal: i don't like $0 :) . It's fine for a namespace within a patch, but I found myself often needing to access something from "outside" so i have to pass $0 around, which is ugly. I much more prefer a global receiver and route everything. so i pass the name of my patch to it's abstractions. abstracions get global receiver with $1 in it which is the motherpatchname. it helps for orientation i.e. look at the window title:

yourabstraction.pd (mother) isn't it better than: yourabstraction.pd (1284)

you can even use it for [sssad $1/vol] without having the $0 making your sssad key into a unusable name. If I have GUI inside the GOP each sliders send and receive name begin with $1. or $1- or $1_ (guideline please!), that makes it possible to hijack the patch from an other patch. Like the midilearn or automator patch can control any slider in this setup.

Franks recommendation UPPERCASE for globals is really neat.

For GUI elements like sliders I've never regret to use a kind of name hierarchy ($1.vol), usually mypatch-myabs-myparameter or mypatch.myabs.myparameter or mypatch_myabs_myparameter or whatever. so you can hijack your channel aux-sender with anything.

but that means you can't open a patch multiple times, no problem for me because i reuse code always with abstractions.

does somebody run 1 patch multiple times? (sounds like fun would you mind and share?)

i look forward to the lazy-vote :)

eni

* When working with stereo, Left and Right pairs are written with Le and Ri appended (to distinguish them from an R denoting "receive", above)

Programming recommendations * To invert a toggle, use [== 0] * Use the loadbang of the parent of both abstractions to initialize two or more interdependent abstractions

[1] I think of this like emulating the "self" convention in Python

Programming recommendations

always use [trigger] for 1tomany connections