|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Quote:
|
|
#5
|
|||||
|
|||||
|
Re: Procedural v Object Oriented Programming
Very strange. The user ID "davidthefat" no longer exists.
Hmmm. ![]() |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
||||
|
||||
|
Re: Procedural v Object Oriented Programming
Perhaps he no longer has a team affiliation.
|
|
#8
|
|||
|
|||
|
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
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
Quote:
Now this shows up as my first post |
|
#10
|
||||
|
||||
|
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
|
||||
|
||||
|
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 |
|
#12
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
Quote:
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
|
|||
|
|||
|
Re: Procedural v Object Oriented Programming
Quote:
http://esolangs.org/wiki/Bitwise_Cyclic_Tag |
|
#14
|
||||
|
||||
|
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. |
|
#15
|
|||||
|
|||||
|
Re: Procedural v Object Oriented Programming
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|