26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide...

13
26 February 2009 Dietrich Beck Update on Conventions Update on Conventions • Why (not) Using Conventions • LabVIEW Style Guide CS Coding Conventions CS Color Schemes

Transcript of 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide...

Page 1: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

Update on ConventionsUpdate on Conventions

• Why (not) Using Conventions

• LabVIEW Style Guide

• CS Coding Conventions

• CS Color Schemes

Page 2: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

Why not Using ConventionsWhy not Using Conventions

• conventions might contradict personal preferences

• "I use my own conventions"

• it is very hard to agree on and to accept common conventions

• sticking to conventions slows down development

• checking conventions and "refactoring of code" takes time

• ...

Page 3: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

Why Using Conventions?Why Using Conventions?

• ideal: everybody should stick to the same conventions

• code is easier to maintain

• others might be able to read your code

• reduce bugs

• improve re-usability

• save time (later!)

• avoid re-implementation of the same functionality (if code needs to be thrown away)

• ...

• of course: exceptions in specific cases

Page 4: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

LabVIEW Style GuideLabVIEW Style Guide

• LabVIEW development guidelines:– http://www.ni.com/pdf/manuals/321393d.pdf

• LabVIEW Style Checklist– LabVIEW Help Search the LabVIEW Help ... search for

LabVIEW Style Checklist– http://www.ni.com search for LabVIEW Style Checklist

select LabVIEW version– google for LabVIEW Style Checklist

• examples– use and wire Error in and Error out– wiring: from left to right, no hidden wires, no backward wires– document code via descriptions of VIs, controls and indicators– ...

Page 5: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

VI-AnalyzerVI-Analyzer

• LabVIEW Tools VI Analyzer.

• quotes from NI-Website– "...Use the LabVIEW VI Analyzer Toolkit to improve code quality

and catch potential problems earlier during development. The VI Analyzer automates code reviews and enables more exhaustive code analysis..."

– "... avoid overlooking improper coding techniques that could impact an application’s performance, functionality, or maintainability. Enforce good programming practices and coding styles within teams of developers in order to ensure the readability and functionality of code. Overall, use the VI Analyzer Toolkit regularly to develop high-quality, robust LabVIEW applications..."

Page 6: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

How to Use the VI AnalyzerHow to Use the VI Analyzer

• makes sense, if developer agree to coding conventions

• check VIs, using a prepared configuration file

• aim for less then 2% of failed tests– improving VIs takes about one day per library – you might even find a few bugs

Page 7: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

CSCS (Coding) Conventions (Coding) Conventions

• http://wiki.gsi.de/cgi-bin/view/CSframework/CsCodingConventions

• specific for CS framework

• depends on LabVIEW Style Guide (LSG)

• further refines LSG

• defines exceptions from LSG

• defines data types for communication

• some features might be checked using VI Analyzer

• some features require a real code review

• ...

Page 9: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

SCADA GUI Design and ColorsSCADA GUI Design and Colors

• example: PHELIX' "FiveColor.vi" defines colors for states

• user Interface– DIN EN ISO 9241-110– SCADA: IEC/EN 60073 (VDE 0199), IEC/EN 60204-1

• the above is not accessible via the web. Therefore: – US Army TM 5-601: "SCADA Systems ..."

http://www.army.mil/usapa/eng/DR_pubs/dr_a/pdf/tm5_601.pdf– http://de.wikipedia.org/wiki/Mensch-Maschine-Schnittstelle– ...

• color blind people: use rate of blinking– fast: error/fatal– slow: warning– none: o.k. (more or less)– problem: individual blink rate for indicators with LabVIEW

Page 10: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

Definition of ColorsDefinition of Colors(by (by UtilityLibUtilityLib))

color of Boolean control/indicator

background color

text color (use with background color)

text color (use with white background)

Page 11: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

How to UseHow to Use

• need reference of control or indicator

• set status of value

• different VIs– Boolean– String or Numeric– Listbox– general: just set color

of label and caption

Page 12: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

Semi-Automated ColoringSemi-Automated Coloring

"UtilityLib.set color of panel to default.vi":

Page 13: 26 February 2009Dietrich Beck Update on Conventions Why (not) Using Conventions LabVIEW Style Guide CS Coding Conventions CS Color Schemes.

26 February 2009 Dietrich Beck

GUI Conventions...GUI Conventions...