|
Re: Preferred Programming Language
Our team has used both Java and C++, what we found is that Java is great if you don't care about optimizations and stuff that goes on lower level. Java is good if you want to create code quickly but have the code run slowly. When we switched to c++, we had a LOT more work to do but the code is much better when it comes to speed, memory management, and overall control. Java's JVM benefits are irrelevant in this scenario because you are programming for one target. Java allowed us to write bad code really fast and create a buggy, slow, but working robot. C++ allowed us to write really optimized code slowly which runs very quickly and has more functionality. There are somethings we could do with C++ that we couldn't do with Java, such as dynamically loading the code so that we can make changes to the code on the fly without restarting the robot. C++ also allows us to interface directly to the OS as well, so memory management is great. The performance benefit C++ gave us also allowed us to run a separate thread at 200Hz that uses machine learning. However, java is easier to learn for sure.
C++:
Pros:
-Fast
-Control
-More functionality
-Native
-Multi-paradigm
-Good memory management if you are careful
-Not as limiting as java
-Easy interfacing to OS
Cons:
-Hard to learn
-Easy to mess up badly
-Terrible memory management if you are not careful
Java:
Pros:
-Easy for beginners to learn
-Hard to mess up terribly
-Safe
-Garbage Collection
Cons:
-Forced Object Oriented Programming
-Exceptions
-Slow
-No control over memory allocation and deallocation
-Limiting to the programmer
-Forced Garbage Collection
-Sometimes too safe
TLDR: If you are not that experienced, use Java. If you care about lower level control and optimization, use C++
__________________
Hsifeulbhsifder
___________________
"Any given computer program is obsolete, any set of written rules is incomplete"
|