On Jul 29, 2008, at 1:31 AM, Frank Barknecht wrote:
Hallo, Luke Iannini hat gesagt: // 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/
I think, it would be important to first collect every possible style element in the wild and document what people are using in reality. That would be interesting. I'm not too much in favour of a style
"guide" however. Let people be creative.
Nobody is talking about requirements. If you don't like style
guides, don't use them. But it is really not useful to squelch other
people's efforts, especially when you don't even have an intention of
using this stuff.
I've begun to collect some of my practices to start things off.
I added where I do things different.
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]
I often put it last (and it's specified to be that way e.g. in Memento)
- 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)
I use the underscore style sometimes but often a simple "dash" style: "r some-thing" instead of camelCase. My reason: It doesn't need any Shift-key-combinations on German keyboards, and I find camelCase hard to read.
When I want to name matching send/receive pairs I use $0-some-s and $0-some-r.
- 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 always seperate $0 with a $0-dash. $0myGod is easy to misunderstand.
- When working with stereo, Left and Right pairs are written with Le
and Ri appended (to distinguish them from an R denoting "receive", above)
Nice idea. I never did that, though.
I like the idea of standard labels, but I find unix-isms hard to
remember. Why not just use the whole word? Code is read far more
than it is written. It takes a trivial amount of time to type
'right' vs 'ri', it will take a lot longer for people to figure out
what "Ri" means if they don't know or have forgotten (like I
undoubted will).
.hc
Ciao
Frank Barknecht _
______footils.org__
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
All mankind is of one author, and is one volume; when one man dies,
one chapter is not torn out of the book, but translated into a better
language; and every chapter must be so translated.... -John Donne