Wiki

Clone wiki

ecueditor / ECU_Editor_Coding_Conventions

This page lists the standard naming convention and coding conventions used in ECU Editor. These coding conventions are based on generally accepted .net coding conventions.

Regions

Regions are used in the VB.net code to provide a logical grouping of code. The following regions are used within ECU Editor. The code in the Regions is ordered logically with the first called functions and subs at the top of the region and the last called functions and subs at the bottom of the region.

#Region "Variables"

This region contains variables that are used within the class

#Region "Properties"

This region contains Public Properties of the class

#Region "Form Events"

This region contains events that are fired from actions on the form e.g. Form_Load, Form_Click, Form_KeyPress etc

#Region "Control Events"

This region contains events that are fired from actions on controls on the form e.g. Button_Click, Checkbox_CheckChanged etc.

#Region "Functions"

This region contains Functions and Subs that are used by other events on a form or control e.g. DecreaseSelectedCells(), CopyMaps() etc

#Region "Not Used"

This region contains Functions and Subs and Event handlers that are not currently being used

Naming Conventions

Form and Class Names

Forms and Classes are named using capitalization and are desciptive of the function of the form. e.g. K8DataLog.vb (filename) K8DataLog (Class Name)

Form Control Names

Form controls are named with a capitalized first letter of the type of control followed by an underscore followed by a suitable name that describes the function of the control e.g. B_STPMap, C_PAIR

Form Events Subs

Form events are Capitalized and contain the name of the form followed by an underscore followed by the name of the event e.g. K8AdvSettings_Load, K8AdvSettings_KeyPress

Form Control Event Subs

Form Control Event Subs are Capitalized and contain the name of the control followed by an underscore followed by the name of the event e.g. B_Close_Click, C_Fuelcut_CheckedChanged

Function and Sub Names

Function Names are Capitalized and should be named to indicate the purpose of the Function or Sub e.g. ModifyOriginalECUCode(), ShifterCodeInMemory()

Variable Names

Variables passed into Functions and Subs or declared within Functions and Subs are in Camel case and should be named to indicate what they are used for e.g. numberOfColumns, copyFromMap

Form or class variables are named Camel case with an underscore in front of the variable name e.g. _change, _previousRow etc. The underscore helps identify the scope of the variable and makes it easy to select these variables with auto complete in the code editor.

Coding Conventions

  • Variables are declared on separate lines
  • Variable names are descriptive of their purpose
  • Do not use Public variables, use Public Properties instead
  • Unused variables should be removed from code
  • Unused Functions and Subs should be removed or moved to the "Not Used" region

Updated