
19-12-2016, 11:35
|
 |
CTO, Programmer
AKA: Erik Uhlmann
 FRC #2877 (LigerBots)
Team Role: Leadership
|
|
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 296
|
|
|
Re: Seeking advice for rookie programming
Disclaimer: my team is switching from C++ to Java this year
C++
Pros Cons - It allows you to do almost anything. Which is bad sometimes (use smart pointers!)
- For FRC specifically, the compiler is unusually slow. Large projects can take several minutes to build
- To display errors, Eclipse basically parses compiler output. It sometimes doesn't work too well
- Exceptions aren't as sophisticated as in Java. Also I often think the creators of the standard library put making it beautiful C++ before making it actually usable to new programmers. It's beautiful C++ that I don't entirely understand. Luckily in FRC, you don't need to use the standard library a lot
- Debugging in eclipse is basically a GUI wrapper over GDB (a console program). It can be problematic sometimes
Java
Pros: - Safer. It's more restrictive, but it has the advantage that the compiler will catch most problems for you (as opposed to C++ where you'll just get a random segfault)
- Simple standard library. And you can actually understand the source of most of it, unlike STL which is basically line noise that happens to be valid C++
- Less file spam. No need for header files, or dealing with cyclic dependencies since the compiler handles it all for you
- Compiling is fully integrated into Eclipse. It compiles as you write, and gives you instant feedback on errors. In C++, you have to explicitly use the build button before it displays most errors.
- Debugging is fully integrated into Eclipse, and it's awesome
(SE even supports limited code hotswapping. I'm going to test if hotswapping works on ME at some point)
Cons: - May be slower (it's interpreted / JIT compiled)
- It's more restrictive than C++, so some C++ may be necessary for performance hacks (eg, link in C++ pros above)
Last edited by euhlmann : 19-12-2016 at 11:39.
|