× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, 23 Mar 2005 10:10:00 -0700, John Taylor
<lists@xxxxxxxxxxxxxxxxxxxx> wrote:
> Folks,
> 
> I'm a huge fan of service programs, and have used them extensively since
> they were first made available to us. Over the years I've developed a rather
> large library of them, which is making it increasingly difficult to avoid
> namespace conflicts. Having realized that I needed to take a different
> approach, I've tried to adopt the style I've seen here on the list, where
> the name of the service program itself is used as a prefix to the procedure
> name. I'm also trying to use meaningful procedure names instead of the short
> abbreviated names I used to rely upon.
> 
> Example:
> 
> A typical service program related to our General Ledger module would be
> called "CUGLS001". Within this service program, I might have a number of
> procedures relating to the fiscal period definitions. Historically, the
> procedure names would look something like this:
> 
> GlRtvLstPrd() - Retrieve last period in specified fiscal year.
> GlRtvLstClsPrd() - Retrieve last closed period for specified company.
> GlRtvPrdSts() - Retrieve period status code.
> GlRtvPrdStsD() - Retrieve period status description.
> 
> The trouble is that you eventually reach a point where you run out of
> meaningful abbreviations. So the above procedures would now be defined as:
> 
> CUGLS001_getLastPeriod()
> CUGLS001_getLastClosedPeriod()
> CUGLS001_getPeriodStatus()
> CUGLS001_getPeriodStatusDesc()

I would shorten the common prefix to just a fews characters.  also, I
make the prefix all lower case - this could eliminate the need for the
underscore separator.
  cugGetLastPeriod( )
  cugGetPeriodStatusDesc( ) ;

generally, I organize my procedures around data structures.  kind of
like member functions in C++ or Java.   The procedure name then
becomes the name of the struct _ member procedure name.

all my procedures and data structures are organized in namespaces.  
just like in c++, only the namespace name is short and is the start of
all structure and procedure names:
  for example,  all the payroll procedures would be in namespace "pay"

there might be a check struct and employee master struct in the
payroll namespace:
  payCheck
  payMaster

those structs have procedures that function like member functions
  payCheck_Print
  payCheck_Summarize( )
  payMaster_NewEmployee( )
  payMaster_DeleteEmployee( ) ;

all the procedures that apply to the namespace in general, not having
to do with a specific struct just start with the namespace prefix:
  pay_PrintCommisionEmployees( ) ;

-Steve

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.