gettingstarted
[Top] [All Lists]

Re: Naming Conventions

To: <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Naming Conventions
From: Lars Jensen <larsjensen at rcn dot com>
Date: Mon, 31 May 2004 13:23:28 -0400
Delivered-to: gettingstarted at lists dot realsoftware dot com
List-help: <mailto:gettingstarted-request@lists.realsoftware.com?subject=help>
List-id: Getting Started <gettingstarted.lists.realsoftware.com>
List-post: <mailto:gettingstarted@lists.realsoftware.com>
I, too, prefix my controls with three-letter abbreviations, and have been
doing so for many years (in C++ before RB).

Lately I've begun to relax things a bit: I use "btn" for PushButton,
RadioButton, Checkbox, and BevelButton controls. Similarly, I use "txt" for
EditField and StaticText controls, and "bar" for Scrollbar, ProgressBar, and
Slider controls.

Why? It's all about minimizing unnecessary dependencies. I've been moving
toward a style of naming that tries to reduce the need to change code over
time. For instance, it's not uncommon that I start with a static text item,
then change it to editable text down the road, or vice versa.

Another example of this is that I used to have one naming style for
properties and another for methods. Nowadays, however, I use one naming
style for public methods and properties, and another for private. This way I
can change a public implementation from a property to a method (or two), and
not have to change any calling code.

Yet another example concerns class methods vs module methods -- a method
might start out in a window, but migrate to a globally-accessible module
over time. I name methods such that if this happens, calling code in the
window won't care.

I've been "future-proofing" my names in this way for some months now, and so
far I haven't noticed any ill effects...

lj

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>