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.
DeviceNamer.cgi VlanFinder.cgi TagGenerator.cgiCommand-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.plSubroutines 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_descrNOTE: 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 = ();