[PD-dev] Refactoring Pure Data (2 of 2)

Vincent Lordier vincent.lordier at gmail.com
Wed Sep 13 02:05:23 CEST 2006


> Even considering the actual implementation instead of the simplified
> example, I wouldn't consider that renaming p1 to priority_min is
> really helping anyone, because they already know p1 is the minimum
> priority by looking two lines above. All uses of p1 lie within 5 lines of
> code, so using a longer name doesn't do much more than making the name
> longer to read. In some extreme situations (not this function) this can
> make the code harder to read, as the longer names clutter the function.
>
> >      fprintf(stderr, "priority %d scheduling enabled.\n", priority);
> >       fprintf(stderr, "couldn't change process priority to %d.\n",
> > priority);
> >       fprintf(stderr, "%s (%d)", strerror(error_desc), error_desc);
>
> You didn't replace the fprintfs by posts. It should be posts because then
> it can be routed through the GUI.



True.

> - Localization can be done here,
>
> No, localization should be done in the GUI. What should be done
> server-side, is to make error messages easier to process by the GUI.



Why not ? the engine, if running on a remote machine should also be able to
send messages to the user in its language...

> - Safe fprintf can be used to avoid overflow.
>
> Which overflow?


see snprintf


> > An explicit name saves the dev brain power at coding time ;)
>
> I assert that often it doesn't. A name shouldn't be more explicit than it
> needs to be, and it's certainly possible for names to be too explicit, and
> i don't mean the "parental advisory" sys_defaultfontshit, I mean saying
> things that are too obvious because they're already in your face 15 times
> in the same page and cause the code to go on for longer than you should
> have to read.


Quote from Wikipedia on software quality
"Understandability

Are variable names descriptive of the physical or functional property
represented? Do uniquely recognizable functions contain adequate comments so
that their purpose is clear? Are deviations from forward logical flow
adequately commented? Are all elements of an array functionally related?"
+
=> http://www.gnu.org/prep/standards/standards.html#Names
=> http://www.coding-guidelines.com/cbook/sent787.pdf
=>
http://www.raytheon.com.au/Files/Achieving%20Software%20Quality%20PDF.pdf#search=%22understandability%20readability%20quality%20C%22
=>
http://www.oreillynet.com/onlamp/blog/2004/03/the_worlds_two_worst_variable.html
=> http://www.aivosto.com/project/help/pm-understandability.html
=> http://en.wikipedia.org/wiki/Hrair_limit

etc etc ...

my 2 cents about naming.


++

vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20060913/9a742f0e/attachment.htm>


More information about the Pd-dev mailing list