Go to Post SWARF is evil! - Al Skierkiewicz [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-14-2017, 12:15 AM
lriddick lriddick is offline
Registered User
FRC #3490
 
Join Date: Nov 2013
Location: sc
Posts: 10
lriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to beholdlriddick is a splendid one to behold
Programming Language selection Pro's and Cons

Hi Everyone:
I am trying to find the pro's and con's of the MAJOR 3 languages, i.e Java, Labview and C++. there are many posts already out there that are keep going into the ease of learning of each language this is not what this is post is about.
Example : PERFORMANCE, FLEXIBILITY, and ADVANCED USABILITY.

Labview -
Pro
- Debugging programs you can easily see values in realtime
- function completion timing for trouble shooting
- Parallel looping functions
- multiple examples
Con
- getting labview to communicate with a co-processor is not easy due to cross language conflicts into dashboard
- command and control programming is complicated
- vison processing is limited to NI vision
- NI support is lacking in response time
Reply With Quote
  #2   Spotlight this post!  
Unread 05-14-2017, 12:22 AM
GavinL GavinL is offline
intensely stares at program
FRC #5726 (RhumBotz)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: San Antonio, Texas
Posts: 60
GavinL is a splendid one to beholdGavinL is a splendid one to beholdGavinL is a splendid one to beholdGavinL is a splendid one to beholdGavinL is a splendid one to beholdGavinL is a splendid one to beholdGavinL is a splendid one to behold
Re: Programming Language selection Pro's and Cons

C++ -
Pro
- fast

Con
- "what"
//
Real Pro/Con list

Pro
- Is fast
- efficient

Con
- May be hard to learn

I'll update this, it's quite late rn

Last edited by GavinL : 05-14-2017 at 12:26 AM. Reason: adding an actual pro con list
Reply With Quote
  #3   Spotlight this post!  
Unread 05-14-2017, 02:13 AM
solomondg's Avatar
solomondg solomondg is offline
Registered User
AKA: Solomon
FRC #2898 (Flying Hedgehogs)
Team Role: Leadership
 
Join Date: Aug 2016
Rookie Year: 2016
Location: Portland, Oregon
Posts: 29
solomondg is on a distinguished road
Re: Programming Language selection Pro's and Cons

C++:
Pros:
- Fast. This actually doesn't matter whatsoever 99% of the time because the bottleneck is always going to be the HAL.
- Memory sharing. This allows for advanced practices like 971 and 1678's forking subsystems
- No VM. Ditto for the above, but also like the above, there are probably less than five teams total in all of FIRST that do code that is remotely influenced or limited by the use of a VM and lack of memory sharing in other languages.
Cons:
- Hard to learn
- Hard to debug
- Easy to shoot yourself in the foot
- Language benefits like speed are nullified by HAL-side slowness
- Slow to code in, lots of code overhead

Java:
Pros:
- Generally easy to learn
- Pretty advanced OOP is possible, for better or for worse
- Lots of resources, teams that use it
Cons:
- A little confusing to learn
- JVM can be a problem for frequently forking/complex programs (not a problem for more than a handful of teams)
- Verbose syntax, bit more code overhead than some other languages (not including C++ haha)

I know you only said big three, but I'm going to go into two other languages that I think warrant mention and are able to be used in FRC.

Python/RobotPy:
Pros:
- Very easy to learn
- Very fast to write code in, low syntax overhead
- RobotPy's MagicBot system is phenomenal
- Good stack traces, nice and easy to debug
- RobotPy has an integrated robot simulator which is easy to use and amazing
- RobotPy has unit testing built in, also very nice to have
Cons:
- Dynamic typing. However, it does have type hinting, which might as well be static typing
- Interpreted nature means you won't know of a crash until you run that particular line of code. This is what unit testing is for.
- Slower than Java and C++. However code performance is an issue for you then chances are you're doing something wrong in your code.
- Global Interpreter Lock (GIL). This only allows a single thread of python bytecode to run at a time. It's not a problem for the vast majority of teams, however if you're doing asynchronous looping like 254 and some other teams, this pretty severely limits the complexity, number, and frequency of said loops in Python.
- Not officially supported by FIRST. However, quite a few teams use it, and from experience, are more than happy to help teach or debug.

Kotlin:
Pros:
- JVM compliant: no RobotKotlin needed, it's 100% compatible with Wpilibj and can call (and be called from) Java
- Complete null safety except for when explicitly disabled. If you ever get a null pointer exception in Kotlin that isn't caused by a bit of imported Java code, you might need to reevaluate your life.
- Very low coding overhead, almost as fast and simple to write code in as Python
- Fairly easy to teach
- Amazing, easy to use asynchronous capabilities
- Lambdas, lots of functional programming (if you want)
- C#-like class extensions
- Boilerplate reduction and code autogeneration
- You can compile down to JavaScript (please for the love of all that is holy don't do this for your robot)
Cons:
- Some pretty big paradigm shifts from Java that take a bit of getting used to (Objects instead of Classes, everything's Final by default)
- Less library support (not a real problem, you can import a Java library as if it's a Kotlin one)
- Less community support (though if you can't figure out how to solve a problem in Kotlin though, just do it in Java and import it)

Personally, I'd recommend Python for every team not using a lot of asynchronous programming (e.g. 254's loopers). I'd point those other teams towards Kotlin instead. And for those of us who insist on having crash-safe subsystems (cough 971 cough), C++ is always an option. There are really no huge upsides to using a 100% Java robot over using Kotlin, in my opinion.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-14-2017, 02:30 AM
frcguy's Avatar
frcguy frcguy is offline
Registered User
AKA: Nicholas Dal Porto
FRC #5940 (B.R.E.A.D.)
Team Role: Tactician
 
Join Date: Dec 2015
Rookie Year: 2012
Location: Belmont, CA
Posts: 1,303
frcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond repute
Quote:
Originally Posted by solomondg View Post
snip

Good post - I'm in agreement with pretty much everything Solomon wrote.
__________________



Team 5940: 2015-

Volunteer: 300 miles and counting!
Reply With Quote
  #5   Spotlight this post!  
Unread 05-14-2017, 06:13 AM
axton900's Avatar
axton900 axton900 is offline
Programming Co-Captain/Operator
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2015
Location: New Jersey USA
Posts: 54
axton900 has a spectacular aura aboutaxton900 has a spectacular aura aboutaxton900 has a spectacular aura about
Re: Programming Language selection Pro's and Cons

Well for the past couple years we used C++, but for this season we decided to make the switch to Java.

Here are the pros and cons that I found with each language.
C++:
pros:
-Fast
-no VM
cons:
-Eclipse offers you no support and in some cases harms your progress
-Hard to debug due to this
-Hard to pick up the language as a whole
-Null Pointers just crash the code

Java:
Pros:
- Eclipse helps with syntax problems and never really is an issue
- NullPointerException
- Easier to learn
Cons:
-The VM
-A little slow because of the JVM but not really an issue here in FRC

The main thing that made us want to switch was how Eclipse for C++ caused a lot of headaches among us programmers due to the amount of bugs the program itself had, but with Java, Eclipse is a lot more supportive of us coding instead of being the opposite. Overall, we love the switch!
__________________
Team 1403: Cougar Robotics (2015 - present)




Reply With Quote
  #6   Spotlight this post!  
Unread 05-14-2017, 08:17 AM
system201's Avatar
system201 system201 is offline
Super User Do
AKA: Andy Fondaw
FRC #0201 (FEDS)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Rochester Hills
Posts: 20
system201 is a jewel in the roughsystem201 is a jewel in the roughsystem201 is a jewel in the rough
Re: Programming Language selection Pro's and Cons

Quote:
Originally Posted by GavinL View Post
C++ -
Pro
- fast

Con
- "what"
YES Can Confirm
__________________


FRC 201, F.E.D.S (Falcon Engineering Design Solutions) Rochester Hills, MI

http://www.feds201.com
Reply With Quote
  #7   Spotlight this post!  
Unread 05-14-2017, 08:22 AM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,196
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Programming Language selection Pro's and Cons

Just going for missing points and one needing adjustment:

C++:
Pros
  • Fastest to compile & deploy code
Cons
  • Easy to shoot yourself in the back

Java:
Pros:
  • Uses interfaces rather than multiple inheritance
  • Garbage collection designed into language
  • VM enables some truly awesome debugging tools
Cons:

NI/LV:
Pros:
Cons:
  • Difficult to manage project (incompatible with Git, CVS, etc.)
  • Difficult to find mentors who know it (at least around here)
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-14-2017, 08:33 AM
FlamingSpork FlamingSpork is offline
Eating Utensil
FRC #3003 (Tan[X])
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Canandaigua, NY
Posts: 101
FlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really niceFlamingSpork is just really nice
Re: Programming Language selection Pro's and Cons

This has been said before in many other places here on CD, but the best programming language for your team is the one your programming mentor knows best.

Pros:
- You have somebody who knows it well to help you

Cons:
- You might be stuck with a language you personally dislike

Last edited by FlamingSpork : 05-14-2017 at 08:42 AM.
Reply With Quote
  #9   Spotlight this post!  
Unread 05-14-2017, 08:51 AM
Jaci's Avatar
Jaci Jaci is online now
http://imjac.in/ta/name
AKA: Jaci R Brunning
FRC #5333 (Can't C#) #5663 (Ground Control) | (OpenRIO, FRC West Aus)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Perth, Western Australia
Posts: 390
Jaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond reputeJaci has a reputation beyond repute
Re: Programming Language selection Pro's and Cons

As someone who's spent a good number of years in each language, I guess I'll put in some words.
I've tried to make my post as objective as I can.

Note: I don't talk at length about "having mentors who know {x} language", or "harder to learn". FRC is a learning experience, don't let your mentors lack of knowledge cripple your ability to learn something new. Furthermore, OP specifically asked for 'ease of learning' to not be discussed.

C++
Commonly seen as the "most difficult" programming language, that is easy to "shoot yourself in the foot" with, C++ is really not as bad as many people talk it up to be. Sure, there's more to be aware of, you can't just hand out heap memory willy-nilly, but this is a caveat that comes with low-level programming. C++ will give you the best performance, efficiency, and teach some very important coding practices for those that want to go into mechatronics, embedded systems engineering, or other related fields.

Pros:
- Most resource efficient (both memory and CPU time, lending to faster speeds and lower RAM utilization)
- Allow strict control over resources used
- Allows for more advanced programming uses
- Direct interface to the HAL, instead of going through JNI or equivalent (this improves a lot of WPILib << >> HAL crosstalk, mostly due to less symbol lookups and dynamic memory allocation/copying).
- Can be written in a standard text editor without wanting to shoot yourself (see: java)
- Provides a good start to those who wish to pursue embedded systems programming in industry, most of which is dominated by native code.
- No special RoboRIO preparation required
- Speedy code startup times

Cons:
- More prone to 'silent errors'
- Low-level system access gives some problems, such as pointer collisions
- Object Orientation is often more difficult than it appears

Java
Java is the most used language in the FRC community. Part of this success is related to its common use in schools, and its apparent ease of development. Although Java hogs memory and CPU time, most teams don't require extra performance or efficiency.

Pros:
- Object Orientation is generally pretty straightforward and powerful
- Garbage-collection makes it hard to allocate too much memory (although still entirely possible)
- Excellent IDE support, excellent library support
- Most FRC community projects are geared towards java
- Typically used in the non-embedded software industry

Cons:
- RoboRIO must be further prepared with a JVM
- WPILib << >> HAL crosstalk is inefficient, as is with other libraries such as the TalonSRX, due to the JNI.
- The JVM takes a long time to start, and eats 70% of RoboRIO RAM right off the bat
- Code execution time is not linear (i.e. the same block of code can vary greatly in execution time, depending on when garbage-collection is triggered)

LabVIEW
LabVIEW is commonly seen as the outcast of the 3 official languages, being a proprietary visual language from National Instruments. As with many things, the loudest opinions on LabVIEW come from those who have no idea how it works or what it does. There are some benefits to LabVIEW, so let's take a look.

Pros:
- Excellent debugging support, through highlight execution, front panels and probing
- Highly parallel (control flow is entirely based on data)
- Integrates directly with the HAL (making it faster than most would have you believe. All languages have a LabVIEW instance running in the background of the RoboRIO, lvrt)
- Generally useful for students graduating from FLL to rapidly prototype
- Very good support for signal processing and other such usages

Cons:
- Typically hard to read, and easy to end up with tangled wires
- Not very flexible, for more advanced needs (such as vision, or non-dataflow oriented programming)
- Lack of proper variable support can be troublesome
- Very lackluster version-control support
- It's surprisingly easy to deploy code as a non start-up task (i.e. code will not run on reboot)
- LabVIEW itself takes up a lot of space on the development computer
__________________
Jacinta R

Curtin FRC (5333+5663) : Mentor, Former [Captain | Programmer | Driver]
OpenRIO : Owner

Website | Twitter | Github
jaci.brunning@gmail.com
Reply With Quote
  #10   Spotlight this post!  
Unread 05-14-2017, 11:06 AM
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics Club)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 748
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Programming Language selection Pro's and Cons

Our team used to do C++ but switched to Java a few years ago because FTC switched their platform to Android phones and Java is one of the languages offered. Since we have both FRC and FTC teams, this allows us to share a common robotics framework library.
__________________
Reply With Quote
  #11   Spotlight this post!  
Unread 05-14-2017, 11:25 AM
AirplaneWins AirplaneWins is offline
Registered User
FRC #2848
 
Join Date: Apr 2015
Location: Dallas
Posts: 43
AirplaneWins is an unknown quantity at this point
Re: Programming Language selection Pro's and Cons

Our team used to use Labview for the past few years but switched in 2016 to Java. We switched mainly because our school teaches Java to all students, and FTC switched to Java as well making the teaching process a lot easier.
__________________
Reply With Quote
  #12   Spotlight this post!  
Unread 05-14-2017, 11:49 AM
Rangel's Avatar
Rangel Rangel is online now
John Rangel
FRC #0842 (Falcon Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Phoenix, AZ
Posts: 815
Rangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond reputeRangel has a reputation beyond repute
Re: Programming Language selection Pro's and Cons

How are code build/deployment times for the three main languages? I started this thread many years ago and am curious if anything has changed. We used Java and it seemed like build and deploy times remained at about 30 seconds. Does Labview still take a very long time? I can imagine if it still takes over a minute to test code, it would be a fairly big con.
__________________
2012 Dean's List Winner
2011-2014 Arizona Regional Winners
2016 Las Vegas Regional Winner
2014-? Mentor


Reply With Quote
  #13   Spotlight this post!  
Unread 05-14-2017, 12:48 PM
jman4747's Avatar
jman4747 jman4747 is offline
Just building robots
AKA: Josh
FRC #4080 (Team Reboot)
Team Role: Mentor
 
Join Date: Apr 2013
Rookie Year: 2011
Location: Atlanta GA
Posts: 439
jman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond reputejman4747 has a reputation beyond repute
Re: Programming Language selection Pro's and Cons

LabVIEW

Pros:

-Debugging tools are extremely extensive

-There are a lot of ways to comment, label, and add descriptions to your code

-It is very easy to tryout an algorithm on a PC using the UI them migrate it to the RIO after it has been debugged

-Extensive descriptions for every native function are readily available and most have built in examples

-As a result of the above it is very easy for someone with little or no experience with programming to learn.

Biggest con:

Relative to C++/java fewer people know it.

Misconceptions:

"LabVIEW is incompatible with git"

LabVIEW is totally compatible with git. We used it for our code this year. GitHub even lets initialize a new repo with a LabVIEW .gitignore file.

Counters:

I like that you can deploy as non-startup to test new code without overwriting working code.

If it is well written and properly commented & labeled it can be at least as easy to understand whats going on as with C++/Java, especially to the layman. But then that's the same with all languages.
__________________
---------------------
Alumni, CAD, Programming, & Strategy Mentor: FRC Team #4080
Mentor: FTC Team "EVE" #10458

Reply With Quote
  #14   Spotlight this post!  
Unread 05-14-2017, 12:53 PM
TimTheGreat's Avatar
TimTheGreat TimTheGreat is online now
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 259
TimTheGreat is a jewel in the roughTimTheGreat is a jewel in the roughTimTheGreat is a jewel in the rough
Re: Programming Language selection Pro's and Cons

Quote:
Originally Posted by FlamingSpork View Post
This has been said before in many other places here on CD, but the best programming language for your team is the one your programming mentor knows best.
I hate when teams choose a language because it's what their mentor wants them to use. Yes, having a mentor that knows the language is helpful, but in the age of digital technology, your only help isn't the person you can talk to face to face.

If a team wants to try a new language, expand their knowledge of computers and programming, I say let them. Don't tell your students they can't do something because you don't know it very well. It's a chance for both of you to learn.

The best programming language is the one that teaches the students something new.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #15   Spotlight this post!  
Unread 05-14-2017, 01:19 PM
Dan Waxman Dan Waxman is online now
Registered User
FRC #0263 (Aftershock)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Long Island
Posts: 62
Dan Waxman is a name known to allDan Waxman is a name known to allDan Waxman is a name known to allDan Waxman is a name known to allDan Waxman is a name known to allDan Waxman is a name known to all
Re: Programming Language selection Pro's and Cons

Quote:
Originally Posted by jman4747 View Post
LabVIEW
Misconceptions:

"LabVIEW is incompatible with git"

LabVIEW is totally compatible with git. We used it for our code this year. GitHub even lets initialize a new repo with a LabVIEW .gitignore file.
I think this is a bit of a stretch. In context, compatibility with git isn't the same thing as being able to use GitHub. LabView is generating binary files, which generally doesn't work phenomenally with git. Human readable diffs aren't really a thing with binary files and merges can get problematic quickly if any conflicts arise. LabView is great for a lot of things, but effectively teaching git version control probably isn't one of them. You can still definitely learn git with LabView, but not nearly as fully as with Java or C++ in my opinion.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 09:06 PM.

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