Alex Rivera | Logout

Textual versus Graphical Programming Languages

Asked 2008-08-17T15:39:57.560
35

I am part of a high school robotics team, and there is some debate about which language to use to program our robot. We are choosing between C (or maybe C++) and LabVIEW. There are pros for each language.

C(++):

  • Widely used
  • Good preparation for the future (most programming positions require text-based programmers.)
  • We can expand upon our C codebase from last year
  • Allows us to better understand what our robot is doing.

LabVIEW

  • Easier to visualize program flow (blocks and wires, instead of lines of code)
  • Easier to teach (Supposedly...)
  • "The future of programming is graphical." (Think so?)
  • Closer to the Robolab background that some new members may have.
  • Don't need to intimately know what's going on. Simply tell the module to find the red ball, don't need to know how.

This is a very difficult decision for us, and we've been debating for a while. Based on those pros for each language, and on the experience you've got, what do you think the better option is? Keep in mind that we aren't necessarily going for pure efficiency. We also hope to prepare our programmers for a future in programming.

Also:

  • Do you think that graphical languages such as LabVEIW are the future of programming?
  • Is a graphical language easier to learn than a textual language? I think that they should be about equally challenging to learn.
  • Seeing as we are partailly rooted in helping people learn, how much should we rely on prewritten modules, and how much should we try to write on our own? ("Good programmers write good code, great programmers copy great code." But isn't it worth being a good programmer, first?)

Thanks for the advice!


Edit: I'd like to emphasize this question more: The team captain thinks that LabVIEW is better for

Edit
Report

5 Answers

9

I think the choice of LabVIEW or not comes down to whether you want to learn to program in a commonly used language as a marketable skill, or just want to get stuff done. LabVIEW enables you to Get Stuff Done very quickly and productively. As others have observed, it doesn't magically free you from having to understand what you're doing, and it's quite possible to create an unholy mess if you don't - although anecdotally, the worst examples of bad coding style in LabVIEW are generally perpetrated by people who are experienced in a text language and refuse to adapt to how LabVIEW works because they 'already know how to program, dammit!'

That's not to imply that LabVIEW programming isn't a marketable skill, of course; just that it's not as mass-market as C++.

LabVIEW makes it extremely easy to manage different things going on in parallel, which you may well have in a robot control situation. Race conditions in code that should be sequential shouldn't be a problem either (i.e. if they are, you're doing it wrong): there are simple techniques for making sure that stuff happens in the right order where necessary - chaining subVI's using the error wire or other data, using notifiers or queues, building a state machine structure, even using LabVIEW's sequence structure if necessary. Again, this is simply a case of taking the time to understand the tools available in LabVIEW and how they work. I don't think the gripe about having to make subVI icons is very well directed; you can very quickly create one containing a few words of text, maybe with a background colour, and that will be fine for most purposes.

'Are graphical languages the way of the future' is a red herring based on a false dichotomy. Some things are well suited to graphical languages (parallel code, for instance); other things suit text languages much better. I don't expect LabVIEW and graphical programming to either go away, or take over the world.

Incidentally, I would be ve

answered 2008-10-02T10:56:27.357
6

This doesn't answer you question directly, but you may want to consider a third option of mixing in an interpreted language. Lua, for example, is already used in the robotics field. It's fast, light-weight and can be configured to run with fixed-point numbers instead of floating-point since most microcontrollers don't have an FPU. Forth is another alternative with similar usage.

It should be pretty easy to write a thin interface layer in C and then let the students loose with interpreted scripts. You could even set it up to allow code to be loaded dynamically without recompiling and flashing a chip. This should reduce the iteration cycle and allow students to learn better by seeing results more quickly.

I'm biased against using visual tools like LabVIEW. I always seem to hit something that doesn't or won't work quite like I want it to do. So, I prefer the absolute control you get with textual code.

answered 2008-08-17T15:55:24.627
4

I think that graphical languages wil always be limited in expressivity compared to textual ones. Compare trying to communicate in visual symbols (e.g., REBUS or sign language) to communicating using words.

For simple tasks, using a graphical language is usually easier but for more intricate logic, I find that graphical languages get in the way.

Another debate implied in this argument, though, is declarative programming vs. imperative. Declarative is usually better for anything where you really don't need the fine-grained control over how something is done. You can use C++ in a declarative way but you would need more work up front to make it so, whereas LABView is designed as a declarative language.

A picture is worth a thousand words but if a picture represents a thousand words that you don't need and you can't change that, then in that case a picture is worthless. Whereas, you can create thousands of pictures using words, specifying every detail and even leading the viewer's focus explicitly.

answered 2008-08-17T21:34:02.650
2

Oh my God, the answer is so simple. Use LabView.

I have programmed embedded systems for 10 years, and I can say that without at least a couple months of infrastructure (very careful infrastructure!), you will not be as productive as you are on day 1 with LabView.

If you are designing a robot to be sold and used for the military, go ahead and start with C - it's a good call.

Otherwise, use the system that allows you to try out the most variety in the shortest amount of time. That's LabView.

answered 2008-08-22T00:47:38.400
1

I would suggest you use LabVIEW as you can get down to making the robot what you want to do faster and easier. LabVIEW has been designed with this mind. OfCourse C(++) are great languages, but LabVIEW does what it is supposed to do better than anything else. People can write really good software in LabVIEW as it provides ample scope and support for that.

answered 2008-09-16T19:16:18.603

Your Answer