Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Advantages of each programming language (http://www.chiefdelphi.com/forums/showthread.php?t=104237)

cierra_shawe 05-03-2012 12:19

Advantages of each programming language
 
Hi everyone!

Although it is only 3 days until our first regional, we have yet to solidify what programing language will be used. I was wondering what the advantages of each would be, and availability of teams who would be able to help at the regional. Also any other tips to help our rookie team out would also be great!

:]

Alan Anderson 05-03-2012 16:16

Re: Advantages of each programming language
 
Use whatever language you're most comfortable with. What did you program with while you were developing and testing your robot?

basicxman 05-03-2012 16:54

Re: Advantages of each programming language
 
Quote:

Originally Posted by cierra_shawe (Post 1139449)
Although it is only 3 days until our first regional, we have yet to solidify what programing language will be used.

I sincerely hope you've already programmed your robot :eek:


Quote:

Originally Posted by cierra_shawe (Post 1139449)
I was wondering what the advantages of each would be, and availability of teams who would be able to help at the regional. Also any other tips to help our rookie team out would also be great!

There are tons of threads out there on this, but I'll offer some quick points
  • There's a fair amount of support at regionals in all three official languages, but LabVIEW seems to take a majority
  • I'm not American, but I believe many American high school comp sci courses (specifically AP level) teach Java
  • Java and C++ have a fair amount of similar syntax
  • SmartDashboard can be extended with Java, default Dashboard can be extended with LabVIEW

EDIT: If you need specific real-time help, PM me

andreboos 05-03-2012 16:58

Re: Advantages of each programming language
 
Java and C++ compile and deploy much faster than LabVIEW, or at least that was the case last year. We use C++, and it takes 5-10 seconds to compile and 3 to deploy our code, which really cuts down on programming development time. LabVIEW takes several minutes. That said, LabVIEW is far easier for beginners at programming.

basicxman 05-03-2012 16:59

Re: Advantages of each programming language
 
Quote:

Originally Posted by andreboos (Post 1139639)
Java and C++ compile and deploy much faster than LabVIEW, or at least that was the case last year. We use C++, and it takes 5-10 seconds to compile and 3 to deploy our code, which really cuts down on programming development time. LabVIEW takes several minutes. That said, LabVIEW is far easier for beginners at programming.

LabVIEW also has some very nice debugging tools.

Disclaimer: That being said, I use C++ for the robot and this year quite a bit of Java for the dashboard and won't be switching anytime soon.

Ziv 05-03-2012 23:20

Re: Advantages of each programming language
 
Code:

if(youKnowAnyLanguage) {
    use(theLanguageYouKnow);
} else {
    read(WPILibCookbook);
    if(youUnderstoodAnyOfThat) {
        use(java); // C++ is an option, but it's a bit fiddly.
    } else {
        use(labview);
    }
}

An experienced FRC programmer using Java (and presumably any other language) can get a passable program running in a matter of hours, not days. Nevertheless, start learning and/or coding ASAP!

basicxman 05-03-2012 23:22

Re: Advantages of each programming language
 
Quote:

Originally Posted by Ziv (Post 1139870)
// C++ is an option, but it's a bit fiddly.

Care to elaborate?

Ziv 05-03-2012 23:26

Re: Advantages of each programming language
 
Quote:

Originally Posted by basicxman (Post 1139871)
Care to elaborate?

If I were teaching someone to program and I had a choice as to whether or not I had to explain memory management, I would choose not having to. But it's not that big of a deal. Besides, every language has its own special problems :).

basicxman 05-03-2012 23:27

Re: Advantages of each programming language
 
Quote:

Originally Posted by Ziv (Post 1139874)
If I were teaching someone to program and I had a choice as to whether or not I had to explain memory management, I would choose not having to. But it's not that big of a deal. Besides, every language has its own special problems :).

Memory management is an important topic in Java, the severe memory leak in SmartDashboard this year is a perfect example.

carrillo694 06-03-2012 00:03

Re: Advantages of each programming language
 
Quote:

Originally Posted by basicxman (Post 1139875)
Memory management is an important topic in Java, the severe memory leak in SmartDashboard this year is a perfect example.

For the purposes of programming a robot in only three days and not testing it until practice day, memory management probably is not their primary concern :p

cierra_shawe, what programming languages are you or those on your team familiar with? If the answer is "none," I am leaning towards recommending LabVIEW. Not because it is necessarily easier, but because its control structures seem more intuitive than the syntax that comes with Java or C++. If the answer is "some," then I would go with Java, because its WPIlib implementation seems simpler than the C++ implementation, which makes it easier to learn. But I could be wrong about that, since my team uses Java. At least you will not need to be concerned about memory management if you are unfamiliar with it, unless you are doing computer vision, which I do not recommend if you are testing your robot for the first time in a few days!

basicxman 06-03-2012 11:51

Re: Advantages of each programming language
 
Quote:

Originally Posted by carrillo694 (Post 1139894)
If the answer is "none," I am leaning towards recommending LabVIEW. Not because it is necessarily easier, but because its control structures seem more intuitive than the syntax that comes with Java or C++.

I really think this depends on your background. LabVIEW control structures can be intimidating and non-obvious at first. The way a LabVIEW program executes is quite a bit different than a C++/Java program. If a student has a background or enjoys math or algorithms they might find C++/Java more intuitive to them. If a student has a background in electrical they might find LabVIEW more intuitive to them.

Quote:

Originally Posted by carrillo694 (Post 1139894)
If the answer is "some," then I would go with Java, because its WPIlib implementation seems simpler than the C++ implementation, which makes it easier to learn.

I don't think this is entirely correct, the components inside the WPILib for Java and C++ are abstracted at essentially the exact same level - it's really about which ever language you're more comfortable with.

Jared Russell 06-03-2012 11:57

Re: Advantages of each programming language
 
I would argue that starting from scratch, it is easier for a student programmer to use Java (for FRC) than C++ (for FRC).

I cannot count the number of times I have been asked to help a team with C++ and seen problems like the following...

Code:

Victor myVictor(1);

myVictor->set(0.0); // Error!

Code:

Victor *myVictor = new Victor(1);

myVictor.set(0.0); // Error!

Code:

Victor *myVictor;

myVictor->set(0.0); // Error!  You declared, but did not substantiate, your Victor!

Code:

void SomeFunction(Victor victor)
{
victor.set(0.0);
}

Victor *myVictor = new Victor(1);

SomeFunction(myVictor); // Error!

Code:

void SomeFunction(Victor victor)
{
victor.set(0.0);
}

Victor myVictor(1);

SomeFunction(myVictor); // Still an Error!  You are making a copy of your Victor!

In Java you don't have to worry about objects on the stack vs. the heap (they are all on the heap), pass by reference vs. pass by value (always pass by value, even if your "value" is itself a reference to an object), memory leaks, C++ name mangling in compiler errors, initializing static class members outside of the class declaration, etc.

basicxman 06-03-2012 12:00

Re: Advantages of each programming language
 
Quote:

Originally Posted by Jared341 (Post 1140086)
I would argue that starting from scratch, it is easier for a student programmer to use Java (for FRC) than C++ (for FRC).

I cannot count the number of times I have been asked to help a team with C++ and seen problems like the following...

<snipped>

Definitely, but this all depends on the commitment and/or the amount of time the student has to learn the language they choose.

remulasce 06-03-2012 12:02

Re: Advantages of each programming language
 
<Obligatory Python pitch>

ianonavy 06-03-2012 13:12

Re: Advantages of each programming language
 
These advantages and disadvantages will differ according to your experience.

Java
Advantages
  • Can be programmed on Windows, Mac and Linux.
  • Forces good programming patterns such as object-orientation.
  • Simpler than C++.
  • No explicit memory management. You don't have to worry about handling specific memory addresses.
  • It's the AP Computer Science language, so if any of your students are taking that course, you don't have to learn a new language.
Disadvantages
  • Incomplete vision tracking APIs.
  • No explicit memory management. (Yes, this is both an advantage and a disadvantage.)

C++
Advantages
  • Executes and compiles much faster than LabVIEW.
  • Has complete vision tracking libraries.
  • Explicit memory management, so you don't ever have memory leaks if you know what you're doing.
  • Most popular, so more teams are likely to be able to help you at the competition.
Disadvantages
  • Syntax can be confusing for new programmers.
  • Requires a Windows PC to upload code.

LabVIEW
Advantages
  • Data flow is more intuitive than object-orientation in other languages.
  • Arguably easiest to teach among the three major supported languages.
  • Has access to the most NI vision libraries.
  • Very quick debugging tools. You can probe wires in the code while you're running it to see what the problem is very quickly.
  • Garbage collection means no explicit memory management.
Disadvantages
  • It's likely you know text-based languages already, so it could be harder to learn the data flow paradigm.
  • Only runs on Windows PCs.

Python
Advantages
  • You do NOT need to restart the cRIO to upload code, which is great for rapid development.
  • Uses the C++ cRIO image, so you can switch between the two if need be.
  • Simplest syntax of all of them. It's quite beautiful, and it's very easy to teach.
  • You can develop on any platform in any IDE.
  • Access to all of Python's fantastic modules.
Disadvantages
  • Depending on your IDE, a syntax error can go unnoticed, so you have to run tests that execute every line of code.
  • This language is not supported, so you won't get much help at the competition.

Honestly, write your programs in the language with which you are most comfortable. If you're caught between two or more, figure out which is the best for what you're trying to do. LabVIEW is much better for vision tracking than say Java, but if you need Java's higher level features, go for that.


All times are GMT -5. The time now is 01:22.

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