Go to Post I was watching the webcast when that score was posted and thought to myself, "What did they do, steal a donut from Dave?" - MissInformation [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 02-02-2011, 08:55
ianonavy ianonavy is offline
Programming Mentor/Alumnus
AKA: Ian Adam Naval
FRC #3120 (RoboKnights)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2008
Location: Sherman Oaks
Posts: 32
ianonavy is an unknown quantity at this point
C++ vs Java

This year, I am my team's new lead programmer. I've been doing some Googling about the differences between the two programming languages but I can't decide which language to go with.

I'm much more familiar with the syntax of Java, but I'm a very fast learner and should be able to figure out how to use C++. Also, all of my teammates who could help me taking the AP Computer Science, which teaches Java. I have prior experience with the FTC's RobotC, which if you aren't familiar with is basically a more simplified version of C++ and the WPILib.

I understand that compiled C machine code is more efficient than Java bytecode executed on a virtual machine, but is the performance difference really significant enough to be noticeable at all?

If any experts or mentors from other teams could give me some advice or feedback, it would be much appreciated. (: Thanks in advanced.
  #2   Spotlight this post!  
Unread 02-02-2011, 09:07
drakesword drakesword is offline
Registered User
AKA: Bryant
FRC #0346 (Robohawks)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: USA
Posts: 200
drakesword is on a distinguished road
Re: C++ vs Java

I believe that the execution speed in this application between the two languages is not important.

The java libraries, as I would consider them, are still under development. For instance the wrapper for the camera imaq* is mostly missing.

That being said you certainly can still track targets just its a bit harder.

For all intensive purposes you can completely program the robot without issue in java and c++ so it comes down to a personal decision. . .

Which language are you more comfortable with?
  #3   Spotlight this post!  
Unread 02-02-2011, 09:08
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: C++ vs Java

Quote:
Originally Posted by ianonavy View Post
I understand that compiled C machine code is more efficient than Java bytecode executed on a virtual machine, but is the performance difference really significant enough to be noticeable at all?
No. For purposes of FRC, this should not be a factor in your decision.


  #4   Spotlight this post!  
Unread 02-02-2011, 09:33
Bryan Herbst's Avatar
Bryan Herbst Bryan Herbst is offline
Registered User
AKA: Bryan
FRC #2052 (KnightKrawler)
Team Role: Mentor
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Minneapolis, Minnesota
Posts: 544
Bryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond reputeBryan Herbst has a reputation beyond repute
Re: C++ vs Java

In FRC, most of the differences between the two languages are irrelevant. Both languages can accomplish anything you want to do in FRC. Unless you are doing some particularly intense programming, efficiency shouldn't be a concern.

As drakesword said, it should come down to what language you and your team are more comfortable with. If you want to learn a different language during the off season, go ahead. During build season you should stick to what you know.

That being said, java and C++ have very similar syntax, as you will find many high-level languages do. The key difference you will run into in FRC is that C++ uses pointers, whereas java does not.
__________________
Team 2052- Knightkrawler
Mentor and volunteer

Last edited by Bryan Herbst : 02-02-2011 at 09:35.
  #5   Spotlight this post!  
Unread 02-02-2011, 09:45
MagiChau's Avatar
MagiChau MagiChau is offline
Registered User
AKA: Michael Chau
FRC #0085 (B.O.B. (Built on Brains))
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Zeeland, Michigan
Posts: 875
MagiChau is just really niceMagiChau is just really niceMagiChau is just really niceMagiChau is just really nice
Re: C++ vs Java

I prefer Java due to the officially used IDE being NetBeans. I prefer being able to use the opensource IDE available to many Operating Systems than Windriver for C++.
  #6   Spotlight this post!  
Unread 02-02-2011, 09:50
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: C++ vs Java

Your team number indicates you are a pretty new team. I would suggest two things:
1) pick a language and start right now (I typically recommend that teams start before the season getting familiar with the programming environment. You have a bit of catching up and will be better served by putting in time than listening to the endless discussion that C++ vs. Java usually provokes )
2) if there is a local team that is willing to support you (many larger older ones are extremely helpful) you might want to use the language they use, as experienced help standing next to you is worth a thousand posts. That said do not despair if you don't have local resources, request here often generates a thousand posts

Good Luck!
  #7   Spotlight this post!  
Unread 02-02-2011, 10:18
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: C++ vs Java

Quote:
Originally Posted by ianonavy View Post
This year, I am my team's new lead programmer. I've been doing some Googling about the differences between the two programming languages but I can't decide which language to go with.

I'm much more familiar with the syntax of Java, but I'm a very fast learner and should be able to figure out how to use C++. Also, all of my teammates who could help me taking the AP Computer Science, which teaches Java. I have prior experience with the FTC's RobotC, which if you aren't familiar with is basically a more simplified version of C++ and the WPILib.

I understand that compiled C machine code is more efficient than Java bytecode executed on a virtual machine, but is the performance difference really significant enough to be noticeable at all?

If any experts or mentors from other teams could give me some advice or feedback, it would be much appreciated. (: Thanks in advanced.
I agree with the others, which one you choose really doesn't matter. I actually find the fact that the vision stuff isn't fully wrapped in java forces you to simplify the vision code, which in the end could very well be a good thing.

If you are interested in Java shoot me an email, mwtidd@gmail.com I have all my code open sourced with tutorials this year. I go into a lot of the things you probably will see on the AP exam like interfaces and abstract classes.
__________________
"Never let your schooling interfere with your education" -Mark Twain
  #8   Spotlight this post!  
Unread 02-02-2011, 13:39
lynca's Avatar
lynca lynca is offline
Andrew Lynch
FRC #2587 (DiscoBots)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Houston, TX
Posts: 1,612
lynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond reputelynca has a reputation beyond repute
Send a message via AIM to lynca
Re: C++ vs Java

There is quite a bit of discussion on this topic already in the forums. So next time search before posting.

We use JAVA because:
1. students learn Java in AP courses
2. garbage collection & great error handling!
3. Netbeans is a friendly IDE for first time coders

If you want more JAVA sample code , take a look at our code base from 2010 or if your brave, our 2011 development code.

http://code.google.com/p/discobots/downloads/list
__________________
History: 624 - Cryptonite --> 118 - Robonauts --> 2158 - AusTIN CANS --> 2587 DiscoBots
Bio: Andrew Lynch "How I Work" ---- LinkedIn , Facebook, Twitter
  #9   Spotlight this post!  
Unread 02-02-2011, 17:07
ianonavy ianonavy is offline
Programming Mentor/Alumnus
AKA: Ian Adam Naval
FRC #3120 (RoboKnights)
Team Role: Mentor
 
Join Date: Dec 2010
Rookie Year: 2008
Location: Sherman Oaks
Posts: 32
ianonavy is an unknown quantity at this point
Re: C++ vs Java

Quote:
Originally Posted by omalleyj View Post
(I typically recommend that teams start before the season getting familiar with the programming environment. You have a bit of catching up and will be better served by putting in time than listening to the endless discussion that C++ vs. Java usually provokes )
I looked through the WPILibJ Java documentation last summer so I'm a bit familiar with it, but I'll probably still be coming back here for help.

Quote:
Originally Posted by ZonChau View Post
I prefer Java due to the officially used IDE being NetBeans. I prefer being able to use the opensource IDE available to many Operating Systems than Windriver for C++.
Yeah, having my code portable among different operating systems is nice. I can code on my laptop (both the Windows and Linux paritions) and my school's iMacs.

Quote:
Originally Posted by lynca View Post
There is quite a bit of discussion on this topic already in the forums. So next time search before posting.

We use JAVA because:
1. students learn Java in AP courses
2. garbage collection & great error handling!
3. Netbeans is a friendly IDE for first time coders

If you want more JAVA sample code , take a look at our code base from 2010 or if your brave, our 2011 development code.

http://code.google.com/p/discobots/downloads/list
I did do a quick search but obviously I didn't look thoroughly enough. I also agree with all three of your reasons. Thanks for the link! I'm sure it will be very helpful.


Thank you to everyone for responding. I've decided not to make things more complicated than they need to be and use Java. Good luck to everyone and see some of you at the competition. (:
  #10   Spotlight this post!  
Unread 02-02-2011, 17:58
dotbran dotbran is offline
Registered User
AKA: Brandon Olsen
FRC #3219 (TREAD)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Auburn, WA
Posts: 68
dotbran is on a distinguished road
Re: C++ vs Java

For FRC-specific purposes it does not matter whether you use Java or C++, but I would recommend C++ as it will help you develop a knowledge of programming that applies to a larger variety of languages.
  #11   Spotlight this post!  
Unread 02-02-2011, 23:19
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: C++ vs Java

I recommend C++. The libraries are more mature by a year and the syntax is similiar enough to java that you will pick it up in no time. Post any questions and I'm sure somebody will help.

Brian
__________________
Brian K
Team 1225 Robotics Mentor
  #12   Spotlight this post!  
Unread 03-02-2011, 19:15
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: C++ vs Java

Main reasons why I chose Java:
1.) Simplicity
2.) I am the only one that knows C++
3.) NetBeans is Open Source (Why do I care? Because I run Linux, so I can code on my machine at home)
4.) AP Comp Sci teaches Java

Cons:
1.) No inline Assembly
2.) No pointers
3.) Too high level for my liking
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #13   Spotlight this post!  
Unread 03-02-2011, 19:25
Chris27's Avatar
Chris27 Chris27 is offline
Registered User
AKA: Chris Freeman
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Mountain View
Posts: 196
Chris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant future
Re: C++ vs Java

Quote:
Originally Posted by davidthefat View Post
Main reasons why I chose Java:
Cons:
1.) No inline Assembly
Can you show me some FRC code you have written where it was necessary to inline assembly?
  #14   Spotlight this post!  
Unread 03-02-2011, 19:28
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: C++ vs Java

Quote:
Originally Posted by Chris27 View Post
Can you show me some FRC code you have written where it was necessary to inline assembly?
Nope
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
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:47.

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