I've got quite a bit of C++ down (thought there is no way I know everything), and have some minor experience in Java and C#.
So, for anyone who knows another language in addition to C++, what would you say is the hardest bit for transition either way?
From Java to C++, I'd say Memory Management/Pointers, Templates, and Multiple Inheritance.
From C++ to Java, I'd say the lack of MI, lack of Enums, Memory Management, and everything being declared in a class. In fact, the one thing I can't wrap my head around is why Sun decided to force everything to be declared in a class.
The hardest transitions are cross-paradigm transitions: every little bit is different. Look at Haskell or Scheme, Prolog or Erlang, APL or J
the one thing I can't wrap my head around is why Sun decided to force everything to be declared in a class
That's the legacy of the original OOP schism betwen Simula's "objects model a physical world" and Smalltalk's "everything is an object". C++ and Java chose different object models.
Going from C++ to Java, i was at first like "yay garbage collector! no more explicit destruction!" - which of course only worked til I needed deterministic destruction anyways. Damn.
Destroying OpenGL textures before the context is released.
It is not really much harder than in C++. Just need to provide a manual destroy/close method, similar to C++ destructors. And if you know a little of reflection and the new Java 7 try-with-resources block, you can even accomplish exactly the same behaviour as RAII in C++.
It is not really much harder than in C++. Just need to provide a manual destroy/close method, similar to C++ destructors. And if you know a little of reflection and the new Java 7 try-with-resources block, you can even accomplish exactly the same behaviour as RAII in C++.
But that's exactly the problem - I need the order to be deterministic. The context must be released AFTER the textures have been. So you need explicit destruction. Which is what I said (I never said it was problematic to implement in Java, it was just that I came to Java with the expectation that the garbage collector would somehow magically do everything for me).
The C++ equivalent would be something along the lines of:
myObject.Add(5,10);
The 'AddTo' part is optional. You can give parameters tags to remind you what they are when you're calling them.
It's weird not using dot-notation. Kind of easy to spot method calls, though, as they'll always be inside of square brackets. There's minor exceptions where Obj-C classes can form their own setter/getter methods and you'd use dot-notation, but that's another story. :-)
In fact, the one thing I can't wrap my head around is why Sun decided to force everything to be declared in a class.
It's really no different since you can break encapsulation at will.
I went from C to C++.
I would guess that this is the hardest transition there is. It's particularly tricky because it's a mindset change more than a syntax change. It also leads a lot of developers to thinking that they have successfully moved to C++ when they haven't transitioned at all.
Going from something like Java or Python to C++ would be difficult because of the lack of standardized/built-in libraries to do everything under the sun.