View Single Post
  #5   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.