Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

Crashing GOOP into Actors

Kane Johnson

Moore Good Ideas, Inc.

  • B.S. Mechanical Engineering
  • CLD as of May '16

A journey from task based to object-oriented programming

Actor Framework Palette

Up and Running

Examples

Finally Getting Somewhere

Thinking object-oriented and effectively using Actors

Productive Actors

Encapsulation

  • Actors are Objects!
  • Pre-Launch Init, Handle Error, Stop Core, Last Ack., and some
  • Helper Loops
  • Well Defined, Easily Testable
  • Self and Caller En-queue
  • Classes protect their data
  • VI's with an access scope
  • Prevent undesired changes to data

Inheritance

Dynamic Dispatch

  • Hardware Abstraction Layer
  • Code Reuse
  • Run-Time Polymorphism
  • Specify obligations for descendents

Uphill Battle

Actually coding in OOP and using Actors

Shift Your Perspective

LESS

From Functions to Data

Thinking:

  • What functions to I need to make these things happen
  • OK do this first, then make this happen, after do this in a loop til this....
  • What do I need to do to accomplish my task

MORE

Thinking:

  • How can I structure my problem into a collection of objects with defined responsibilities
  • Which parts of my problem can I abstract in order to guard against requirements changes and hardware obsolescence

Embrace OOP Principles

Abstraction

Inheritance

Polymorphism

Encapsulation

TRY

IMPROVE

ITERATE

FAIL

LEARN

Wide Open

QMH DMM

Demo

Push the limits

http://forums.ni.com/t5/Mass-Compilers/Example-Code-for-Learning-LVOOP-the-Actor-Framework-v2013/gpm-p/3520715

First Steps

Taking the plunge into OOP

Biggest Take Away

  • The hardest step will be the thought process shift
  • There is no one architecture to use for every use case
  • Let the fundamentals of OOP and Actors help guide your program design for better reuse, maintainability, scaling and extensibility
  • Start NOW!

Resources, resources and more resources

http://forums.ni.com/t5/Actor-Framework-Documents/READ-THIS-FIRST-to-get-started-with-Actor-Framework/ta-p/3493762

Other Links:

http://www.mooregoodideas.com/category/technical-articles/actor-framework/

bit.ly/lvoop

  • http://ni.com/actorframework
  • http://www.ni.com/webcast/1718/en/
  • http://blog.eyesonvis.com/2012/08/21/intro-to-lvoop-part-1/
  • https://www.ieee.li/pdf/viewgraphs/ni_object_oriented_programming.pdf
  • http://www.labvolution.com/labview-getting-started-with-lvoop/
  • http://blog.jki.net/news/webinar-introduction-to-the-actor-model-getting-started-with-the-actor-framework-for-labview/
  • https://lavag.org/files/file/132-lvoop-assistant/

http://www.bloomy.com/support/blog/roberts

http://www.bloomy.com/support/blog/ethan-stern

Base Camp

http://www.notatamelion.com/white-papers/

Programming Styles and Managing Complexity

Task-Based Programming

What do I need to "do" to solve this problem?

How do we want to organize the data and procedures our problem?

Procedural and Function driven.

Pros:

  • Strait forward block diagrams
  • Inherently parallel
  • Concepts are simple to understand

Cons:

  • Poor style can quickly result in high coupling
  • Narrow Polymorphism

Next do this

Do this first

Finish here

Then do that

Making something happen

Initialize

Wrap up and exit gracefully

Loop here for a while

Until This Happens

Actor Framework

Object-Oriented Programming

What do I have to work with to solve this problem?

An object-oriented queued message handler and more!

General Goals while writing code:

  • Scalable
  • Extensible
  • Maintainable
  • NI vetted software library
  • Ships with LabVIEW (since LV2012)
  • Based on The Actor Model
  • a computational model that contains state info that can send, receive and handle messages.

Object

Class

Encapsulation

Grouping into a single object both data and the operands that affect that data.

Inheritance

Classes can have relationships to each other

Methods

Data

Functions that act on the Data

Cluster of data that is private to the Class

"an actor is appropriate any time I need an asynchronous operation and need to communicate with that operation while it's working"

-AristosQueue

Dynamic Dispatch

Run-time polymorphism

http://zone.ni.com/reference/en-XX/help/371361K-01/lvconcepts/creating_classes/

"The object-oriented approach attempts to manage the complexity inherent in real-world problems by abstracting out knowledge, and encapsulating it within objects."

- Wirfs-Brock, R. (1990) Designing Object-Oriented Software

QMH:

http://www.mooregoodideas.com/actor-framework-basics-part-2-the-actor/

Learn more about creating dynamic, engaging presentations with Prezi