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

Re: Proposed conventions for plpgsql coding for 1.3 and beyond



On 3/6/07, Chris Travers <..hidden..> wrote:
Hi all;

Since 1.3 will be our first release with substantial logic
encapsulated in the database, I wanted to get discussion started on
coding conventions.  Currently we are targetting the code for
PostgreSQL 8.0 through 8.2 but want to ensure it is reasonably
future-safe.  My own thinking is that we can worry about most of the
future-safety issues later since the level of alteration isn't likely
to be that great.

Here are my proposals:

Function names should be in the following format:  object_method (i.e.
employee_save).

Function arguments should be declared in the definition, and should be
prefixed with in_ to ensure uniqueness from the column names.

Functions which save entities should return the primary key of the saved entity.

Any feedback?


I was working on an email to suggest breaking the project into
smaller, function specific, code modules for better readability and
maintenance. Your proposals above look like they are taking us in this
direction with even greater productivity gains than I was seeking.

I like where you are going with the db development and I think it will
be much easier to contribute to this project once you reach this level
of structure. Of course I am still trying to get up to speed with this
projects level of Perl, so maybe I am making excuses for not digging
in fast enough.

Regards,
Gerald.