Re: A small rant about coding style for backend functions

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: A small rant about coding style for backend functions
Date: 2007-11-05 17:31:37
Message-ID: 200711051731.lA5HVb711577@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I understand your suggestions but it seems there would be too many
individual items to be readable. Can you suggest a full list so we can
get an idea of how long it would be?

---------------------------------------------------------------------------

Brendan Jurd wrote:
> On 11/1/07, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> >
> > I have not forgotten this suggestion. Do have any ideas what such a
> > list would look like? Examples?
> >
>
> Thanks for the reply Bruce.
>
> Code examples, perhaps with "good style" and "bad style" versions to
> illustrate each point.
>
> In the case of Tom's OP about making all your GETARG calls at the top
> of the function, you could show (for a trivial function) how it looks
> with all the GETARGs stacked neatly at the top, and how it looks with
> the GETARGs scattered and inaccurate.
>
> I think that would make it immediately clear to any newbie why it's a good idea.
>
> > I think we have avoided more details in fear of scaring off coders.
> > People usually follow our style as they gain experience. Having a hard
> > list seems like it would be a lot of do's and don't's.
>
> Just my perspective, but I think you'll scare off a lot more coders by
> giving them no firm guidance in the first place, and then jumping down
> their throats with "you did this wrong" when they post a patch.
>
> Might be worth opening up a wiki page for devs to contribute their
> insights about writing excellent (as opposed to merely passable)
> Postgres code. The GETARG rant could make a good starting point.
>
> Cheers
> BJ
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-11-05 17:35:50 Re: [HACKERS] Asynchronous commit documentation gap
Previous Message Bruce Momjian 2007-11-05 17:13:14 Re: dblink un-named connection doesn't get re-used