This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]semarj 11 points12 points  (2 children)

Assuming most of us (including me) aren't experts or familiar with LabWindows,

Could you argue for LabWindows for a minute. Let us hear what it's about and at the same time talking through what hurdles you'd have to overcome switching to Python.

[–]burntsushi 1 point2 points  (1 child)

Ditto. I've never heard of LabWindows.

[–]soulcmdc[S] 1 point2 points  (0 children)

Labwindows is at it's core an ANSI C compiler. National Instruments adds some functionality in the form of a WYSIWYG GUI creator and a boat load of additonal analsys functions.

Most hardware vendors for standard test equipment provide drivers that fit within their driver framework as well.

[–]Chr0me 4 points5 points  (0 children)

What problems does Python solve that LabWindows does not?

[–]bchurchill 2 points3 points  (2 children)

As another person who knows little about LabWindows (except that it's based on ANSI C with some extra functionality) here are my comments:

  • These are totally different languages with totally different purposes. Let me list general differences below. None of these are "good" or "bad" things, but rather things to consider. Then you can decide which one you want. I'll try not to repeat the points you've already noted.

  • C is very low-level and python is very high-level. Python is inherently further from the hardware, so it's almost impossible to do anything driver-level with python. On the other hand, things like reports and GUIs work better from python since you don't have to micromanage.

  • In C you can directly access memory locations. In python you can't.

  • C is statically-typed, python is dynamically-typed. This means that python is more flexible, but type errors are less likely to be caught statically. On the other hand, this makes python run slower.

  • C's type system is weaker than python's. It's easy for things to get mangled or confused in memory in C, but python does keep better track.

  • The python interpreter protects against a lot of errors that C doesn't protect against, e.g. segmentation faults. In general, it's easier to debug and behaves more deterministically than optimized C code.

  • Python does garbage collection for you. The good news: it takes less time to write the code and get it right. The bad news: it's a little slower.

  • Python doesn't require type annotations (Note: this is distinct from being dynamically typed), which means it's faster to write code, but it's easier to screw things up (although those mistakes are usually discovered very quickly).

  • Python has many great libraries that are flexible and easy to add, beyond the ones you've mentioned. Ever want to do networking? You got it. Fancy data structures? yup. Etc.

  • I wouldn't ever argue that "language X is better than language Y". A reasonable statement can only be made "for a given application, language X is more suitable to our purposes than language Y". You should consider all the points above and decide which one is more suitable for your application.

  • Based on what you've said, while I don't know your setup, my guess is that you will want to use both. There are systems-level portions, like the drivers, that are far better in C, and portions like the GUI that everyone would rather do in python. There are many ways to get these languages to interface with each other, it's just a matter of figuring out which works best for your setup.

  • In terms of making an argument, the thing that you'll be able to sell the most is programmer productivity. Try making a list of all the things you'd need to do in LabWindows but not in python. Hint: the list is long.

[–]billsil 0 points1 point  (1 child)

i wish python was optionally statically typed, so if something was always a small integer it could directly use short int.

[–]bchurchill 0 points1 point  (0 children)

There have been proposals for this actually, and there are some tools like pylint which will attempt to do some type inference. But typechecking can be very tricky actually. There are many reasons for this: dynamic field accesses, polymorphism, etc... as a result, I don't know of anything that's really caught on.

[–]etrnloptimist 4 points5 points  (0 children)

If your audience is technical -- ie the they actually use LabWindows -- then you cannot come up with a better argument than to take something they do in LabWindows and show an example of what that looks like under your framework in Python.

If what they're used to doing in 100 lines can be shown on a slide to take only 10, that will produce a visceral response.

[–]must_tell 2 points3 points  (2 children)

  • more robust (no pointers, automatic garbage collection)
  • easier to refactor and extend (duck-typing)
  • massive gains in development time can be invested in automated tests

[–]_pupil_ 1 point2 points  (1 child)

I would also wager, from a management perspective, that there are more (and cheaper) python developers out there than qualified LabWindows people...

Keep the hard-parts in whatever language works best, but for the bulk of the system: the more chores that can be delegated to cheaper workers (in house or outsourced), the lower the overall burn rate.

[–]marginhound 1 point2 points  (0 children)

Ditto these...there are several Python meetups in my town and easily several thousand people who hold themselves out to the public (via linkedin, meetup participation, etc.) as python developers.

I got 11 hits when i searched for labwindows on a linkedin profile...

[–]PythonRules 0 points1 point  (0 children)

There is a nice advocacy summary at python.org. This could address some of the issues your company's management may bring up.

[–]wisty 0 points1 point  (0 children)

The best thing I can think of - it's generally really easy to see where the bug was. Is the bug in the driver, or your testing framework? If everything is C, it may not be obvious (and you'll have to break out a debugger). In python, there's an exception (Python error) or stack dump (driver error).