Typically the first program you write when you are learning a programming language is, "Hello World!". Due to the popularity of my prior post on optimizing the traveling salesman problem with genetic algorithms I decided to write a general parallelized Genetic Algorithm Framework for LabVIEW, naturally the first thing I taught it to do was to say, "Hello World!".
The Dependency Inversion Principle (DIP) is a principle of object-oriented design that will change the way you think about writing software. It is one of the 5 SOLID principles Robert Martin discusses in his book, I highly recommend checking this book out if you have never read it. I gave a presentation on the DIP with Stephen Loftus-Mercer at NI Week 2015, and just gave a slightly different presentation on the DIP at the Software Craftsmanship Workshop at NI Days Boston 2015. Below is a recording of the Software Craftsmanship Workshop presentation, along with my slides.
Depend upon abstract entities, not concrete entities
As writers of software we strive to craft code with high cohesion and loose coupling. This can be tough to do with the Actor Framework as the default method of sending messages between actors effectively couples them together. Depending on your application this coupling may not matter, but I will show you one way to manage it if it does.
The above image illustrates a small section of the flow of control for an application used to calculate properties of a black hole. There is a high level module used to calculate the tidal force that objects experience while near a black hole's event horizon. This tidal force calculation requires the black hole's mass as an input, which is calculated by a lower level module. The high level tidal force module needs the black hole's mass in order to perform its calculation, and it depends on the low level mass module to supply it.