Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pre-Presentation Checklist Contextual help window is in the top left All chat programs are off Update subversion folder status LabVIEW is open /largeapps.

Similar presentations


Presentation on theme: "Pre-Presentation Checklist Contextual help window is in the top left All chat programs are off Update subversion folder status LabVIEW is open /largeapps."— Presentation transcript:

1 Pre-Presentation Checklist Contextual help window is in the top left All chat programs are off Update subversion folder status LabVIEW is open /largeapps is loaded in web browser Subversion-controlled repositories are reset (and green) Presentation timer is started Mouse is connected and working Pointer is connected and working Run the UI Framework once to get plugins in memory Test web services to ensure network ports are configured properly

2 2

3 3 An Overview of Software Development Best Practices for LabVIEW Elijah Kerry – LabVIEW Product Manager Certified LabVIEW Architect (CLA)

4 4

5 5 Topics Configuration Management Requirements Tracking Architecture and Design Coding Styles and Standards Testing and Debugging Documentation ni.com/largeapps

6 6 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

7 7 The Cost of a Software Defect Development PhaseCost Ratio Requirements1 Design3-6x Implementation10x Development Testing15-40x Acceptance Testing30-70x Post Release40-1000x Based on an analysis of 63 software development projects at companies including IBM, GTE and TRW

8 8 Lawrence Livermore National Labs Developed automated maintenance process for world’s most energetic laser array at the National Ignition Facility using NI LabVIEW and PXI LabVIEW increased productivity by 3X over Java and C++ Developed complex application consisting of over 1,000 VIs Applied software engineering practices to ensure quality “The value in using the graphical dataflow language is the speed in which a team can deliver a robust solution while still using proper software engineering practices. -Glenn Larkin, LLNL “The value in using the graphical dataflow language is the speed in which a team can deliver a robust solution while still using proper software engineering practices. -Glenn Larkin, LLNL An overhead view of one of the main laser chambers

9 Avionics ApplicationsRobotics and MechatronicsLarge Physics Applications High-Volume Production Test Structural Health MonitoringMedical Devices Large System Development Powered by LabVIEW

10 10 Graphical Event-driven Multithreaded Object-oriented Compiled Multi-platform Multi-target Memory managed Language Characteristics

11 11 LabVIEW Compiles Graphical Code mov byte ptr [esi+29h],0 mov eax,dword ptr [esi+18h] mov ebp,dword ptr [esi+14h] mov dword ptr [esi+0Ch],eax cmp byte ptr [esi+2Ah],1 je 0ABFFE0F mov eax,dword ptr [esi+1Ch] mov eax,dword ptr [eax+14h] test eax,eax je 0ABFFCEF cmp byte ptr [eax+2Ah],1 jne 0ABFFCEF jmp 0ABFFE0F mov ecx,dword ptr [ebp+44h] xor eax,eax mov edx,1 lock cmpxchg dword ptr [ecx],edx test eax,eax jne 0ABFFCEF mov eax,dword ptr [esi+1Ch] lea ecx,[ebp+4Ch] mov dword ptr [eax+10h],ecx mov dword ptr [ebp+68h],eax mov dword ptr [ebp+48h],esi cmp dword ptr [eax+14h],0 jne 0ABFFD90 mov dword ptr [eax+14h],esi mov byte ptr [ebp+1Eh],1 cmp dword ptr [esi+30h],2 je 0ABFFE39 mov byte ptr [ebp+1Bh],1 mov esi,dword ptr [ebp+360h] mov esi,dword ptr [esi] mov dword ptr [ebp+37Ch],esi inc dword ptr [ebp+37Ch] inc dword ptr [ebp+37Ch] mov esi,dword ptr [ebp+48h] cmp byte ptr [esi+3Dh],1 mov eax,dword ptr [ebp+68h] je 0ABFFE09 cmp dword ptr [eax+28h],0 jne 0ABFFE1F mov dword ptr [ebp+48h],0 mov dword ptr [eax+10h],esi mov byte ptr [ebp+1Eh],0 mov ecx,dword ptr [ebp+44h] mov dword ptr [ecx],0 cmp dword ptr [eax+14h],esi jne 0ABFFE0F mov dword ptr [eax+14h],0 cmp byte ptr [esi+29h],5 jne 0ABFFE0F mov dword ptr [esi+29h],2 xor eax,eax jmp 0ABFFD13 mov dword ptr [esi+1Ch],eax mov dword ptr [eax+10h],esi mov edx,dword ptr [esi+8] mov ecx,dword ptr [esi+0Ch] mov eax,esi add esp,8 pop esi mov ebp,edx jmp ecx add ebp,3Ch mov dword ptr [esp],ebp call SubrVIExit (24D6450h) test eax,eax je 0ABFFE02 mov esi,eax jmp 0ABFFE0F mov byte ptr [ebp+1Bh],0 jmp 0ABFFD90 Compiler

12 12 Layers of Transforms Optimizes Code Block Diagram Target Machine Code DFIR LLVM Transforms DataFlow Intermediate Representation (DFIR) High-level graph-based representation Preserves execution semantics, dataflow, parallelism, and structure hierarchy Developed internally at NI Low-Level Virtual Machine (LLVM) Low-level sequential representation Knowledge of target machine characteristics 3rd party, Open Source

13 13 Requirements Gathering Application Architecture Deployment Unit Testing System Testing Integration Testing Module Architecture Review and Test Software Engineering V-Model Development Verification Prototyping Service

14 14 Size of LabVIEW Applications Source : 2010 ni.com/largeapps survey

15 15 Average Number of Developers Per Project Source : NIWeek 2008 Software Engineering Survey

16 16 Source Code Control Developer 1 Developer 2 Merger Code Revision Code Repository Locked for edit Requirements Gathering Application Architecture Development Debugging & Testing Deployment Software Configuration Management Checked OutChecked In Checked OutChecked In Checked Out Get Latest Version

17 17 Graphical Differencing Provides a checklist of changes Useful for peer reviews Available via command-line Provides a checklist of changes Useful for peer reviews Available via command-line

18 18 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

19 Popularity of SCC Options Amongst LabVIEW Programmers Source: 2010 ni.com/largeapps survey

20 20 DEMO Configuration Management

21 21 Development Trunk Feature-Team Repository Feature-Team Repository Feature-Team Repository Individual’s Local Repositories 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

22 22 Separate Compiled Code From Source File Improved Source Code Control Integration 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 2009.vi file format 2010.vi file format* Front Panel Block Diagram Connector Pane Icon Compiled Code Inplaceness Info Compiled Code Inplaceness Info Front Panel Block Diagram Connector Pane Icon A separate object file is created to store and retain this information

23 TopLevel.vi SubVI2.vi SubVI1.vi Source Code Control Scenario: Today In SCC TopLevel.vi SubVI2.vi Local Machine Edit Save Check-in SubVI1.vi

24 Source Code Control Scenario: 2010 In SCC TopLevel.vi SubVI2.vi Local Machine Edit Run/Save SubVI1.vi Check-in local.viobj cache TopLevel.viobj SubVI1.viobj SubVI2.viobj TopLevel.viobj SubVI1.viobj SubVI1.vi TopLevel.vi SubVI2.vi SubVI1.vi

25 25 The Project Library Provide name-spacing to avoid cross-links Organize sections of an application into components Modify contents without modifying the Project file Pack them into a single, non- editable file

26 26 Project Libraries (.lvlib) Xcontrols (.xctl)Classes (.lvclass)

27 27 VI lvlib Project Library Public API Private VIs VI Callers VI Public API Compiled code VI Callers VI Packed Project Library Deployed SystemDevelopment Environment Packed Project Libraries New in LabVIEW 2010 Distribute and Deploy LabVIEW Libraries as a Single File Decrease build times Deploy the VI hierarchy with a single file Simplified code deployment

28 28 VI Package Manager Build and manage packages of LabVIEW code

29 29 Structured Error Handler GXML Library Install and Manage VI Packages

30 30 DEMO Introduction to the VI Package Manager

31 31 Easily Upgrade and Downgrade Versions

32 32 Structured Error Handler GXML Library Create VI Configuration Files AMC LibraryG Library A single file that contains multiple packages. Easily share and distribute code that depends upon multiple libraries. Structured Error Handler Config

33 33 DEMO Create a Configuration File by Scanning a Project

34 34 Track Changes Manage Reuse Libraries Integrate with SCC Merge Graphical CodeManage Files and Links System Level View Software Configuration Management for LabVIEW

35 35 The Software Engineering Process Now Included with DevSuite NI Requirements Gateway Requirements Gathering Application Architecture Development Testing and Validation Deployment LabVIEW VI Analyzer LabVIEW Desktop Execution Trace LabVIEW Unit Test Framework Application Builder LabVIEW Statechart Improve quality. Reduce risk. Save time. Prove it works. Object Orientation Real Time FPGA Embedded NI TestStand Dataflow MathScript Statechart Simulation

36 36 The Software Engineering Process NI Requirements Gateway Requirements Gathering Application Architecture Development Testing and Validation Deployment LabVIEW VI Analyzer LabVIEW VI Analyzer LabVIEW Desktop Execution Trace LabVIEW Unit Test Framework Application Builder LabVIEW Statechart Improve quality. Reduce risk. Save time. Prove it works. Object Orientation Real Time FPGA Embedded NI TestStand Dataflow MathScript Statechart Simulation

37 37 PrototypeSpecifications Test Definitions System Requirements Unit Specifications Software Design Phase

38 38 Requirements Traceability Solution from NI

39 39 Requirements Gathering Application Architecture Development Debugging & Testing Deployment Requirements Coverage and Project Tracking Traceability and Documentation Generation

40 40 DEMO Requirements Tracking

41 41 Documentation Labeled objects In-line comments Distinct Icon Description and Tip HTML Print-Out Requirements Coverage

42 42 Tools for Debugging and Testing High Risk Low Risk Debugging & Testing Dynamic Code Analysis Real Time Execution Trace Static Code Analysis Functional Validation of Code Unit Test Framework Advanced Simple Application Complexity Application Criticality Desktop Execution Trace VI Analyzer Toolkit

43 43 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

44 44 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

45 45 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

46 46 VI Analyzer Code Complexity Metrics Tests for Industry Standard Metric Calculations True False Case 1 Case 2 Case 3 Edges = 5 Nodes = 3 Paths = 1 Cyclomatic complexity: 5 – 3 + 2 (1) = 4

47 47 Creating Custom Tests Select tests to run Test specific configuration settings Test PriorityNumber of failures to report

48 48 Define Configuration Options Access values in test code using Global variables

49 49 DEMO VI Analyzer for Peer Reviews

50 50 Tools for Debugging and Testing High Risk Low Risk Debugging & Testing Dynamic Code Analysis Real Time Execution Trace Static Code Analysis Functional Validation of Code Unit Test Framework Advanced Simple Application Complexity Application Criticality Desktop Execution Trace VI Analyzer Toolkit

51 51 Goals of Dynamic Code Analysis: What is consuming system memory? Am I capturing all the errors in my application? What was the last event to occur before…? What was the call-chain that led us to…? What thread is it executing in? Am I actually entering a specific event-case? What happened inside a structure? What order to these events occur in? Is a daemon process running in the background? Does the code behave different in an executable?

52 52 Trace Production Systems Remotely Run-Time Execution Information Network Deployed Real-Time Applications VIs and Debuggable Executables LabVIEW Desktop Execution Trace Toolkit LabVIEW Real-Time Execution Trace Toolkit

53 53 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

54 54 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

55 55 DEMO Dynamic Code Analysis with Desktop Execution Trace Toolkit

56 56 Remote Debugging of Executables Include block diagrams with an executable Remotely troubleshoot using LabVIEW debug tools

57 57 Tools for Debugging and Testing High Risk Low Risk Debugging & Testing Dynamic Code Analysis Real Time Execution Trace Static Code Analysis Functional Validation of Code Unit Test Framework Advanced Simple Application Complexity Application Criticality Desktop Execution Trace VI Analyzer Toolkit

58 58 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."

59 59 LabVIEW Unit Test Framework VI Under Test Input Values Output Expected Output Unit Test Framework Automated Report Generation Test vector = Input value(s) + Expected output(s)

60 60 Windows Desktop LabVIEW Unit Test Framework VI Under Test Input Values Output Expected Output Unit Test Framework Automated Report Generation Test vector = Input value(s) + Expected output(s)

61 61 Real Time LabVIEW Unit Test Framework VI Under Test Input Values Output Expected Output Unit Test Framework Automated Report Generation Test vector = Input value(s) + Expected output(s)

62 62 Mitigating Risk Through Hardware Hardware Operating System Driver API Application Software Calculation Traditional System Outputs Patient Crash Possible

63 63 Hardware Operating System Driver API Application Software Calculation Patient LabVIEW FPGA System Highest Reliability Outputs Mitigating Risk Through Hardware

64 64 DEMO Unit Testing

65 Setup / Teardown VIs Input Values Value Comparison

66 66 Code Coverage Example 6 Diagrams. 3 Diagrams Executed. 50% Code Coverage

67 67 Code Coverage Example 2 nd Test Vector (aggregates covered code from 1 st pass) Block diagram, 5 Case diagrams executed. ( 4 + 1 ) / 6 = 83.33% Code Coverage 1 ST Test Vector: Block diagram, 2 Case diagrams executed. ( 2 + 1 ) / 6 = 50% Code Coverage

68 68 Programmatic Unit Testing Programmatically invoke testing and report generation

69 69 Unit Tests Implementation Software Requirements Test Results Integration with Requirements Gateway

70 70 LabVIEW User Interface Testing

71 71 Requirements Gathering Application Architecture Development Debugging & Testing Deployment Programmatic build processes Programmatic control of source code control

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

73 73 App Builder Log-File Generation Document version, date and time of Vis included in build Available in LabVIEW 2009

74 LabVIEW Core 1 LabVIEW Core 2 LabVIEW Core 3 Certified LabVIEW Developer Advanced Architectures in LabVIEW Certified LabVIEW Architect Certified LabVIEW Associate Developer NI LabVIEW Certifications Align with Training Managing Software Engineering in LabVIEW LabVIEW Connectivity LabVIEW Performance Object-Oriented Design & Programming in LabVIEW Recommended course Optional course Optional certification DeveloperSenior Developer Software Architect / Project Manager "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.

75 Software Engineering Best-Practices


Download ppt "Pre-Presentation Checklist Contextual help window is in the top left All chat programs are off Update subversion folder status LabVIEW is open /largeapps."

Similar presentations


Ads by Google