Xref: utzoo comp.software-eng:2527 comp.misc:7489 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-sdd!ncr-sd!sagpd1!jharkins From: jharkins@sagpd1.UUCP (Jim Harkins) Newsgroups: comp.software-eng,comp.misc Subject: Coding standards (was Re: Programmer productivity) Message-ID: <546@sagpd1.UUCP> Date: 27 Nov 89 19:36:38 GMT References: <34796@regenmeister.uucp> <2226@jato.Jpl.Nasa.Gov> <128179@sun.Eng.Sun.COM> Reply-To: jharkins@sagpd1.UUCP (Jim Harkins) Distribution: na Organization: Scientific Atlanta, Government Products Div, San Diego, CA Lines: 31 In article dopey@sun.UUCP (Can't ya tell by the name) writes: >I would set strict standards that deal with well written programs >(e.g. IMHO a. few if any globals, b. one routine per file, c. well >documented, etc.). I've never understood why one routine per file is such a *good* thing and thou shalt not deviate from this under penalty of dirty looks. In a lot of cases I feel that routines that belong together should be in the same file. An example is malloc/free. They use the same data structures, nobody else has any business seeing these structures, so why not have them in the same file. Other times I'll write a function to do something and, in the interests of small functions doing one thing the body of the function is "call fred, call wilma, call barney, return something". Fred, wilma, and barney are usually declared statics as they aren't much use to anyone else. I can understand the 1 routine 1 file idea, but in the real world it falls on its face pretty often. The real solution is to change C. As most software projects are divided into pieces, it seems I should be able to control which variable/function names are visible by other pieces. This calls for 2 different types of globals, a half-baked global thats visible amongst files in my piece, and full globals that are visible to other pieces. This is more of a linker issue than a C issue, all C needs is a new keyword to declare half-baked globals. I'm sure you language designers out there have a term for what I'm talking about in that last paragraph, but hopefully you all understand my point. my piece jim "Congress. Outside of Zsa Zsa the most bloated, conceited, self-indulgent entity in the world." Brought to you by Super Global Mega Corp .com