[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Debian coding style?

(I don't know if Amy is on debian-devel, so I leave her on
the To line just to be sure I reach her. I apologize if she gets
it twice.)

uwd38znr@umail.furryterror.org (Amy Fong):
> Query, is there actually a coding style guideline for debian stuph?

Debian as such does not write much code. There are a few tools
written for Debian specifically, but they are few enough that a
coding style guideline is not necessary.

When modifing code, Debian developers (indeed, anyone modifying
code) are supposed to follow the style of the original code.

While I, personally, don't like much of what your guidelines suggest,
I couldn't care less about most stuff. It's your code and you can do
as you wish, and if I ever have to hack on it, I will also do as you
wish. However, there is one detail I wish strongly object to, since
it will make it difficult to even view your code, and another one
which I hope you will reconsider for your own sake, to save yourselves
from much extra work.

> 3. Tabs should be set to 2, and they should be kept as tabs, no spaces
> please.

Do this and be hated by anyone else having to touch or view your
code. There are too many programs that interpret tabs to change all
of them. All editors, pagers, text-to-postscript converters, indenters,
web viewers, ... there's literally hundreds of them. Remember, if you
write free code, there will be hundreds, thousands, at best hundreds
of thousands of people who view it, and they _won't_ be happy if
they have to continually change the size of tabs.

Tabs MUST be set to 8.

Use whatever indentation you want, but don't touch tabs.

I am serious about this. If you set tabs to two, then anyone with the
standard setting of 8 will be much too long lines to be viewed nicely.
Indeed, two is so small a value that there is no point in it, since it 
doesn't even save much space.

It is not possible to re-indent code cleanly just by chaning the
tab setting. It simply does not work well enough. It has been tried
often enough, and it doesn't work.

This was the first detail.

> 22. Localization: text which will be visible to the user should never be
> embedded within the source code. All string literals should be placed in a
> separate header file to ease the pain of possible future translation.

This is difficult, burdensome and unnecessary, given GNU gettext.
It creates a huge number of identifiers quite needlessly. It also easily
leads to localization that results in a need to recompile the program
to get a new language. That is a monstrous stupidity, except in rare
cases where the program must be a single, minimal executable without
data files.

Stupid little mailer under construction, sorry for any problems.

Attachment: pgpXW6CEoTjmF.pgp
Description: PGP signature

Reply to: