|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Procedural v Object Oriented Programming
Today one of the mentors and I had a major miscommunication and got no progress programming wise today. I want to program the robot object oriented but the mentor wants procedural. Now you see he is not a programming mentor. Do I just listen to him and do what he wants or do what I seem fit? He and I agree that C++ is better fit, but that can not be done due to the number of programmers that do not know C++. How can I convince the mentors to let me program in C++? Its selfish, but I believe that I can write more efficient code with C++. I am not as familiar with Java than I am with C++.
I know procedural and OO is independent of the language, but I believe that OO is more efficient in C++ because I can use pointers instead of using multiple copies of the object. I planned on having "Managers" that manage everything in their "domain". Like a sensor manager, actuator manager and other managers. Now the mentor wants me to not use objects. From my experience, my way is more "efficient" code wise than his way is. So what do I do? Just do what he says? |
|
#2
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: Procedural v Object Oriented Programming
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: Quote:
|
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
Quote:
I didn't quite understand whether the argument was about procedural vs. OOP or C++ vs. Java. Also, your observation that Java is less efficient is incorrect. Unless you do some heavy (and most likely unnecessary) memory optimization, Java is just as efficient as C++, but easier to use (due to garbage collection). The difference is negligible. Java does not create "multiple copies" of an object. Those are pretty much pointers too, more accurately called references (This somewhat oversimplifies it). You should learn more about Java before deciding it's less efficient (It is, but only negligibly so and only if your C++ code is highly optimized). I think that you should probably use Java if other people know that better. I find that moving from C++ to Java is easier than the other way around, plus it's more fair if there are many people that prefer Java. |
|
#6
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
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:
Quote:
|
|
#7
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Quote:
Stop thinking about you and start thinking about your team. |
|
#8
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
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:
Quote:
|
|
#9
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Quote:
|
|
#10
|
|||||
|
|||||
|
Re: Procedural v Object Oriented Programming
Very strange. The user ID "davidthefat" no longer exists.
Hmmm. ![]() |
|
#11
|
||||
|
||||
|
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. |
|
#12
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Perhaps he no longer has a team affiliation.
|
|
#13
|
|||
|
|||
|
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. |
|
#14
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
Quote:
Now this shows up as my first post |
|
#15
|
||||
|
||||
|
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). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|