Go to Post I always say find what works best for your team, for your given situation. Why should we rely on someone else to tell me what will work best for our situation? - JVN [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 15-01-2011, 17:01
imac256 imac256 is offline
Registered User
AKA: Ian McInerney
FRC #2022 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2009
Rookie Year: 2009
Location: Aurora, IL
Posts: 30
imac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of lightimac256 is a glorious beacon of light
Re: Procedural v Object Oriented Programming

Do you guys have a programming mentor? If you do get his advice and see what he thinks. In my experience programming for FIRST robots I have used a mix of procedural and object oriented in C++ (in this case I consider procedural calling a function inside the class which the robot started to run, because with the cRIO there must be at least one class).

I do procedural calls in the code to break up the main teleop loop, so I would have a MecanumDrive() function which is called, and then that calls an OO class we wrote to get joystick information. I would create new classes if it were for sensors which we would have multiple of (our sensors for the Swerve Drive is an example), or for something we might use in future years (a class to interact with an Xbox 360 controller is an example). That way there is less repetitious code.

With that method of programming in mind, my suggestion is to use OO to program the robot, because it means that the code is better organized and therefore can be more easily fixed at competitions and during testing. And in my experience OO code has proved to be more understandable for people looking at the code because you can have calls like "FrontSensor->GetAngle();" which when reading it you can see that you are getting the angle of the front sensor.

That is just my 2 cents though.
__________________
- Ian McInerney
Alumni & Mentor, Team 2022 Titan Robotics
Junior, Iowa State University majoring in Electrical Engineering
  #2   Spotlight this post!  
Unread 15-01-2011, 17:10
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: Procedural v Object Oriented Programming

Quote:
Originally Posted by Ether View Post
Not sure what you mean by this. Can you elaborate?

Ok from what I know, Java makes multiple copies of the object that I pass through parameters. In C++ you can just reference the object and it does not get copied into another memory location. If that is not true, my mistake.
Quote:
Originally Posted by DonRotolo View Post
Nope, can't see that from here.

My advice is to note the word "Team". If you are the only one who can use C++, or one of three who can while three or five others cannot, then you must consider the capabilities of the team.

If you're the only one who is good with C++, I see you as a potential bottleneck in programming. Our team would NEVER let a single student be responsible for an entire system, ain't gonna happen.

If half the programmers can do C++, then what is it the other half of the programmers will be doing?

Just because YOU can do a better job does not mean that it is best for the team. I see it only as what's best for you, and that doesn't fly in my book.


OK, now let's say you have a good case, and C++ really is a better choice. (Remember, I'm not aware of the specific situation on your team). Then it becomes your responsibility to logically explain why your way is superior for the team. Keep emotion out of it, keep your needs out of it: Why is it best for the team. Have several mentors listen to your "defense", and then accept their decision as final, with either your 100% support, or your resignation from the team - no team can have someone not fully committed to the team's decisions.


Lastly, think about why your team exists. What is the "product" delivered by the team? I can tell you it is NOT robots. It is "students", or to quote Team 1676's vision statement:
If this is similar to what your team believes, then the other students (who do not know C++) deserve a chance to contribute and learn. Next year, teach everyone C++ between September and December so you have the flexibility.
Yes that is why I made the choice of staying with Java, there was only 3 programmers last year, but from that time, we have grown to around 8. That was when I made the executive decision to stay with Java for the sake of others.
Quote:
Originally Posted by imac256 View Post
Do you guys have a programming mentor? If you do get his advice and see what he thinks. In my experience programming for FIRST robots I have used a mix of procedural and object oriented in C++ (in this case I consider procedural calling a function inside the class which the robot started to run, because with the cRIO there must be at least one class).

I do procedural calls in the code to break up the main teleop loop, so I would have a MecanumDrive() function which is called, and then that calls an OO class we wrote to get joystick information. I would create new classes if it were for sensors which we would have multiple of (our sensors for the Swerve Drive is an example), or for something we might use in future years (a class to interact with an Xbox 360 controller is an example). That way there is less repetitious code.

With that method of programming in mind, my suggestion is to use OO to program the robot, because it means that the code is better organized and therefore can be more easily fixed at competitions and during testing. And in my experience OO code has proved to be more understandable for people looking at the code because you can have calls like "FrontSensor->GetAngle();" which when reading it you can see that you are getting the angle of the front sensor.

That is just my 2 cents though.
We have 2 programming mentors, in fact, they also want C++. They made me the lead programmer and they want to take the "hands off" mentality. They do not interfere with anything unless I ask. They can't make it to 75% of the meetings. So I have to make all the executive decisions for the programmers. I am also the most experienced out of the 8. Half of them do not even show up half the time either.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #3   Spotlight this post!  
Unread 15-01-2011, 17:11
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: Procedural v Object Oriented Programming

Quote:
Originally Posted by Ether View Post
Not sure what you mean by this. Can you elaborate?

Ok from what I know, Java makes multiple copies of the object that I pass through parameters. In C++ you can just reference the object and it does not get copied into another memory location. If that is not true, my mistake.
Quote:
Originally Posted by DonRotolo View Post
Nope, can't see that from here.

My advice is to note the word "Team". If you are the only one who can use C++, or one of three who can while three or five others cannot, then you must consider the capabilities of the team.

If you're the only one who is good with C++, I see you as a potential bottleneck in programming. Our team would NEVER let a single student be responsible for an entire system, ain't gonna happen.

If half the programmers can do C++, then what is it the other half of the programmers will be doing?

Just because YOU can do a better job does not mean that it is best for the team. I see it only as what's best for you, and that doesn't fly in my book.


OK, now let's say you have a good case, and C++ really is a better choice. (Remember, I'm not aware of the specific situation on your team). Then it becomes your responsibility to logically explain why your way is superior for the team. Keep emotion out of it, keep your needs out of it: Why is it best for the team. Have several mentors listen to your "defense", and then accept their decision as final, with either your 100% support, or your resignation from the team - no team can have someone not fully committed to the team's decisions.


Lastly, think about why your team exists. What is the "product" delivered by the team? I can tell you it is NOT robots. It is "students", or to quote Team 1676's vision statement:
If this is similar to what your team believes, then the other students (who do not know C++) deserve a chance to contribute and learn. Next year, teach everyone C++ between September and December so you have the flexibility.
Yes that is why I made the choice of staying with Java, there was only 3 programmers last year, but from that time, we have grown to around 8. That was when I made the executive decision to stay with Java for the sake of others.
Quote:
Originally Posted by imac256 View Post
Do you guys have a programming mentor? If you do get his advice and see what he thinks. In my experience programming for FIRST robots I have used a mix of procedural and object oriented in C++ (in this case I consider procedural calling a function inside the class which the robot started to run, because with the cRIO there must be at least one class).

I do procedural calls in the code to break up the main teleop loop, so I would have a MecanumDrive() function which is called, and then that calls an OO class we wrote to get joystick information. I would create new classes if it were for sensors which we would have multiple of (our sensors for the Swerve Drive is an example), or for something we might use in future years (a class to interact with an Xbox 360 controller is an example). That way there is less repetitious code.

With that method of programming in mind, my suggestion is to use OO to program the robot, because it means that the code is better organized and therefore can be more easily fixed at competitions and during testing. And in my experience OO code has proved to be more understandable for people looking at the code because you can have calls like "FrontSensor->GetAngle();" which when reading it you can see that you are getting the angle of the front sensor.

That is just my 2 cents though.
We have 2 programming mentors, in fact, they also want C++. They made me the lead programmer and they want to take the "hands off" mentality. They do not interfere with anything unless I ask. They can't make it to 75% of the meetings. So I have to make all the executive decisions for the programmers. I am also the most experienced out of the 8. Half of them do not even show up half the time either.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #4   Spotlight this post!  
Unread 16-01-2011, 12:05
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,044
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: Procedural v Object Oriented Programming

Quote:
Originally Posted by davidthefat View Post
Ok from what I know, Java makes multiple copies of the object that I pass through parameters. If that is not true, my mistake.
It is not true.


  #5   Spotlight this post!  
Unread 16-01-2011, 12:27
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,988
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Procedural v Object Oriented Programming

Very strange. The user ID "davidthefat" no longer exists.

Hmmm.
__________________

I am N2IRZ - What's your callsign?
  #6   Spotlight this post!  
Unread 16-01-2011, 12:40
GGCO's Avatar
GGCO GGCO is offline
Registered User
AKA: Grant
FRC #3357
Team Role: Alumni
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Michigan
Posts: 406
GGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to behold
Send a message via AIM to GGCO
Re: Procedural v Object Oriented Programming

Sounds like you're the only one who's consistently attending meetings, so if I were you I'd continue to make these executive decisions. I think you're right in doing that.

Now if half of the 8 programmers don't show up to meetings, don't bend over backwards to accommodated them. However, if you're the only one with C++ experience, and the others can't understand it, then you must put the team first and stick with Java.
__________________
"Great spirits have always encountered violent opposition from mediocre minds" - Albert Einstein
The FIRST Alliance
COMETS Robotics
Website

  #7   Spotlight this post!  
Unread 16-01-2011, 12:40
gvarndell's Avatar
gvarndell gvarndell is offline
Software Engineer
AKA: Addi's and Georgie's Dad
FRC #1629 (GaCo)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Grantsville, Maryland
Posts: 350
gvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond repute
Re: Procedural v Object Oriented Programming

Quote:
Originally Posted by DonRotolo View Post
Very strange. The user ID "davidthefat" no longer exists.
Perhaps he no longer has a team affiliation.
__________________
Robots never, ever, ever, ever break -- The Robot Repairman (Backyardigans)
  #8   Spotlight this post!  
Unread 16-01-2011, 14:53
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Procedural v Object Oriented Programming

So, as I understand it, all 3 of the mentors agree that C++ is better, but do not wish to do it because the other programmers don't know C++?

How much do they know Java? Have they programmed the robot in Java before?

If all the Java they really know is from, say, a comp sci. class, then i would suggest sticking with C++, as you have programmed the robot in C++.

If all the Java they know is from a computer science class, then they could learn C++ really quickly.
  #9   Spotlight this post!  
Unread 16-01-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: Procedural v Object Oriented Programming

Quote:
Originally Posted by DonRotolo View Post
Very strange. The user ID "davidthefat" no longer exists.

Hmmm.
Quote:
Originally Posted by gvarndell View Post
Perhaps he no longer has a team affiliation.
Apparently, my account was lost during the server crash.

Now this shows up as my first post
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #10   Spotlight this post!  
Unread 16-01-2011, 20:36
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Procedural v Object Oriented Programming

They're both Turing complete, so difference in functionality shouldn't be an issue

In my experience doing both, the code written is so similar that I made the decision to use Java simply because I like Netbeans better than Windriver (especially since I use Ubuntu).
  #11   Spotlight this post!  
Unread 16-01-2011, 20:51
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,934
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Re: Procedural v Object Oriented Programming

To some of the other respondents - David's original question has very, very little to do with unimportant aspects of language differences, and almost everything to do with organizing teams.

David - While the programming topic might be interesting. It is also unimportant.

You shouldn't continue to let trivial differences between languages distract you. It is evident from the opening paragraph of your OP that you realize the real subject of your question, so deal with that subject.

Work with the team mentors to agree on an approach that puts service before self.

Leaders serve.

Blake
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate
  #12   Spotlight this post!  
Unread 19-01-2011, 14:04
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Procedural v Object Oriented Programming

Quote:
Originally Posted by gblake View Post
To some of the other respondents - David's original question has very, very little to do with unimportant aspects of language differences, and almost everything to do with organizing teams.
Quoted for Truth.


When I mentor a programming team, we discuss the various language options, their strengths, their weaknesses, and the team member's experience with each language. There is usually one or two zealots for one of the options, and usually they don't really know why. After a bit I tell the team "I know more than 13 languages and actively use 5 of them. The trick is identifying the right tool for the job." If that doesn't cure the zealotry, I tell them about the time that I insisted on using C++ when I should have used MATLAB, and that it took me 6 times as much code to write the same functions, and that in the end I got bit by a numerical rounding issue that MATLAB handles automatically.

And David, I know that my posts to you don't pull punches... If I were your team mentor you would not be the student lead. You really need to improve your team member skills before you can work on your team lead skills.
  #13   Spotlight this post!  
Unread 21-01-2011, 23:43
jaysongdahl jaysongdahl is offline
Registered User
FRC #0348
 
Join Date: Jan 2011
Location: Norwell
Posts: 1
jaysongdahl is an unknown quantity at this point
Re: Procedural v Object Oriented Programming

Quote:
Originally Posted by JewishDan18 View Post
They're both Turing complete, so difference in functionality shouldn't be an issue

In my experience doing both, the code written is so similar that I made the decision to use Java simply because I like Netbeans better than Windriver (especially since I use Ubuntu).
Hahahahah. Maybe then it would be better to write an assembler for this then?

http://esolangs.org/wiki/Bitwise_Cyclic_Tag
  #14   Spotlight this post!  
Unread 16-01-2011, 20:45
mathking's Avatar
mathking mathking is offline
Coach/Faculty Advisor
AKA: Greg King
FRC #1014 (Dublin Robotics aka "Bad Robots")
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 1999
Location: Columbus, OH
Posts: 634
mathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond reputemathking has a reputation beyond repute
Re: Procedural v Object Oriented Programming

From a technical sense, Java does make multiple copies of an object. But in practice this doesn't mean what most people think of as making multiple copies of an object. An object is intantiated in Java, the object references a memory location at which the data is stored. If you create another object and set it equal to the first object (such as when you pass it while calling a method) you do create a copy with the same data. But since that data is the the memory location where the "real" data that defines the object is located, when you change the copy you are changing the original.

OK, that was too confusing. Consider this:
Cat A = new Cat("Kitty");
Cat B = A;
B.changeName("Spike");
System.out.println(A.getName());
/* This code prints out 'Spike' because both A and B are referencing (you can think of it as 'pointing at' if this helps) the same location in memory. */

As for decisions on what language and style to use, as several commenters have posted, you should be asking yourself what is best for the team? And not just for this year but for the future. And you might also consider that using the language with which you are less comfortable will expand your own programming talents.
__________________
Thank you Bad Robots for giving me the chance to coach this team.
Rookie All-Star Award: 2003 Buckeye
Engineering Inspiration Award: 2004 Pittsburgh, 2014 Crossroads
Chairman's Award: 2005 Pittsburgh, 2009 Buckeye, 2012 Queen City
Team Spirit Award: 2007 Buckeye, 2015 Queen City
Woodie Flowers Award: 2009 Buckeye
Dean's List Finalists: Phil Aufdencamp (2010), Lindsey Fox (2011), Kyle Torrico (2011), Alix Bernier (2013), Deepthi Thumuluri (2015)
Gracious Professionalism Award: 2013 Buckeye
Innovation in Controls Award: 2015 Pittsburgh
Event Finalists: 2012 CORI, 2016 Buckeye
  #15   Spotlight this post!  
Unread 16-01-2011, 21:26
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,988
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Procedural v Object Oriented Programming

Quote:
Originally Posted by davidthefat View Post
Now this shows up as my first post
Welcome to ChiefDelphi!
__________________

I am N2IRZ - What's your callsign?
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 13:04.

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