You are previewing A Software Engineering Approach to LabVIEW™.
O'Reilly logo
A Software Engineering Approach to LabVIEW™

Book Description

Create more robust, more flexible LabVIEW applications—through software design principles!

Writing LabVIEW software to perform a complex task is never easy—especially when those last-minute feature requests cause a complexity explosion in your system, forcing you to rework much of your code! Jon Conway and Steve Watts offer a better solution: LCOD-LabVIEW Component Oriented Design—which, for the first time, applies the theories and principles of software design to LabVIEW programming. The material is presented in a lighthearted, engaging manner that makes learning enjoyable, even if you're not a computer scientist.

  • LCOD software engineering techniques make your software more robust and better able to handle complexity—by making it simpler! Even large, industrial-grade applications become manageable.

  • Design to embrace flexibility first, making changes and bug fixes much less painful

  • Pragmatic discussion of the authors' tried and tested techniques, written by—and for—working programmers

  • Covers design principles; LCOD overview, implementation, and complementary techniques; engineering essentials; style issues; and more

  • Complete with practical advice on requirements gathering, prototyping, user interface design, and rich with examples

  • Work through an example LCOD project (all code included on companion Web site) to tie the lessons together

This book is intended for test engineers, system integrators, electronics engineers, software engineers, and other intermediate to advanced LabVIEW programmers. None of the methods discussed are complex, so users can benefit as soon as they are proficient with the syntax of LabVIEW.Go to the companion Web site located at http://author.phptr.com/watts/ for full source code and book updates.

Table of Contents

  1. Copyright
  2. Virtual Instrumentation Series
  3. Preface
    1. The Test Engineer's Perspective
    2. Acknowledgments
  4. About Prentice Hall Professional Technical Reference
  5. 1. Introduction
    1. 1.1. LabVIEW Sucks
    2. 1.2. Don't Buy This Book
    3. 1.3. The Soap Box
    4. 1.4. What This Book Is
  6. 2. LabVIEW Rocks
    1. 2.1. Why Does LabVIEW Rock?
    2. 2.2. What Advantages Does This Bring to the Developer?
    3. 2.3. How Can Good Design Leverage These Advantages?
  7. 3. Software Design Principles
    1. 3.1. Why is Software Complex?
    2. 3.2. Coupling and Cohesion
    3. 3.3. Information Hiding and Encapsulation
    4. 3.4. Examples of Coupling, Cohesion, and Information Hiding
      1. 3.4.1. Bad (Tight) Coupling
      2. 3.4.2. Good (Loose) Coupling
      3. 3.4.3. Bad (Weak) Cohesion
      4. 3.4.4. Good (Strong) Cohesion
      5. 3.4.5. Bad Information Hiding
      6. 3.4.6. Good Information Hiding
    5. 3.5. Abstraction
  8. 4. LabVIEW Component Oriented Design (LCOD)
    1. 4.1. Components
      1. 4.1.1. So What Is a Component?
    2. 4.2. Design
      1. 4.2.1. Object Oriented Design (OOD)
        1. Classic OO Lesson
      2. 4.2.2. Top-Down Design
      3. 4.2.3. Bottom-Up Design
      4. 4.2.4. Design Patterns
        1. Reuse of Design
        2. Reuse of Components
        3. Questions to Ask
        4. Cycle of Reuse
      5. 4.2.5. Pattern Examples
        1. UI Controller>>Message Queue Pattern
        2. Control>> Drive>>Read Pattern
  9. 5. LCOD Implementation
    1. 5.1. Component Mechanisms
    2. 5.2. Message Sending
      1. 5.2.1. All About Enumerated Types
      2. 5.2.2. 101 Things to Do with an Enumerated Type
        1. Format into String
        2. Scan from String
        3. Typecast
        4. Casting and Uncasting
        5. Case Structure
        6. Firing a Sequence of Events
        7. State Machine
      3. 5.2.3. Strict Type Definitions
    3. 5.3. Persistent Local Storage
    4. 5.4. The Basic Structure of a Component
  10. 6. LCOD Complementary Techniques
    1. 6.1. State Machines
      1. 6.1.1. State Machine Example—Washing Machine
    2. 6.2. Graphical User Interface (GUI) Design and Prototyping (UI Controller>>Message Queue Pattern)
      1. 6.2.1. Stack Queue Component
      2. 6.2.2. User Interface Control Wrapper VI
      3. 6.2.3. LCOD User Interface Example Diagram
    3. 6.3. Abstraction in the Code, Detail Outside the Code
      1. 6.3.1. Section Key Files
        1. Invalid
        2. Get
        3. Set
        4. Save
        5. Load
        6. Save All
        7. Load All
        8. Reset
    4. 6.4. Error Handling
    5. 6.5. Pre- and Postconditions: Check What Comes In and What Goes Out
      1. 6.5.1. Preconditions
      2. 6.5.2. Postconditions
      3. 6.5.3. Conclusion
    6. 6.6. Reuse
      1. 6.6.1. Opportunistic Reuse
      2. 6.6.2. Planned Reuse
      3. 6.6.3. Merge VIs
      4. 6.6.4. VI Templates
  11. 7. Software Engineering Essentials
    1. Fairy Tales
    2. Horror Stories
    3. 7.1. The Usual Suspects
    4. 7.2. Requirements Document
      1. Who is the Real Customer?
      2. What Constraints Are There?
      3. How Do You Manage Expectations?
      4. What is the Big Picture?
    5. 7.3. Quote/Project Validation
    6. 7.4. Target Specification
    7. 7.5. Test Plan
    8. 7.6. Software Architecture Document
    9. 7.7. Software Construction—Build
    10. 7.8. Test—Customer Acceptance
    11. 7.9. Pictures Tell a Thousand Words
      1. 7.9.1. Diagrams—Data Flow Diagrams (DFDs)
      2. 7.9.2. State Transition Diagrams
      3. 7.9.3. Homemade Diagrams
    12. 7.10. Checklists
    13. 7.11. Code Reviews
    14. 7.12. The Project Is Dead, Time for a Postmortem
    15. 7.13. Metrics
  12. 8. It's All About Style
    1. 8.1. Why Do We Need Standards Anyway?
    2. 8.2. Block Diagram
      1. 8.2.1. General Layout Standards
      2. 8.2.2. Wiring Standards
      3. 8.2.3. Labeling Standards
      4. 8.2.4. Self-Documenting Example
    3. 8.3. Front Panel
      1. 8.3.1. General Front Panel Standards
      2. 8.3.2. Public Front Panel Standards
      3. 8.3.3. Private Front Panel Standards
      4. 8.3.4. Icon and Connector Standards
      5. 8.3.5. Organization of Files
  13. 9. The Journey
    1. 9.1. Agreeing on the Destination (Requirements)
    2. 9.2. Planning Your Route (Design)
      1. 9.2.1. Code and Fix
      2. 9.2.2. Abstracting Components from Requirements
        1. Display Handler
        2. Test System
        3. Hardware Component
        4. Report Component
        5. Data Component
        6. Configuration Component
        7. Initialization
      3. 9.2.3. Using Patterns to Help the Design Process
        1. UI
        2. UI States
        3. UI Attributes
        4. Program Executive States
        5. Hardware Actions
        6. Hardware Attributes
      4. 9.2.4. Building the Prototype
    3. 9.3. Build
      1. 9.3.1. Code and Fix
      2. 9.3.2. LCOD
      3. 9.3.3. Hardware
        1. Hardware Actions
        2. Control Actions
        3. Drive Actions
        4. Read Actions
      4. 9.3.4. Detail Outside the Code
      5. 9.3.5. Error Handling
      6. 9.3.6. State Machines
      7. 9.3.7. Reuse
        1. Patterns
        2. VIs With Little or No Modification
      8. 9.3.8. Style
    4. 9.4. Uh-oh We've Been Given the Wrong Directions
    5. 9.5. Conclusions
  14. Glossary