|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Java versus C++
Hey everyone. I'm fairly new to FRC programming (and programming in general, for that matter).
I am wondering if anyone has ran any benchmarks on robot code execution with Java and C/C++. Java compiles to bytecode which is then executed by the virtual machine at runtime, correct? While C/C++ compiles into machine code. Is there a noticeable performance difference between the two languages? Also, when I uploaded code to the cRIO, I remember something about LabView in the console window. Was a LabView 'layer' created for communication with the hardware; what is going on there? I am the lead developer for this season and our previous developers did not explain much. This past season was the first year using Java for our team, so I want to make an educated decision on language choice. On the other hand, if there are no performance differences, it's just a syntax preference then. Thanks, Nick DiRienzo |
|
#2
|
||||
|
||||
|
Re: Java versus C++
My personal preference is Java. Our team has decided it's not only a great language to use/learn, but a much more marketable skill to advertise.
That being said, there are countless threads like yours on CD. A quick search would have revealed these (to name a few). http://www.chiefdelphi.com/forums/showthread.php?t=86026&highlight=programming+langu ages http://www.chiefdelphi.com/forums/showthread.php?t=85982&highlight=programming+langu ages |
|
#3
|
||||
|
||||
|
Re: Java versus C++
I too am interested in the replies you get, but...
If you are facing a learning curve because you aren't inheriting much experience from previous years' teams; I suspect that folks are going to emphasize that familiarity with the language you use far outweighs any speed differences. Until you require the computer/software combination to do some complex operation(s) faster than the computer can execute your instructions in a "slow" language, you can ignore any speed differences (Yes - I know there are 2nd and 3rd order effects that can become important; but let's focus on the 1st order topic(s) before diving into the weeds). To say it another way, the language's efficiency is sort of like a rope used to cross ditches. If you need to cross a collection of ditches and the widest of them requires a 10 foot rope; if you have a 15 foot rope, then you are in good shape. Having a 30 foot rope doesn't get you into any "better" shape. I think you can guarantee that you are facing a learning curve. Do you also plan to cross any 20 foot ditches? If not, pick the language that is easiest to understand and easiest to use to get you across the metaphorical 10 foot ditches. Blake |
|
#4
|
|||
|
|||
|
Re: Java versus C++
My original post did seem like I learned nothing this past year. Which is not true. I did learn how to program for FRC, but we never got our camera working (due to frame rate issues and what not). When I said 'new', I mean less than two years. Then again, I am comparing myself to programming veterans who have been doing it for 30+ years, or even the students who have been in their team's programming group for more than one year.
I am fairly comfortable in Java. I have taken an Intro to Java class at school (was quite boring) and now am in AP CS A. I also taught myself using Blue Pelican Java during the build season, up until about week 4 - which is when I started working with the prior leads and learning somewhat. So there will be a slight learning curve for some things, but for the most part I will be fine. Meh, I guess I could just write it originally in Java (what I am comfortable with) then rewrite for C++. And play around for myself. @GGCO: A lot of the replies are just personal preference of a language. I understand that people use what they are most comfortable with. I was wondering if there are any proven gains or disadvantages to one language for the system we work with. Yes, there are some posts saying Java is not as good. But the supporting evidence was a matter of opinion. Thanks for the links though; more teams used Java than I thought. |
|
#5
|
|||
|
|||
|
Re: Java versus C++
All three languages have plenty of teams using them.
If you have a specific task you'd like to compare, I suspect you can get some numbers run. In general, all calls to do I/O and vision are neutral since the vision code is just a wrapper around native binary code, and the I/O is wrapped around the FPGA which is programmed in LV by the way. Differences will start to show up when/if most of the code being executed is written by you or your team. If you decide to get the pixels from an image and index through them looking for patterns, you'll notice a difference between the compiled and bytecode languages. Still, I think you'll find that reasonably written code will run just fine in any of the languages. So yes, it is a matter of preference, experience, and goals. Greg McKaskle |
|
#6
|
|||
|
|||
|
Re: Java versus C++
Quote:
|
|
#7
|
||||
|
||||
|
Re: Java versus C++
I'm not an expert in this, but I have repeatedly heard that Java runs slow, which apparently is one of its big downfalls. Would this apply here? It seems people are saying all 3 languages run just fine in our case. So maybe what I've heard is a general and bias statement.
Personally I'm a big LabVIEW fan.... **hint hint wink *cough* wink wink** ![]() |
|
#8
|
|||
|
|||
|
Re: Java versus C++
Quote:
|
|
#9
|
||||
|
||||
|
Re: Java versus C++
More like Java runs slow in general on a desktop application.
I would give LabVIEW a chance and see if you like it. It's a little unconventional so some people are hesitant, but I think it has a lot of benefits. These include the intuitiveness of graphical programming, its excellent debugging tools, and easy learning curve (in my experience and as reported by many people). Here's a link that I just found recently about LabVIEW, it's very good. http://www.ni.com/labview/whatis/graphical-programming/ |
|
#10
|
||||
|
||||
|
Re: Java versus C++
There are heavily computation-intensive exceptions but most desktop applications in general are not CPU bound and therefore they run the same whether written in Java or C++. |
|
#11
|
||||
|
||||
|
Re: Java versus C++
Ok, thanks for clearing that up. I've just always heard Java is slow.
|
|
#12
|
|||
|
|||
|
Re: Java versus C++
I will tell you that it is easier to code with Java. It can be a pain in the $@#$@#$@# to fix a memory leak in C++ because of a misused pointer... But personally I love C++
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| **FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** | Pjohn1959 | Programming | 37 | 31-08-2009 15:55 |
| Cable Versus Chain | Darren Collins | Technical Discussion | 1 | 14-01-2008 22:29 |
| Bernoullis versus Continuity | Corey Balint | Math and Science | 13 | 15-09-2007 17:59 |
| PC versus Console | Denman | Chit-Chat | 40 | 22-05-2005 18:01 |
| Reigonals versus startegies | MisterX | Rules/Strategy | 11 | 29-03-2004 00:04 |