Network Services Programming Style Guide - Naming Conventions

This document outlines the mandatory and recommended functional and style guidelines for Network Services programming projects. Specifically, this document covers the various naming conventions to be followed for NS scripts and tools.
Naming Conventions

Web-based Scripts (i.e. those that will run in a browser window): Upper-case first letter, then upper-case letter for the start of each word after that. Should have a '.cgi' suffix. Choose a name that indicates what the script does:
DeviceNamer.cgi
VlanFinder.cgi
TagGenerator.cgi
Command-line scripts: All lower-case letters. Underscores between words. Should have a suffix that makes sense (e.g. '.pl' if it's written in Perl, '.py' if written in Python, '.sh' if a shell script). Choose a name that indicates what the script does:
platform_vlan_audit.pl
macwatch_monitor.pl
wiscnic_text_input.pl
Subroutines and Functions: Lower-case first letter, then upper-case letter for the start of each word after that. Choose something that indicates clearly what the function does.
createNewUserRecord()
getDeviceNameFromURL()
sortByIPAddress()
Variables: All lower-case. Underscores between words. Choose something descriptive and avoid abbreviation unless it's clear what is meant:
$my_variable_name
$stp_root_value
$dhcp_department_descr
NOTE: Dale uses an upper-case first letter to indicate a global-scope variable.

Constants and file-handles: All upper-case letters. Underscores between words:

$PI
$DAYS_IN_MONTH
$MAX_RECORDS
$TXT_INPUT_FILE
open (LOG, "$logfile");
Hashes and Arrays: Same convention as other variables, but do NOT use the word "array" or "hash" in the name:

my %device_info = ();
my %ip_addresses = ();
my @user_net_ids = ();
NOT
my %device_info_hash = ();
my %ip_address_hash = ();
my @user_net_id_array = ();


Keywords:
aants, tools, network services, programming, style 
Doc ID:
16739
Owned by:
Mark T. in Network Services
Created:
2011-02-02
Updated:
2018-03-01
Sites:
Network Services