Code Smells In LABVIEW–Part 1

Code smells are.. well.. whenever I notice those, I get sceptical about the quality of your(my!) work. It doesn’t mean that you don’t have a perfectly valid reason to use those .. artifacts, but I might talk to you when reviewing code Zwinkerndes Smiley

So, code Smell #1: Code > 1 page

Birgit, does LabVIEW have a zoom?

That question never fails to make me chuckle, because I associate it with many, many conversations pointing people towards better code. The answer: No, it doesn’t have a built-in zoom.

Did you notice the word built-in? Yeah, people notice that. I’ll tell you how to really zoom – if you consider my little suggestion: Don’t build software where you need to use a zoom. I’ll excuse a large monitor, possibly two normal sized ones for applications with many complicated, GUI elements that are hard to reference, but .. just don’t.

SubVIs are dead easy to create. Just look at your code, and select a piece that should be turned into a subvi:

subvi1
Then, click on edit and create a subvi.

subvi2b

(I even started an english copy of LV for this.)

Instant subvi. More space, more readability!

subvi2

Don’t forget to open your subvi, give the inputs and outputs decent names (it automatically takes the wire names, if you use that great invention by NI, btw), and replace the standard icon with something readable.

editicon

These are not perfect (For example, I don’t like their connection pattern choice), but it’s such an awesome feature for fast refactoring.

Still need that zoom?

Go buy a Microsoft Intellipoint Mouse (it has to be Intellipoint for some reason) and link the middle scroll wheel with the Windows zoom function (within LabVIEW). Now you can magically zoom in LabVIEW and impress your coworkers.
But I want you to feel bad about your messy giant pile of spaghetti.
Really, really, really bad.

(Next part in the series: Think Dataflow!)

Advertisements

2 comments

  1. […] science fiction into reality” ‹ Code Smells In LABVIEW–Part 1 Processing […]

  2. […] is part of a series on code smells in LabVIEW. #1 is about huge, messy piles of spaghetti, #2 is about not thinking dataflow, and this part is about thinking that everything is a […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: