Go to Post Every mentor we lose is potentially dozens of students lost... - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-09-2008, 11:25
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Why to use LV/C++/C?

There are so many ways to do the comparison. Years ago I read a book on comparing languages, and I thought their system was a pretty good one.

My disclaimer -- I work for NI, on LV. That means I'm a C/C++ programmer, and I also program in LV. My opinion is that they both have their strengths, and that is as it should be. In Atlanta, the question came up, "What is the most important language for the kids to learn?" There are many answers this, but my favorite answer is that the most important computer language for you to learn is your second one.

Learning a language gives you a logic tool. You begin to look at problems from the perspective of that tool. It is the "If you are holding a hammer, everything looks like a nail" psychology. Learning a second language, especially one that is considerably different, results in having a second perspective, and learning the tradeoffs and interplay. Hopefully the second language also opens the eyes to the possibility of other language features, perhaps ones that haven't even been invented yet. To keep with my analogy, learning about other fasteners such as screws, bolts, clips, adhesives, etc. really gets started once you change your point of view and realize that the hammer and nail, while they are amazing, aren't the only tools in the modern toolbox.

The book on comparing programming languages was "Comparative Programming Languages" by Wilson and Clark. No, it doesn't cover LV, but it does break down the elements that they think are most useful to measure when looking at languages for a comparison. It is also useful to see the different ideas that languages implement, and to watch that change over time.

Inspired by their categorization, I normally condense this to, Expressive Power, Simplicity & Orthogonality, Implementation, Error Detection & Correction, Correctness and Standards.

If I were to go into each of these for both LV and C, it would be a mega-post, and besides, I think it is better for people to do it on their own and come to their own conclusions.

As an example, C++ scores better on expressive power than C does. Why? They both have the ability for the user to declare new functions, new variables, and even new types. But C++ goes further to allow for operators like + and - to be expanded for new types, and allows for the -> to be used to dispatch to class member functions. C++ also has additional keywords. This power comes at a price, however, as the sorts of errors you can receive from the compiler go way up, and the overall simplicity goes down.

Finally, while most new users initially focus on the text versus graphics difference, this is pretty superficial. There could be a graphics C. Arguably you've already seen that. There could be a textual LV, but defining parallel graphs in text is fundamentally hard and we have instead headed down the graphics road. A more fundamental difference is that C/C++ are procedural languages or imperative languages whereas LV is mostly a functional language. These terms may not mean much, but they are the more important ones to look up and think about.

I don't have a great analogy, but that won't stop me from trying one anyway. An imperative language to me is like driving a vehicle with a manual transmission. There are discrete gears, combined in various ratios to direct the engine rotation to the wheels. You control this with a clutch, a shifter, possibly more if in a semi or farm equipment where I can control other differentials. Fundamentally I'm exposed to the implementation and am expected to manipulate the system at that level. Not all settings make sense, and grinding of gears, getting stuck in neutral, and stalling the engine are all common occurrences, especially until you learn the system quite well. But once you understand the system, it is quite powerful and adaptable.

A functional language in this analogy is more like an automatic transmission system. Fundamentally the big difference is that the driver specifies what the outcome should be, but not the intermediate details. It may be as simple as F-N-R and a pedal. You still control the velocity of the vehicle, but you have traded control for simplicity. When you inspect the automatic transmission system you may find that it is really a manual with an automated shifter, or you may find a CVT or hydrostatic where it isn't even easy to compare them any longer. A CVT isn't limited to a small number of gear combinations, so is it better than a limited manual transmission? Or is it inferior because of the limits on the amount of power it can transfer?

Different approaches to the same problem. Isn't it better to focus on understanding both than to be dogmatic about it?

Greg McKaskle
  #2   Spotlight this post!  
Unread 07-09-2008, 17:52
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Thumbs up Re: Why to use LV/C++/C?

Quote:
Originally Posted by Greg McKaskle View Post
"What is the most important language for the kids to learn?" There are many answers this, but my favorite answer is that the most important computer language for you to learn is your second one.
I wholeheartedly agree with you on this. My first language was Visual Basic.NET, and then through FIRST robotics I learned C, then taught myself C++. The first language really taught me how to "think like a programmer," but the second language really broadens your horizons.

Quote:
Originally Posted by Greg McKaskle View Post
As an example, C++ scores better on expressive power than C does. Why? They both have the ability for the user to declare new functions, new variables, and even new types. But C++ goes further to allow for operators like + and - to be expanded for new types, and allows for the -> to be used to dispatch to class member functions. C++ also has additional keywords. This power comes at a price, however, as the sorts of errors you can receive from the compiler go way up, and the overall simplicity goes down.
Agreed, but once you learn how to wield that power I have found that C++ (in my opinion) can be used to make programming much easier to understand. Object-Oriented Programming in C++ such as allowing functions to be members of objects make code much less abstract and easier to follow since things are gouped together. Yes, learning OOP can be very challenging because it forces you to think completely differently, but once you become well-versed in it I have found that it makes life easier. Which brings me to...

Quote:
Originally Posted by Greg McKaskle View Post
A more fundamental difference is that C/C++ are procedural languages or imperative languages whereas LV is mostly a functional language. These terms may not mean much, but they are the more important ones to look up and think about.
I'm confused by what you're saying by this. While C is procedural or imperative, C++ is Object-Oriented. Of course you can write procedurally in C++ just like you would in C, but by taking advantage of the object-oriented approach offered in C++ you can make your programs much less procedural, like I mentioned above.

Quote:
Originally Posted by Greg McKaskle View Post
I don't have a great analogy, but that won't stop me from trying one anyway. An imperative language to me is like driving a vehicle with a manual transmission. There are discrete gears, combined in various ratios to direct the engine rotation to the wheels. You control this with a clutch, a shifter, possibly more if in a semi or farm equipment where I can control other differentials. Fundamentally I'm exposed to the implementation and am expected to manipulate the system at that level. Not all settings make sense, and grinding of gears, getting stuck in neutral, and stalling the engine are all common occurrences, especially until you learn the system quite well. But once you understand the system, it is quite powerful and adaptable.

A functional language in this analogy is more like an automatic transmission system. Fundamentally the big difference is that the driver specifies what the outcome should be, but not the intermediate details. It may be as simple as F-N-R and a pedal. You still control the velocity of the vehicle, but you have traded control for simplicity. When you inspect the automatic transmission system you may find that it is really a manual with an automated shifter, or you may find a CVT or hydrostatic where it isn't even easy to compare them any longer. A CVT isn't limited to a small number of gear combinations, so is it better than a limited manual transmission? Or is it inferior because of the limits on the amount of power it can transfer?

Different approaches to the same problem. Isn't it better to focus on understanding both than to be dogmatic about it?
That actually turned out to be a beautiful example. The reasons I love C++ are the ones you mentioned above. At first, things don't make sense, don't work, and seem to vex you at every turn. But once you get the hang of it, you realize that you have an incredibly powerful and flexible tool at your disposal. The downside is that programs can take longer to develop. I personally don't mind this, however, because I enjoy working "under the hood" and being more in control (perhaps it's just because I'm obsessive-compulsive ). I would also like to take the chance to look at LV though to see how it works and what advantages it has, even though our team will be coding in C++ this year.
__________________

Last edited by slavik262 : 07-09-2008 at 20:42.
  #3   Spotlight this post!  
Unread 07-09-2008, 18:45
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Why to use LV/C++/C?

(C/C++ is procedural, LV is functional)
Quote:
Originally Posted by slavik262 View Post
I'm confused by what you're saying by this. While C is procedural or imperative, C++ is Object-Oriented.
You should probably look up what "functional programming" means (try Wikipedia). Being Object-Oriented doesn't appreciably change C++'s imperative nature. What you've written seems similar to "While an orange is a fruit, a navel orange is seedless."
  #4   Spotlight this post!  
Unread 07-09-2008, 20:41
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Alan Anderson View Post
(C/C++ is procedural, LV is functional)


You should probably look up what "functional programming" means (try Wikipedia). Being Object-Oriented doesn't appreciably change C++'s imperative nature. What you've written seems similar to "While an orange is a fruit, a navel orange is seedless."
Ah. Thank you for clearing that up.
__________________
  #5   Spotlight this post!  
Unread 07-09-2008, 19:59
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,974
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Greg McKaskle View Post
There could be a graphics C.
There is, we call it "Easy C".
__________________

I am N2IRZ - What's your callsign?
  #6   Spotlight this post!  
Unread 07-09-2008, 20:44
lasereyes's Avatar
lasereyes lasereyes is offline
College Student Mentor
AKA: Farzin Fatollahi-Fard
FRC #2551 (Penguin Empire)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Novato, CA
Posts: 114
lasereyes is an unknown quantity at this point
Send a message via AIM to lasereyes
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Don Rotolo View Post
There is, we call it "Easy C".
Will there be an EasyC option next year?
__________________
FRC #2551 (FTC #646): Penguin Empire
2008 Rookie Team
2008 UC Davis Sacramento Regional Finalists (thanks to 1388, 1072, and 2390)
2008 UC Davis Sacramento Regional Highest Rookie Seed (#2!)

  #7   Spotlight this post!  
Unread 08-09-2008, 13:41
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,355
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Why to use LV/C++/C?

Our team has lost all the programers to graduation. The returning group wants no part of programming. The are several 9th graders who have experience with the lego platform. If they join the team it will be interesting to see how thier use of NXT-G aids them in the programming of the FRC in lab view.
  #8   Spotlight this post!  
Unread 09-09-2008, 07:28
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,562
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: Why to use LV/C++/C?

I may be sounding like one of the "older" mentors on this board (perhaps I am? lol, no), but my first programming language I learned was Fortran 90/95. My second was ANSI C. Now when I first started work, I was fairly proficient in either language (really, both languages are good because knowing them, mostly Fortran, is a lost art). However, most of our programs are programmed in LabVIEW. A fundamental difference between these languages is that Fortran and C are "top-down" programming, whereas LabVIEW is a "data-flow" programming language. I do know one thing, LabVIEW does things MUCH easier and faster than C or Fortran (programming wise). For example, you have absolutely no pointers, no worry of memory allocation or anything. It is much easier to use, but it can be quite difficult making the transition for your brain to think in data-flow vs. top-down.
  #9   Spotlight this post!  
Unread 09-09-2008, 11:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Michael Hill View Post
[With LabVIEW]...you have absolutely no pointers, no worry of memory allocation or anything.
That contradicts much of what I've heard about both the specific FRC tools we are told to expect (e.g. DYNAMICALLY ALLOCATED!) and the general style of LabView programming I learned a couple of years ago (e.g. "open" a resource and pass the resulting pointer along to everything else that uses it, remembering to "close" it when finished).

I look forward with a mix of anticipation and dread to actually having this stuff in front of me to work with. My optimistic expectation is that I'll quickly realize what simple concept is keeping me from completely understanding what I'm reading, and that I'll finally "get it". (My nagging fear is that I'm a programming dinosaur, stuck in a procedural tar pit and doomed to extinction as the dataflow mammals take over.)
  #10   Spotlight this post!  
Unread 09-09-2008, 12:33
JaneYoung JaneYoung is offline
Onward through the fog.
no team
Team Role: Alumni
 
Join Date: Mar 2006
Rookie Year: 2002
Location: Austin, TX USA
Posts: 5,996
JaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond reputeJaneYoung has a reputation beyond repute
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Alan Anderson View Post
(My nagging fear is that I'm a programming dinosaur, stuck in a procedural tar pit and doomed to extinction as the dataflow mammals take over.)
If I may, Alan, you will never be a dinosaur of any type, stuck in a tar pit of any type, and doomed to extinction - because you are sticking with it and will see it through - evolving: curious, asking questions, seeking to understand, comprehend, gain skill sets and how to apply them. I think that is a big part of advancing technology and science in any area.

Your written thoughts created an incredible visual.
__________________
Excellence is contagious. ~ Andy Baker, President, AndyMark, Inc. and Woodie Flowers Award 2003

Character cannot be developed in ease and quiet. Only through experience of trial and suffering can the soul be strengthened, ambition inspired, and success achieved.
~ Helen Keller
(1880-1968)

Last edited by JaneYoung : 09-09-2008 at 12:37.
  #11   Spotlight this post!  
Unread 09-09-2008, 18:35
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,562
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Alan Anderson View Post
That contradicts much of what I've heard about both the specific FRC tools we are told to expect (e.g. DYNAMICALLY ALLOCATED!) and the general style of LabView programming I learned a couple of years ago (e.g. "open" a resource and pass the resulting pointer along to everything else that uses it, remembering to "close" it when finished).

I look forward with a mix of anticipation and dread to actually having this stuff in front of me to work with. My optimistic expectation is that I'll quickly realize what simple concept is keeping me from completely understanding what I'm reading, and that I'll finally "get it". (My nagging fear is that I'm a programming dinosaur, stuck in a procedural tar pit and doomed to extinction as the dataflow mammals take over.)
A lot of things ARE dynamically allocated, most noticeably, arrays. HOWEVER, the biggest difference is that all the dynamic allocation takes place behind the scenes in LabVIEW. The end-user of LabVIEW, i.e. the programmer, i.e. you, never has to worry about using malloc, calloc or anything like that. The only type of thing that I can think that you should have to "close" would be a TCP connection in LabVIEW. You don't have to "close" any other references or anything like that, I least I never have had to in the years I've been programming.
  #12   Spotlight this post!  
Unread 09-09-2008, 17:32
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Michael Hill View Post
For example, you have absolutely no pointers, no worry of memory allocation or anything. It is much easier to use, but it can be quite difficult making the transition for your brain to think in data-flow vs. top-down.
Aren't there certain advantages to manually managing memory though? Perhaps I'm also stuck in the procedural tar pit (although at age 16 I would hope I'm not a dinosaur ). I realize that LV may provide faster development, but doesn't C++ provide you with slightly finer control?
__________________
  #13   Spotlight this post!  
Unread 09-09-2008, 19:05
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Michael Hill View Post
For example, you have absolutely no pointers, no worry of memory allocation or anything.
I am not a software engineer. I am not a LabVIEW expert (barely proficient is stretching it). However, I have (at some point) used more than 10 programming languages, and I have spent enough time with LabVIEW to become frustrated and (later) elated.

I will defer to Greg as to whether or not Michael's assertion is true 100% of the time, forever and ever. I simply don't know.

What I do know is that typical LabVIEW code reminds me of LISP/Scheme in how it handles basic data types. The Liopleurodons among us may benefit of approaching it from that angle - that was the mental leap that made everything "click" for me. Now I think of LabVIEW as Graphical PythonLISP.

To over generalize:
Quote:
Python -adjective
1) readable and approachable
2) utilitarian / lacking blind devotion to a particular ideology.
3) pretty
I will admit that "pre-click", LabVIEW was frustrating. I kept trying to force imperative programming methods which just weren't appropriate. Now I am rather excited to use it for `09 (especially since I haven't mentored a programming team in FIRST in 2 years).
  #14   Spotlight this post!  
Unread 10-09-2008, 00:50
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Why to use LV/C++/C?

Several things to comment on.

First -- Eric gets it! Yay.
LV is different, not always better or always worse, but because of dataflow, almost always different. It really isn't magic either. Like most industry languages, LV is a mixed bag. A functional core with grafts to allow easier looping and structured programming, more grafts to allow for I/O APIs that use references, and of course the implementation is still missing many of the things that we want it to have.

Second -- Michael is correct.
LV isn't an ideal realtime language, because it does do allocations implicitly. Some languages alloc almost everything in sight, others make it very explicit. LV has many scalar types, or flat types as we refer to them that are statically allocated, but the string and array in particular, are dynamic. There are in fact bounded and fixed variations of them, which will give you better determinism, but they are not used that often. More on LV memory model later in the post.

Third -- I agree with slavik262.
There are certainly situations that benefit from tightly controlling memory allocation as well as other resources. But not only is there a tradeoff in the number of details you need to take on for explicit control, but the power of C's syntax in particular is way into the "user beware" camp. Is x=rand(); *x=5; ever what you meant? The time spent finding an outright nasty memory corruption is quite the tradeoff to make.

Finally -- Alan, you don't sound like a dinosaur, but perhaps a skeptic. I find skepticism to be a critical element in making new things work.

Getting back to the LV memory approach.
I'm not sure this statement will help, but the primary LV types have by-value semantics, even if their implementation is by reference. What this means is that each wire acts as an unnamed temporary storage element. It has one writer and as many readers as you like. So if a wire simply runs between the output of + and the input of =, it is really just binding those together functionally. If the wire forks and delivers the data to multiple inputs, there are no side effects to worry about. The data value is delivered to each. It is impossible for another location on the diagram to modify the wire, no matter what order they are scheduled in, how long it takes to execute, etc. This doesn't seem like a big deal at first, but in a parallel language, it is a cornerstone. This is why variables, global or local ones weren't even in the language for quite some time, and why they need to be used very carefully. Multiple writers allow for race conditions, and the parallel dataflow scheduling makes the race conditions a common occurrence.

If the actual implementation used a by-value approach, LV would be quite a bit slower and bigger than it is. Instead, the compiler analyzes the graph and allows for temporaries to be folded together. It also takes statements that are more parallel than needed by the computer architecture and serializes them into a statically scheduled snippet to help further with memory reuse. Finally, arrays and string wire forks mean the same as a Boolean, but their implementation is different. They are really alloc'ed buffers, and the buffers are commonly shallow copied to improve efficiency, but not at the cost of simplicity to the user.

The exceptions to the by-value semantics are the reference types. Primary ones are I/O such as TCP, files, and UI elements. Copying an entire file around with by-value semantics just wasn't feasible in '83 when they started working on LV, so some APIs expose a reference type which should be closed when completed, similar to most POSIX libs. But trying to improve it slightly, LV does shadow these refs and will close them at program completion or termination, even if you don't.

LV certainly isn't magic, and I'll be happy to explain how things work if you ask the questions.

Greg McKaskle
  #15   Spotlight this post!  
Unread 10-09-2008, 01:13
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Why to use LV/C++/C?

Quote:
Originally Posted by Greg McKaskle View Post
First -- Eric gets it! Yay.
LabVIEW is like the big connectors on the PD: A total pain until you figure out the right way to use them, at which point it is like a godsend. Remember, Slide Not Stab!

Last edited by EricVanWyk : 10-09-2008 at 01:58.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Not Use ISM band? Mr-Shutter Control System 8 06-06-2007 21:03
Why you should use Gmail Nathan Chit-Chat 5 22-02-2007 00:20
Why use the RC to control Pan/Tilt Joe Hershberger Programming 15 30-01-2007 23:41
Why would you use FIRSTwiki? Max Lobovsky FIRSTwiki 4 18-07-2004 23:59
Why can't you use 255 in PWM? Andrew Technical Discussion 4 29-05-2003 14:50


All times are GMT -5. The time now is 12:15.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi