Software Engineering Best Practices
This presentation is the property of its rightful owner.
Sponsored Links
1 / 56

Elijah Kerry, Certified LabVIEW Architect (CLA) PowerPoint PPT Presentation


  • 115 Views
  • Uploaded on
  • Presentation posted in: General

Software Engineering Best Practices. Elijah Kerry, Certified LabVIEW Architect (CLA) Senior Product Manager for LabVIEW, National Instruments. No source code control (or Project) Flat file hierarchy ‘Stop’ isn’t tested regularly Wait until the ‘end’ of a project to build an application

Download Presentation

Elijah Kerry, Certified LabVIEW Architect (CLA)

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Elijah kerry certified labview architect cla

Software Engineering Best Practices

Elijah Kerry, Certified LabVIEW Architect (CLA)

Senior Product Manager for LabVIEW, National Instruments


Examples of software engineering debt just some of the most common labview development mistakes

No source code control (or Project)

Flat file hierarchy

‘Stop’ isn’t tested regularly

Wait until the ‘end’ of a project to build an application

Few specifications / documentation / requirements

No ‘buddying’ or code reviews

Poor planning (Lack of consideration for SMoRES)

No test plans

Poor error handling

No consistent style

Tight coupling, poor cohesion

Examples of Software Engineering Debt(just some of the most common LabVIEW development mistakes)


The cost of a software defect

The Cost of a Software Defect

Based on an analysis of 63 software development projects at companies including IBM, GTE and TRW


Elijah kerry certified labview architect cla

Structural Health Monitoring

Medical Devices

High-Volume Production Test

Robotics and Mechatronics

Large Physics Applications

Avionics Applications

Large System Development

Powered by LabVIEW


Topics

Topics

  • Configuration Management

  • Requirements Tracking

  • Architecture and Design

  • Coding Styles and Standards

  • Testing and Debugging

  • Documentation

ni.com/largeapps


Software engineering v model

Requirements Gathering

Application Architecture

Deployment

Unit Testing

Integration Testing

Module Architecture

System Testing

Software Engineering V-Model

Prototyping

Service

Review and Test

Development

Verification


Size of labview applications

Size of LabVIEW Applications

Source: 2010 ni.com/largeapps survey


Average number of developers per project

Average Number of Developers Per Project

Source: NIWeek 2008 Software Engineering Survey


Source code control

Requirements Gathering

Application Architecture

Development

Debugging & Testing

Deployment

Source Code Control

Software Configuration Management

Merger

Developer 1

Code Revision

Locked for edit

Checked Out

Checked In

Get Latest Version

Code Repository

Checked Out

Checked In

Checked Out

Checked In

Developer 2


Scc options for integration within labview

SCC Options for Integration within LabVIEW

Native LabVIEW Integration

  • Perforce

    Integration Through Standard API

  • Microsoft Visual SourceSafe

  • Microsoft Team System

  • Rational ClearCase

  • PCVS (Serena) Version Manager

  • MKS Source Integrity

  • Seapine Surround SCM

  • Borland StarTeam

  • Telelogic Synergy

  • ionForge Evolution

    Support through additional add-ons

  • Subversion

  • Mecurial


Ni configuration management

NI Configuration Management

  • Different trunk for each LabVIEW version

  • Teams of 3 to 7 developers work in smaller repositories

  • Individuals may have their own repositories

  • New features and changes are regularly merged in

Development Trunk

Feature-Team

Repository

Feature-Team

Repository

Feature-Team

Repository

Individual’s Local

Repositories


Popularity of scc options amongst labview programmers

Popularity of SCC Options Amongst LabVIEW Programmers

Source: 2010 ni.com/largeapps survey


Elijah kerry certified labview architect cla

Configuration Management

Demo


Graphical differencing

Graphical Differencing

  • Provides a checklist of changes

  • Useful for peer reviews

  • Available via command-line


Elijah kerry certified labview architect cla

Separate Compiled Code From Source FileImproved Source Code Control Integration

2010

2009

.vi file format

.vi file format*

Front Panel

Block Diagram

Front Panel

Block Diagram

Connector Pane

Icon

Connector Pane

Icon

Compiled Code

Compiled Code

Inplaceness Info

Inplaceness Info

A separate object file is created to store and retain this information

Eliminate the need to re-save and re-submit files to source code control unless the graphical source code has been changed by the developer

*this feature is not on by default and needs to be enabled from the VI Properties dialog


Source code control scenario today

Source Code Control Scenario: Today

Local Machine

In SCC

TopLevel.vi

TopLevel.vi

Edit

SubVI1.vi

SubVI1.vi

SubVI1.vi

SubVI1.vi

Save

Check-in

SubVI2.vi

SubVI2.vi


Source code control scenario 2010

Source Code Control Scenario: 2010

Local Machine

In SCC

local .viobj

cache

TopLevel.vi

TopLevel.vi

Edit

TopLevel.viobj

TopLevel.viobj

SubVI1.vi

SubVI1.vi

Sub VI1.vi

SubVI1.vi

SubVI1.vi

Run/Save

SubVI1.viobj

SubVI1.viobj

Check-in

SubVI2.vi

SubVI2.vi

SubVI2.viobj


Vi package manager

VI Package Manager

Build and manage packages of LabVIEW code


Install and manage vi packages

Install and Manage VI Packages

Structured Error Handler

GXML Library


Easily upgrade and downgrade versions

Easily Upgrade and Downgrade Versions


Create vi configuration files

Create VI Configuration Files

A single file that contains multiple packages.

Easily share and distribute code that depends upon multiple libraries.

Structured Error Handler

Structured Error Handler Config

GXML Library

AMC Library

G Library


Elijah kerry certified labview architect cla

Track Changes

System Level View

Integrate with SCC

Software Configuration Management for LabVIEW

Merge Graphical Code

Manage Files and Links

Manage Reuse Libraries


The software engineering process

The Software Engineering Process

Requirements Gathering

Application Architecture

Development

Testing and Validation

Deployment

Now Included with DevSuite

NI Requirements Gateway

LabVIEW Statechart

Dataflow

LabVIEW Unit Test Framework

Application Builder

MathScript

Object Orientation

LabVIEW

VI Analyzer

Real Time

Statechart

FPGA

NI TestStand

Simulation

LabVIEW Desktop Execution Trace

Embedded

Prove it works.

Improve quality. Reduce risk. Save time.


The software engineering process1

The Software Engineering Process

Requirements Gathering

Application Architecture

Development

Testing and Validation

Deployment

NI Requirements Gateway

LabVIEW Statechart

Dataflow

LabVIEW Unit Test Framework

Application Builder

MathScript

Object Orientation

LabVIEW

VI Analyzer

Real Time

Statechart

FPGA

NI TestStand

Simulation

LabVIEW Desktop Execution Trace

Embedded

Prove it works.

Improve quality. Reduce risk. Save time.


Requirements traceability solution from ni

Requirements Traceability Solution from NI


Elijah kerry certified labview architect cla

Requirements Gathering

Application Architecture

Development

Debugging & Testing

Deployment

Requirements Coverage and

Project Tracking

Traceability and Documentation

Generation


Elijah kerry certified labview architect cla

Requirements Tracking

DEMO


Documentation

Documentation

  • Labeled objects

  • In-line comments

  • Distinct Icon

  • Description and Tip

  • HTML Print-Out

  • Requirements Coverage


Tools for debugging and testing

Tools for Debugging and Testing

Debugging & Testing

Functional Validation

of Code

Unit Test Framework

Advanced

Dynamic Code Analysis

Desktop Execution Trace

Real Time Execution Trace

Application Complexity

Static Code Analysis

VI Analyzer Toolkit

Simple

Low Risk

High Risk

Application Criticality


Performing a labview code review

Performing a LabVIEW Code Review

  • Walk someone through your code

  • Questions to consider:

    • Is the code easy to maintain, and has it been documented?

    • What happens if the code returns an error?

      (… or if it receives an error?)

    • Is too much functionality located in a single VI?

    • Are there any race conditions?

    • Is the memory usage within acceptable limits?

  • Perform code reviews frequently


Establish or adopt development guidelines

Establish or Adopt Development Guidelines

Front Panel Style

  • Fonts and Text Characteristics

  • Colors

  • Graphics and Custom Controls

  • Layout

  • Sizing and Positioning

  • Labels

  • Paths versus Strings

  • Enumerated Type Controls versus Ring Controls

  • Default Values and Ranges

  • Property Nodes

  • Key Navigation

  • Dialog Boxes

    Style Checklist

  • VI Checklist

  • Front Panel Checklist

  • Block Diagram Checklist

    Block Diagram Style

  • Wiring Techniques

  • Memory and Speed Optimization

  • Sizing and Positioning

  • Left-to-Right Layouts

  • Block Diagram Comments

  • Call Library Function Nodes and Code Interface Nodes

  • Type Definitions

  • Sequence Structures

    Icon and Connector Pane Style

  • Icons

  • Example of Intuitive Icons

  • Connector Panes

NI Style Guideline: ni.com/largeapps


Preparing for a code review with vi analyzer

Preparing for a Code Review with VI Analyzer

  • Automate code analysis with 80+ configurable tests

    • Performance

    • Style

    • Complexity

  • Interactively inspect failures

  • Generate custom reports

  • Code complexity metrics

  • Write your own tests with VI Scripting LabVIEW 2010


Vi analyzer code complexity metrics tests for industry standard metric calculations

VI Analyzer Code Complexity MetricsTests for Industry Standard Metric Calculations

Edges = 5 Nodes = 3 Paths = 1

Case 1

True

Case 2

False

Case 3

Cyclomatic complexity: 5 – 3 + 2 (1) = 4


Elijah kerry certified labview architect cla

VI Analyzer for Peer Reviews

DEMO


Tools for debugging and testing1

Tools for Debugging and Testing

Debugging & Testing

Functional Validation

of Code

Unit Test Framework

Advanced

Dynamic Code Analysis

Desktop Execution Trace

Real Time Execution Trace

Application Complexity

Static Code Analysis

VI Analyzer Toolkit

Simple

Low Risk

High Risk

Application Criticality


Trace production systems remotely

Trace Production Systems Remotely

LabVIEW Desktop Execution Trace Toolkit

Run-Time Execution Information

Network

Network

Deployed Real-Time Applications

VIs and Debuggable Executables

LabVIEW Real-Time Execution Trace Toolkit

Run-Time Execution Information


Desktop execution trace toolkit

Desktop Execution Trace Toolkit

Trace During Run-Time:

Event Structures

Memory Allocation

Queues / Notifiers

Reference Leaks

Thread ID

Unhandled Errors

Dynamic / Static SubVIs

Custom User Strings


Desktop execution trace toolkit1

Desktop Execution Trace Toolkit

Trace During Run-Time:

Event Structures

Memory Allocation

Queues / Notifiers

Reference Leaks

Thread ID

Unhandled Errors

Dynamic / Static SubVIs

Custom User Strings


Elijah kerry certified labview architect cla

Dynamic Code Analysis with Desktop Execution Trace Toolkit

DEMO


Remote debugging of executables

Remote Debugging of Executables

  • Include block diagrams with an executable

  • Remotely troubleshoot using LabVIEW debug tools


Tools for debugging and testing2

Tools for Debugging and Testing

Debugging & Testing

Functional Validation

of Code

Unit Test Framework

Advanced

Dynamic Code Analysis

Desktop Execution Trace

Real Time Execution Trace

Application Complexity

Static Code Analysis

VI Analyzer Toolkit

Simple

Low Risk

High Risk

Application Criticality


Data science automation

Data Science Automation

Developed Long-term testing solution for artificial hearts

"The Unit Test Framework’s flexibility and ease of use certainly enabled much faster and reliable completion of this portion of the project potentially saving hundreds of hours and thousands of dollars over the life of the project."


Labview unit test framework

LabVIEW Unit Test Framework

Input Values

Output

VI Under Test

Expected Output

Unit Test

Framework

Automated

Report Generation

Test vector = Input value(s) + Expected output(s)


Labview unit test framework1

LabVIEW Unit Test Framework

Windows Desktop

Input Values

Output

VI Under Test

Expected Output

Unit Test

Framework

Automated

Report Generation

Test vector = Input value(s) + Expected output(s)


Labview unit test framework2

LabVIEW Unit Test Framework

Real Time

Input Values

Output

VI Under Test

Expected Output

Unit Test

Framework

Automated

Report Generation

Test vector = Input value(s) + Expected output(s)


Elijah kerry certified labview architect cla

Unit Testing

DEMO


Elijah kerry certified labview architect cla

Code Coverage Example

6 Diagrams. 3 Diagrams Executed. 50% Code Coverage


Elijah kerry certified labview architect cla

Code Coverage Example

1ST Test Vector:

Block diagram, 2 Case diagrams executed. ( 2 + 1 ) / 6 = 50% Code Coverage

2nd Test Vector (aggregates covered code from 1st pass)

Block diagram, 5 Case diagrams executed. ( 4 + 1 ) / 6 = 83.33% Code Coverage


Programmatic unit testing

Programmatic Unit Testing

  • Programmatically invoke testing and report generation


Integration with requirements gateway

Integration with Requirements Gateway

Implementation

Software Requirements

Unit Tests

Test Results


Elijah kerry certified labview architect cla

Application Builder API New in LabVIEW 2011Automate build and deployment processes


App builder log file generation

App Builder Log-File Generation

Document version, date and time of Vis included in build

Available in LabVIEW 2009


Ni labview certifications align with training

NI LabVIEW Certifications Align with Training

Developer

Senior Developer

Software Architect

/ Project Manager

Advanced

Architectures

in LabVIEW

Certified LabVIEW Associate Developer

Certified LabVIEW Developer

Certified LabVIEW Architect

LabVIEW

Core 2

LabVIEW Core 3

LabVIEW

Core 1

Managing Software Engineering in LabVIEW

LabVIEW

Connectivity

LabVIEW

Performance

Recommended course

Optional course

Object-Oriented Design & Programming in LabVIEW

Optional certification

"Certification is an absolute must for anyone serious about calling himself a LabVIEW expert... At our organization, we require that every LabVIEW developer be on a professional path to become a Certified LabVIEW Architect."

- President, JKI Software, Inc.


Elijah kerry certified labview architect cla

More Information on Architectures and ProcessDedicated to LabVIEW Development and Software Engineering Practices

  • Technical White Paper Series

  • ni.com/largeapps

  • Online Community Dedicated to Development Best Practices

  • ni.com/community/largeapps

  • Follow My Blog on Software Engineering with LabVIEW

  • ekerry.wordpress.com

  • Follow me on Twitter

  • elijah286


  • Login