Go to Post If Dave stops wearing the Hawaiian shirts, the terrorists have won. - kjohnson [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-09-2010, 20:23
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,751
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 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
  #2   Spotlight this post!  
Unread 21-09-2010, 20:43
dirienzo dirienzo is offline
Registered User
AKA: Nick DiRienzo
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Apr 2010
Rookie Year: 2009
Location: USA
Posts: 15
dirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to behold
Re: Java versus C++

Quote:
Originally Posted by Greg McKaskle View Post
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
Alright, thank you. That cleared things up for me. Our mentor and I will probably run some individual tests anyway.
  #3   Spotlight this post!  
Unread 21-09-2010, 21:30
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
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**
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #4   Spotlight this post!  
Unread 21-09-2010, 21:43
dirienzo dirienzo is offline
Registered User
AKA: Nick DiRienzo
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Apr 2010
Rookie Year: 2009
Location: USA
Posts: 15
dirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to beholddirienzo is a splendid one to behold
Re: Java versus C++

Quote:
Originally Posted by RoboMaster View Post
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**
Do you mean Java runs slow in general, like as a desktop application, or in an FRC system? And I haven't tried LabVIEW, I'm not too attracted to it, but I'll probably try it out this year.
  #5   Spotlight this post!  
Unread 21-09-2010, 21:50
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
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/
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #6   Spotlight this post!  
Unread 21-09-2010, 22: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: Java versus C++

Quote:
Originally Posted by RoboMaster View Post
Java runs slow in general on a desktop application.

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++.



  #7   Spotlight this post!  
Unread 21-09-2010, 22:11
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Java versus C++

Ok, thanks for clearing that up. I've just always heard Java is slow.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #8   Spotlight this post!  
Unread 21-09-2010, 22:27
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: 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++
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #9   Spotlight this post!  
Unread 21-09-2010, 22:41
rogerlsmith's Avatar
rogerlsmith rogerlsmith is offline
Software Engineer
AKA: Roger Smith
FRC #3357 (COMETS)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Grand Rapids, MI
Posts: 214
rogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to beholdrogerlsmith is a splendid one to behold
Re: Java versus C++

From my experience mentoring teams using both C++ & Java, I have not seen any kind of performance issues. If you already have experience in Java, go with that.

I have been posting some simple Java programming tips on my blog. Feel free to contact me if you have any questions.
__________________
Roger Smith
Mentor - FRC Team 3357
COMETS - Creating Outstanding Minds, Embracing Technology & Science
---------------------------------------------------------------------------------------

Share FIRST videos, photos and experiences at FIRSTObjective.org
  #10   Spotlight this post!  
Unread 21-09-2010, 22:56
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Java versus C++

Quote:
Originally Posted by rogerlsmith View Post
If you already have experience in Java, go with that.
Well said Roger. Consider this advice when looking at your options, it is a very good point. It always comes up in discussions like this.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
  #11   Spotlight this post!  
Unread 22-09-2010, 11:39
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,753
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 versus C++

The statement "Java is slow" has been around a long time. And at one point, it was true. When Java first came out, it was slower than other languages like C. But there have been a TON of optimizations over the past 10+ years that simply make that statement not true in most cases. In fact, due in a large part to memory management, C++ can be slower than Java (Pointers are time consuming to handle for C++, malloc sucks, performance wise. You don't have those problems with Java).

for a young programmer like yourself, you have a couple of options.

1. You can go with what you already know (Java) - that will be the easiest and surest way of producing quality code for your team. The additional benefit of extra exposure to the language through the team will also help you with your classwork. Looking towards the future (aka college), you'll most likely being using Java for a lot. I know my old school has switched many classes over to Java in the past 6 years or so. Having a deeper understanding of that language now will only help you with your classwork in the future.

2. You could go with a different language for a broader experience. While this will probably be more difficult and time consuming for you, most programming jobs generally involve multiple languages - and having a broad exposure will help in the long run. For instance, right now my job requires me to know HTML, Groovy, JSP, Java, SQL, PL/SQL, and C (i think that's everything...). Additionally, learning multiple programming languages helps you to understand the basics of how languages, in general, work. You don't need to deal with pointers in Java, but working with them in C will dramatically increase your understanding of how computers work.

One last thing to consider: What support do you have? Do you have any programming mentors? do they have a preferred language?

Our team ended up going with Java for two reasons - first, the students were familiar with it from classes at school. Second, the mentors knew it better than C++ and could help them succeed better with it.

Another team we work closely with made a different decision. They went with Labview (i think), and ran into some big problems late in the season that their mentors (who were experts in Java) couldn't help much with. Having a safety net of knowledgeable people close at hand isn't something to ignore.
  #12   Spotlight this post!  
Unread 22-09-2010, 12:26
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: Java versus C++

Quote:
Originally Posted by eagle33199 View Post
... C++ can be slower than Java (Pointers are time consuming to handle for C++, malloc sucks, performance wise. You don't have those problems with Java).

Can you please provide an authoritative reference, or experimental data, to support the claims that:

1) properly-written code using pointers in C++ runs slower than functionally equivalent code written in Java

and

2) properly-written code using malloc in C++ runs slower than functionally equivalent code written in Java

Thanks!



  #13   Spotlight this post!  
Unread 22-09-2010, 17:13
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Java versus C++

Quote:
Originally Posted by davidthefat View Post
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++
Ah, but contemporary idiomatic C++ should almost never require the use raw pointers

Quote:
Originally Posted by AustinSchuh View Post
My understanding is that the JVM that's been ported to the cRIO is the squawk VM, which is not a real-time VM. While you might have your own opinions about the importance of a system being real-time or not, that was something that played into our thought process.
All of the calls to the vision API, FPGA/peripherals, watchdog, semaphores, etc., are simply wrappers to the underlying equivalent system primitives (fast VxWorks and/or FPGA code). As for a "real-time VM", the Real Time Specification for Java (RTSJ) that is implemented by Sun's Java Real-Time System and a few other libraries (but not Squawk) just means that performance is deterministically bounded, not necessarily any faster. In particular, it enforces that memory management and multi-threaded execution/scheduling always happens in the same way.

All of this really only matters if you are in a hard-real time, safety-critical situation. If for example you are building an airbag deployment system, you have a few milliseconds to react to a crash. In this scenario you can't afford the one in a million chance that your code is busy garbage collecting and thus blocking the execution of the real-time critical bit. In a FIRST robot, missing a real-time deadline by a little bit is (a) not going to be life threatening and (b) not going to occur often at all anyway. The worst possible scenario would be a fast software control loop ending up with a little bit more jitter (variation in time between calls).

Last edited by Jared Russell : 22-09-2010 at 19:33.
  #14   Spotlight this post!  
Unread 22-09-2010, 23:31
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: Java versus C++

Quote:
Originally Posted by Jared341 View Post
Ah, but contemporary idiomatic C++ should almost never require the use raw pointers
Aware me of this programmer lingo... As I said before, I am self taught so I don't have all the lingo down. I just do it If you know what I mean, I don't name what I do.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #15   Spotlight this post!  
Unread 22-09-2010, 23:40
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: Java versus C++

Quote:
Originally Posted by davidthefat View Post
Aware me of this programmer lingo... As I said before, I am self taught so I don't have all the lingo down. I just do it If you know what I mean, I don't name what I do.
Just Google the phrase "C++ idioms".



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

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


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

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