View Single Post
  #12   Spotlight this post!  
Unread 06-03-2012, 11:57
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,077
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: Advantages of each programming language

I would argue that starting from scratch, it is easier for a student programmer to use Java (for FRC) than C++ (for FRC).

I cannot count the number of times I have been asked to help a team with C++ and seen problems like the following...

Code:
Victor myVictor(1);

myVictor->set(0.0); // Error!
Code:
Victor *myVictor = new Victor(1);

myVictor.set(0.0); // Error!
Code:
Victor *myVictor;

myVictor->set(0.0); // Error!  You declared, but did not substantiate, your Victor!
Code:
void SomeFunction(Victor victor)
{
victor.set(0.0);
}

Victor *myVictor = new Victor(1);

SomeFunction(myVictor); // Error!
Code:
void SomeFunction(Victor victor)
{
victor.set(0.0);
}

Victor myVictor(1);

SomeFunction(myVictor); // Still an Error!  You are making a copy of your Victor!
In Java you don't have to worry about objects on the stack vs. the heap (they are all on the heap), pass by reference vs. pass by value (always pass by value, even if your "value" is itself a reference to an object), memory leaks, C++ name mangling in compiler errors, initializing static class members outside of the class declaration, etc.

Last edited by Jared Russell : 06-03-2012 at 16:21. Reason: Java does not pass by reference