Você está na página 1de 7

Style Rules

Checklist
ThischecklistlistsallthestylerulespresentedthroughoutTheLabVIEWStyleBook.Rulepriority
isdistinguishedbyfontstyle,withplainfontsfornormalpriorityrules,andboldfontsforhigh
priorityrules.Usethischecklistwhenperformingcodereviews,asdiscussedinsection10.1.2,
Manual Checklist, of Chapter 10, Code Reviews. Edit the contents to customize a style
convention for your organization. You can also use it as a quick lookup reference when
discussingstylewithpeers.

Chapter2

2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9

2.10
2.11
2.12
2.13
2.14
2.15
2.16
2.17

MaintainaLabVIEWprojectjournal
Writearequirementsspecificationdocument
MaintaingoodLabVIEWstylethroughouttheproofofconcepts
DocumentyourLabVIEWoptionsandbackuptheLabVIEW.inifile
DevelopreusableSubVIs
MakereusablelibrariesaccessiblefromtheLabVIEWpalettes
PlacereusabletemplatesintheLabVIEW\templatesfolder
Maintainanorganizedrepositoryondisk
CreateanLabVIEWsourcefolderhierarchythatreflectsyourapplications
architecture
Createthefolderhierarchybeforeyoubegincoding
OrganizeLabVIEWsourcefilesintocohesiveprojectlibraries,whereappropriate
Createuniqueandintuitivesourcefilenames
Donotabbreviatefilenames
NeveruseLabVIEWsdefaultfilenames
IdentifythetoplevelVIs
FollowyourorganizationsCMRules
Avoidmovingsourcefilesondisk

Chapter3

3.1
3.2
3.3
3.4
3.5

Grouprelatedcontrolsusingdecorations,spacing,tabs,andclusters
Applysymmetryandspacingtofrontpanelobjects
Sizesimilarobjectsthesame
MaximizethetoplevelVIpanelsforindustrialapplications
SizedialogVIpanelsmuchlessthanfullscreen

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

3.6
3.7
3.8
3.9

3.10
3.11
3.12
3.13
3.14
3.15
3.16
3.17
3.18
3.19
3.20

3.21
3.22
3.23
3.24

3.25
3.26
3.27
3.28
3.29
3.30
3.31
3.32
3.33
3.34
3.35
3.36
3.37
3.38
3.39
3.40

CenterdialogVIpanels
UseLabVIEWsdialogsfordesktopapplications,avoidthemforindustrial
applications
Usesystemcontrolsfordesktopdialogs;use3Dcontrolsforindustrialdialogs
EnlargeandcentertheobjectsofanindustrialGUIVIinproportiontotheir
importance
LimitthequantityofinformationdisplayedonaGUIVIpanel
Avoidoverlappingvisibleobjects
Hidethetoolbar
Includeyourcompanylogoforaprofessionalappearance
UsedefaultappearanceforsubVIpanels,objects,andmosttext
Arrangecontrolstoresembletheconnectorassignments
Resizethepanelforasnugfit
Deletetemplateinstructionsimmediatelyaftereditsareperformed
Deletetemplateinstructionsimmediatelyaftereditsareperformed
Applyconsistentfontsandcapitalization
Chooseonlyonefont,andvarythesize,boldness,andcolortoobtainmultiple
styles
Usesuccinct,intuitivecontrollabelsandembeddedtext
Apply13pointblackApplicationfontformostsubVIpanels
Providedefaultvaluesandunitsinparenthesesattheendofownedlabels
Combineboldtextlabelswithplaintextparentheses,forcontrollabelsof
commercialsubVIs
Maximizethecontrastbetweentextcolorandbackgroundcolor
Uselargetextsizeforcommandbuttonsandcriticaldata
Allowextraspacebetweenlabelsandobjectsformultiplatformapplications
Applycolorjudiciously
Createacolortheme
Followuniversalconventionsforgreen,yellow,andred
LeavethepanelandobjectsofsubVIsgray
Keepthecolorschemessimpleandtimelimited
Limitthenumberofcontrolsthatarevisibleandenabledatanyonetime
Restricttherangeofallcontrolstovaluesthatarerelevanttotheapplication
SettheDataRangepropertyofnumericcontrols
Useringorenumeratedcontrolsoverstringcontrolswhenfeasible
SettheTabbingOrderandusetheKeyFocuspropertytoaidnavigation
CustomizetheruntimemenusfortoplevelVIs
AlwaysincludeaHelpmenuorbutton
Beconsistent!

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

Chapter4
4.1

4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
4.15
4.16
4.17
4.18
4.19
4.20
4.21
4.22
4.23
4.24
4.25
4.26
4.27
4.28
4.29
4.30
4.31
4.32
4.33
4.34
4.35
4.36
4.37
4.38

Use12801024displayresolution
Leavethebackgroundcolorwhite
Useahighobjectdensity
Limitthediagramsizetoonevisiblescreen,orlimitscrollingtoonedirection
CreateamultilayerhierarchyofsubVIs
ModularizetopleveldiagramswithsubVIs
ModularizethehighlevelsubVIswithlowerlevelsubVIs
DonotcreatesubVIsjusttosavespace
AvoidtrivialsubVIscontainingfewnodes
CreateameaningfuliconandcohesivedescriptionforeverysubVI!
Minimizewirebends;eliminatekinksandloops
Maintainevenspacingofparallelwires
Tunnelwiresthroughleftandrightbordersofstructures
Donotwirethroughstructuresunnecessarily
Neverobstructtheviewofwiresandnodes
Limitwirelengthssuchthatsourceanddestinationarevisibleononescreen
Neveruselocalandglobalvariablesforwiringconvenience
Labellongwiresandwiresfromhiddensourceterminals
Placeunwiredfrontpanelterminalsinaconsistentlocation
Modularizewiresofrelateddataintoclusters
Saveclustersastypedefinitions
Alwaysflowdatafromlefttoright
Propagatetheerrorcluster
Avoidarrayandclustercoercions
Createcontrolsandconstantsfromaterminalscontextmenu
Disabledotsatwirejunctions
AvoidSequencestructuresunlessrequired
Avoidnestingbeyondthreelayers
Usewritelocalvariablesforinitializingcontrolvalues
UseglobalvariablesforsimpledatasharingbetweenparallelloopsorVIs
UseaSequencestructuretoorderoperationsifnodatadependencyexists
UseonlyFlatSequencestructureswhenrequired
Avoidpollingvariableswithincontinuousloops
Avoidvariablesifwiresarefeasible
Useshiftregistersoverlocalandglobalvariables
Groupmostshiftregistersnearthetopoftheloop
Labelwiresexitingtheleftshiftregisterterminal
UseloopedCasestructuresoverSequencestructures

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

Chapter5

5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
5.10
5.11
5.12
5.13
5.14
5.15
5.16
5.17
5.18

5.19
5.20
5.21
5.22
5.23
5.24
5.25
5.26
5.27

5.28
5.29
5.30

Havefuncreatingicons
CreateauniqueandmeaningfuliconforeveryVI
NeveruseLabVIEWsdefaulticons
SaveVIswithsubVIiconsvisibleinsteadofterminals
Useablackborder
Combineaglyphwithcolorandtextforbeststyle
Chooseuniversallyrecognizedglyphs
Use8or10pointsmallfontsformosttext
ChooseaunifiedstyleforrelatedVIs
BudgetyourtimeinproportiontointendedVIreuse
Usetextualforeground,coloredbackground,andablackborderforfastestresults
Contrastthetextandbackgroundcolors
ChooseacolorconventionforthetypeofVI
CreateanicontemplateforrelatedVIs
Reuseoneglyph,colorscheme,andfontforrelatedVIs
Copygraphics
Avoidtextandgraphicsnotuniversallyunderstoodoninternationalicons
Chooseconnectorsandterminalassignmentsthatpromoteclearwiringand
properdataflow
Selectapatternwithextraterminals
ChooseaunifiedpatternforrelatedVIs
Usethe4x2x2x4connectorpatternformostVIs
Assigncontrolstoleftterminals,indicatorstorightterminals
NevercrosswirestubsintheContextHelpwindow
Specifyterminalassignmentsresemblingthepanellayout
Assignerrorclusterstobottomleftandrightterminals
AssignreferencesandI/Onamestotopleftandrightterminals
Chooseleftandrightverticaledgeconnectorterminalsforhighpriorityinputsand
outputs
Choosetopandbottomhorizontaledgeconnectorterminalsforlowerpriority
inputsandoutputs
Specifyrequiredpriorityforcriticalinputsandoutputs
Specifyoptionalpriorityforinputsandoutputsthatarenormallynotused

Chapter6
6.1
6.2

Choosecontrolsthatsimplifytheoperationofthepanel
Choosememoryefficientdatatypes

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

6.3

6.4
6.5
6.6
6.7
6.8
6.9
6.10
6.11
6.12
6.13
6.14
6.15
6.16
6.17
6.18
6.19
6.20
6.21

6.22
6.23
6.24
6.25
6.26
6.27
6.28
6.29
6.30

Choosecontrolsanddatatypesthatfacilitateconsistentdatastructures
throughoutanapplication
Configureanappropriatedefaultvalueforeachcontrol
Entercontroldescriptions
Savecustomcontrolsasstricttypedefinitions
Createarraysandclustersthatassociaterelateddata
UseBooleansiftwostatesarelogicalopposites
AssignnamesthatidentifytheTRUEandFALSEvaluebehavior
Usecommandbuttonsforaction,slideswitchesforparametersettings
LabeltheTRUEandFALSEstatesofslideandtoggleswitches
Avoidusingbuttonsorswitchesasindicators,andLEDsascontrols
UseI32representationforintegersandDBLforfloatingpointnumbers
Useautomaticformattingunlessaspecificformatisrequired
Showradixforhex,octal,orbinarydata
Useenumsliberallythroughoutyourapplications
Saveenumsastypedefinitions
AvoidstringcontrolsonGUIVIpanelsunlessrequired
Useenum,ring,andpathcontrolsinplaceofstringcontrolswherepossible
KeeptheBrowsebuttonvisibleforpathcontrolsonGUIVIpanels
Usearraysformultivalueddataitems;useclustersforgroupingmultipledistinct
items
Usearraystostorelargeordynamiclengthdatasets
Enterdescriptionsforarrayandclustershellsandcontrolelements
Usealignmenttoolstokeepclustersneatandcompact
Saveallclustersastypedefinitions
AlwaysuseBundleandUnbundleByName
AvoidclustersforinteractivecontrolswithDialogVIs
Organizecomplexdatausingnesteddatastructures
Avoidmanipulatingnesteddataduringcriticaltasks
Limitthesizeofarraysbyinitializingtomaximumlength

Chapter7

7.1
7.2
7.3
7.4
7.5
7.6

AllVIsmusttrapandreporttheerrorsreturnedfromerrorterminals
Traperrorsbypropagatingtheerrorclusteramongtheerrorterminals
Traperrorsfromalliterationsofloops
Disableindexingoferrorswithcontinuousloops
Trapallerrorsfromallnodesthathaveerrorterminals
Reporterrorsusingadialogand/orlogfile

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

7.7
7.8
7.9
7.10
7.11
7.12
7.13
7.14
7.15
7.16

UseGeneralErrorHandlerVIoverSimpleErrorHandlerVI
Implementanerrorlogfileforapplicationdeployment
Suppressdialogerrorreportingforunattendedorremoteoperation
AvoidsubVIswithbuiltinerrorreporting
MaintainuserdefinederrorcodeswithinanXMLfile
UsenegativecodesforI/Odeviceerrors,andpositivecodesforwarnings
SkipmostsubVIdiagramsonerrorusinganErrorCaseStructure
UseunwireddefaultsoverconstantsforoutputtunnelsofErrorcase
UsetheSubVIwithErrorHandlingtemplate
ErrortrappingisrequiredfornodesthatperformI/Ooperations,recommendedfor
nodesthatcontainerrorterminals,andoptionalfordiagramsthatdonotcontain
nodeswitherrorterminals
7.17 Tunneltheerrorclusternearthebottomofstructures
7.18 Leaveautomaticerrorhandlingdisabled

Chapter8
8.1
8.2

8.3
8.4
8.5
8.6
8.7
8.8
8.9
8.10
8.11
8.12
8.13
8.14
8.15
8.16
8.17
8.18
8.19
8.20
8.21
8.22

Usemultiplecriteriafortheloopcondition
UseaTimedLoopforhighlypreciseorcomplextiming,anduseaWhileLoop
otherwise
IncludeadelaywithincontinuousWhileLoops
AvoidpollingGUIobjects
UsetheValueChangeeventformostGUIcontrols
PlacecontrolterminalswithintheirValueChangeeventcase
ResizetheEventDataNodetohideunusedterminals
Avoidcontinuoustimeoutevents
UseastatemachinedesignpatterninmostVIsofmediumorgreatercomplexity
Derivetheapplicationsprimarystatesfromthespecificationordesigndocument
Dividetheprimarystatesintoadditionalstates
Useanenumeratedtypedefinitionforthecaseselector
MinimizecodeexternaltotheCasestructure
IncludestatesforInitialize,Idle,Shutdown,andBlank
AvoidtimeoutwiththeEnqueueandDequeueElement
Usequeues,sharedvariables,orRTFIFOsforparallelloopmessaging
Prioritizeloopsusingdelaysorthreadpriorities
Sizeparallelloopstothesamewidthandalignvertically
Minimizespacebetweenloops
Labeleachloopinthetopleftcorner
UsetheCallByReferenceNodeovertheRunmethod
Choosestandardconnectorterminalassignments

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

8.23
8.24
8.25
8.26
8.27
8.28

8.29
8.30
8.31
8.32

Maintainallcomponentswithinadedicateddirectory
Passdatabetweencomponentswithshiftregisters
Assignoneinputandoneoutputterminalastypevariant
Displaypluginpanelswithinsubpanels
Createaparallelloopforeachcohesiveparalleltask
IncludeloopsforEventHandling,MainStateMachine,HardwareI/O,andError
Handling
PasscontrolreferencesintosubVIsviaatypedefinedcluster
AvoidsubVIfromselectionwithcontinuousloops
KeeptheEventHandlingLoopatthetoplevel
Keephighspeeddisplayupdatesatthetoplevel

Chapter9

9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
9.9

Keepfrontpanelterminallabelsvisibleonthediagram
Applyfreelabelcommentsinselectlocations
Labeleverysubdiagramofeverymultidiagramstructure
Labelalgorithms,constants,andCallLibraryFunctionNodes
Usedefault13pointplainblackapplicationfontforalldiagramtext
Leavenotesforthedevelopmentteam
UseenumerateddatatypeswithCasestructures
Createtheiconsanddescriptionsasyoudevelopyoursourcecode
Provideonlinedocumentationwithdeployedapplications

Chapter10

10.1
10.2
10.3
10.4
10.5
10.6
10.7
10.8
10.9

Enforceyourorganizationsstyleconventionusingcodereviews
Utilizeacombinationofselfreviewsandpeerreviewsforbestresults
Performaselfreviewpriortoeverypeerreview
UsetheVIAnalyzertoautomatetediousinspections
CustomizetheVIAnalyzerstestcriteria
Customizetherankforeachtestaccordingtothepriorityofeachrule
Useamanualchecklisttoperformacomprehensivestylereview
Performatleastonepeerreviewperproject
Involvethefollowingpeopleinapeerreview:projectmanager,leaddeveloper,
experiencedpeer,andaninexperiencedpeer
10.10 Bringtherequirementsspecificationandstyleruleschecklisttothepeerreview
10.11 Designateaneutralpartytotakenotesondesiredchanges
10.12 Donotmodifythefunctionalsourcecodeduringthepeerreview

Copyright 2008 Bloomy Controls, Inc.

www.bloomy.com

Você também pode gostar