Go to Post Maybe my brain fog factor has expanded after wading through 1114's competition data sheet, so I cannot see the forest for the trees. - Bill_B [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 21-05-2013, 01:55
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
Java or C++

I'm debating over whether our team should switch from C++ to Java or stick with C++. I've looked over some of the forums about it and I didn't see much help. I'm looking to whether C++ is more beneficial or Java is more beneficial in relation to it's simplicity, and control.

I've done some research and found out that C++ has the ability to pass over variables and Java doesn't. I'm not sure but just asking around to see what everyone knows.

I also noticed there's a large part in my community, Central Valley, switching over to Java large part to the new AP classes teaching Java, is there any other reason why the support of Java?
  #2   Spotlight this post!  
Unread 21-05-2013, 05:47
Phoenix Spud's Avatar
Phoenix Spud Phoenix Spud is offline
Everyone. Everywhere.
FRC #3132 (Thunder Down Under)
Team Role: College Student
 
Join Date: Jan 2009
Rookie Year: 2004
Location: Sydney, Australia
Posts: 703
Phoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond reputePhoenix Spud has a reputation beyond repute
Re: Java or C++

Our team has used all three programming languages since we started in 2008.

C++ was ok, but there were quite a few bugs and the documentation was really bad. We switched to LabView last year because one of the teams we partner with recommended it, but they switched to Java that year.

This year we had a large intake of new software mentors (Google became one of our sponsors...) and students so we revisited what language to use. After our experiences with the other two, we landed on Java. Our code this year was the best we've ever had, and I think we'll be a "Java team" for awhile now.

If there are a lot of teams in your area who use Java, switching might be a good choice so you can draw on their expertise.
__________________
Sarah Heimlich
Outreach Mentor | Business Mentor
FIRST® TEAM 3132
  #3   Spotlight this post!  
Unread 21-05-2013, 06:25
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Java or C++

During my first year with our FRC team, we switched to Java, primarily because that was the language taught in our high school programming classes. I was primarily a C/C++ guy beforehand, but for our purposes in robotics, I found Java to be a very good choice. I didn't notice any performance problems (outside of trying to do image processing on the cRio, which is another issue entirely), cross-platform development was nice (I'm a Linux user), and not having to deal with explicit memory management made things less complicated.

I wholeheartedly recommend Java, but I think the most important factors in a decision like this should be prior student and mentor knowledge; if you don't have someone who knows the language already, programming a whole robot with it can be quite a difficult task.
__________________
I code stuff.
  #4   Spotlight this post!  
Unread 21-05-2013, 09:09
FrankJ's Avatar
FrankJ FrankJ is offline
Robot Mentor
FRC #2974 (WALT)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: Marietta GA
Posts: 1,946
FrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond reputeFrankJ has a reputation beyond repute
Re: Java or C++

In terms of what makes the best robot-- they are all just tools. They all have there advantages & disadvantages. I would go with the one that you have the best local support. I get the impression that the Java & AP sort of works in reverse. Coding the robot teaches way more about under the hood aspects that you learn in AP.
  #5   Spotlight this post!  
Unread 21-05-2013, 09:27
asteb27 asteb27 is offline
Registered User
FRC #0293
 
Join Date: Feb 2013
Location: New Jersey
Posts: 37
asteb27 is an unknown quantity at this point
Re: Java or C++

We switched from c++ to java this year. We really like java because of it's simplicity and documentation
  #6   Spotlight this post!  
Unread 21-05-2013, 09:48
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,835
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Java or C++

Quote:
Originally Posted by Dragonslayerend View Post
I've done some research and found out that C++ has the ability to pass over variables and Java doesn't. I'm not sure but just asking around to see what everyone knows.
I'm not entirely sure what you mean by this, but I think you're talking about "Pass by reference" versus "Pass by value". In short, Pass by reference means that changes made to a variable passed into a function are reflected in the calling function, while Pass by value means they aren't. Java, by default, uses Pass by Reference (although you can easily make a new object to make it work the same as Pass by Value), while C++ uses Pass by value (Although with pointers C++ can do Pass by Reference). In short, both languages are capable of supporting the same behavior, they just take different approaches to it.

The three programming languages are supposed to be equally capable for FRC, and from what I've seen teams do in the different languages, I'd say they are. The choice really comes down to what you'll have the most support with. If you have mentors that know one of the languages, go with that. If your school teaches one of the languages, go with that. If you have local support from other teams for one of the languages, go with that.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016; Galileo 2016; Iowa 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
  #7   Spotlight this post!  
Unread 21-05-2013, 15:41
who716's Avatar
who716 who716 is offline
Registered User
AKA: Stephen Kalogiannis
FRC #0716 (Who'sCTEKS)
Team Role: Alumni
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Falls Village Connecticut
Posts: 424
who716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to beholdwho716 is a splendid one to behold
Re: Java or C++

im probably not the best person to be discussing this topic, partly because programing is no where near my topabilities, our team uses C++ and i dont think we plan on changing it, because we are comfortable with it and it works.
__________________
2014-
-WPI number one seed
-Innovation in controls award
- NECMP#4 seed semifinalist
- 9th in NEW ENGLAND

2008- Connecticut regional winners
2004-UTC new England regional Winners
2001 highest rookie seed award winner
  #8   Spotlight this post!  
Unread 21-05-2013, 21:53
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Java or C++

Quote:
Originally Posted by Phoenix Spud View Post
C++ was ok, but there were quite a few bugs and the documentation was really bad.
I would counter. (at least now) almost everything is documented using Doxygen, and you can easily generate the documentation yourself from the source code.

As far as with bugs, the Java and C++ implementations of WPILib track rather closely now so bugs should be similar.

If you mean as to build toolchain, I can't speak to that as my team has used ucpp for the past two years.

If anything, my anecdotal experience is that LabVIEW broke more often - though the debugger was awesome when it worked, halfway through competition (logomotion). It also bricked without explanation once - we had to do a full reformat in order to get everything back up and running. The technical staff at the regional couldn't figure out why in either case also. The whole affair was rather strange.

That's just my anecdotal experience though, and I must admit to be fair that I am not unbiased in my opinions

As far as I'm concerned, the single greatest factor in favor of Java or C++ is that version control is *much* easier than with LV. That's saved my team on a number of occasions. I also contend that distributed systems are nicer because they let you have full access to history and make commits at the competition without an internet connection to your host.
__________________
FRC 612 '12
USNA '16

Last edited by rbmj : 21-05-2013 at 22:19.
  #9   Spotlight this post!  
Unread 21-05-2013, 23:12
mman1506's Avatar
mman1506 mman1506 is offline
Hater of Tiny Molex Connectors
AKA: Marcus Quintilian
no team (WARP7)
Team Role: Alumni
 
Join Date: Mar 2012
Rookie Year: 2012
Location: Toronto
Posts: 808
mman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond reputemman1506 has a reputation beyond repute
Re: Java or C++

I think the main advantage of JAVA over C++ is that the development tools are free unlike C++ and LabView. This makes things way easier if you have a programming team.
__________________
2014-2015: FRC 865 Warp7 Team Captain
2016: FRC 865 Mentor

2017: Free Agent Mentor, Inspector
  #10   Spotlight this post!  
Unread 21-05-2013, 23:13
Gregor's Avatar
Gregor Gregor is offline
#StickToTheStratisQuo
AKA: Gregor Browning
no team
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Kingston, Ontario, Canada
Posts: 2,447
Gregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond reputeGregor has a reputation beyond repute
Re: Java or C++

Searching is your friend.
__________________
What are nationals? Sounds like a fun American party, can we Canadians come?
“For me, insanity is super sanity. The normal is psychotic. Normal means lack of imagination, lack of creativity.” -Jean Dubuffet
"Insanity is doing the same thing over and over again and expecting different results." -Albert Einstein
FLL 2011-2015 Glen Ames Robotics-Student, Mentor
FRC 2012-2013 Team 907-Scouting Lead, Strategy Lead, Human Player, Driver
FRC 2014-2015 Team 1310-Mechanical, Electrical, Drive Captain
FRC 2011-xxxx Volunteer
How I came to be a FIRSTer
<Since 2011
  #11   Spotlight this post!  
Unread 21-05-2013, 23:19
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Java or C++

Quote:
Originally Posted by mman1506 View Post
I think the main advantage of JAVA over C++ is that the development tools are free unlike C++ and LabView. This makes things way easier if you have a programming team.
Shameless plugs: http://www.chiefdelphi.com/forums/sh...d.php?t=110720 and http://www.chiefdelphi.com/forums/sh...d.php?t=116921
__________________
FRC 612 '12
USNA '16
  #12   Spotlight this post!  
Unread 22-05-2013, 00:25
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 487
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Java or C++

Quote:
Originally Posted by Jon Stratis View Post
Java, by default, uses Pass by Reference (although you can easily make a new object to make it work the same as Pass by Value), while C++ uses Pass by value (Although with pointers C++ can do Pass by Reference).
It's time for me to be the pedantic guy: Java uses pass by value for primitive types and by reference for all others. This is not merely a default: it cannot be changed (The ugly work-around of the caller copying arguments does work, of course). Also, for passing references in C++, I recommend: the language feature called "references"

On a different note, it's interesting to hear that the Java and C++ WPIlib impelemtations are equally buggy. I had assumed that the C++ one must be worse because the code looks like it was written by someone who wanted to be writing Java.
  #13   Spotlight this post!  
Unread 22-05-2013, 02:28
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
Re: Java or C++

Okay thankyou everyone, this is quite alot of input. Our team has decided to move to Java, but also continue some C++ so that we can continue to compare and study the differences.
  #14   Spotlight this post!  
Unread 22-05-2013, 08:00
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,756
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: Java or C++

I swear, I'm not trying to be the LabVIEW guy in the "Java or C++" thread, but I just wanted to comment on a few things.

I hope no one is paying money for either Wind River tools or LabVIEW tools. Teams are given as many copies as can be stuffed on the hard drives. Yes, in industry and in academia, people pay money for those products. That is how I make my house payments. Through the affiliates program, I know Bjarne Stroustrup and the A&M portion of the gcc distro guys and they live in houses too. I guess my point is that I don't see the connection between someone else paying money for something that you get for free and which tool helps your students learn to program a robot.

As for source code control, it is an important aspect of SW development. LV has plug-ins for perforce and a few other SCC tools, but not for all of the recent free ones I see mentioned on CD. It looks like https://github.com/joerg/LabViewGitEnv explains how to accomplish a GIT integration, and I'm sure there are similar tutorials on other sites.

On the original topic? C++ is a very powerful language, but that power makes it complex and able to make mistakes that are very difficult to debug. The other languages aren no slouches in that regard, but C++ definitely takes the cake. For an introductory language, I'd also choose Java over C++. And if you want to learn a language that takes a different approach, you might give that other one a try.

Greg McKaskle
  #15   Spotlight this post!  
Unread 22-05-2013, 10:20
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Java or C++

Quote:
Originally Posted by SoftwareBug2.0 View Post
It's time for me to be the pedantic guy: Java uses pass by value for primitive types and by reference for all others. This is not merely a default: it cannot be changed (The ugly work-around of the caller copying arguments does work, of course).
OK, now it's my turn to be pedantic. Java is entirely pass by value in all cases. The thing is, that all objects are really pointers, so it appears to be pass by reference. So, if actually use the equals operator with an object in a function, the whole pass by value-ness will rear its head. Though a lot of these things don't work in C++ either, the syntax of C++ makes it so that these things don't make conceptual sense in the cases that they do not work, whereas a java programer could reasonably expect some of these cases to work since they are conceptually congruent..

BUT THERE ARE NO POINTERS IN JAVA.

And this is why I never grok Java. I don't like drinking kool-aid. Learned enough to get by in class and moved on...

Quote:
I hope no one is paying money for either Wind River tools or LabVIEW tools. Teams are given as many copies as can be stuffed on the hard drives. Yes, in industry and in academia, people pay money for those products. That is how I make my house payments. Through the affiliates program, I know Bjarne Stroustrup and the A&M portion of the gcc distro guys and they live in houses too. I guess my point is that I don't see the connection between someone else paying money for something that you get for free and which tool helps your students learn to program a robot.
We all like living in houses - I don't blame you or anyone for that. For me the larger concern is portability. Also, even closed source linux tools don't integrate as well 99% of the time for me - they rarely integrate with the package manager (a rare exception being google chrome), for example. I don't like dealing with installer programs or license managers. I like writing code. Anything that gets in my way of writing code in the environment I like to do it in, therefore, I don't like.

I also didn't say that LV didn't work with VC. But it doesn't work *as well* for me. If I'm managing my code on github, it's a lot easier for me to get a pull request, look at the plain text diffs, and automatically merge it in using a grand total of about 3 clicks and a quick mental compile than manually fetching, comparing using one tool, merging using another, and then manually pushing. It really sounds trivial but its the small frustrations in a smooth workflow that annoy me. It does work, though. We used git with LV three years ago and managed to make it work. It didn't erase the fact though that it felt like a suboptimal situation.

On a completely anecdotal note, I've found it harder to convince inexperienced programmers to split their LV code into several subVIs than to split Java/C++ code into several functions. I don't know why this is. Good chance it's just my sample.

I did not mean to turn this post into a diatribe... sorry all. Really, I believe LabVIEW is a good language. It's great for rapid prototyping and throwing together a quick custom dashboard. It's just not the tool I prefer to use, and deep down it's really just because I don't have as much experience with it ;-)

Quote:
On a different note, it's interesting to hear that the Java and C++ WPIlib impelemtations are equally buggy. I had assumed that the C++ one must be worse because the code looks like it was written by someone who wanted to be writing Java.
I recant my previous statement. Currently on FirstForge Java has 17 open bugs while C++ has 26. This is significant, though it is by no means scientific (are C++ users more likely to find and/or report bugs than Java users?).
__________________
FRC 612 '12
USNA '16

Last edited by rbmj : 22-05-2013 at 10:28.
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


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

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