Though I find inner classes in Java to be pretty confusing. Especially since there's a not of stuff that can only be done with inner classes or similarly complicated constructs.
Blind Final Fantasy 6 Let's PlayI'm learning Java first, and the teacher's telling us not to worry about memory, because for most programming purposes we might as well have infinite memory available.
That's Feo . . . He's a disgusting, mysoginistic, paedophilic asshat who moonlights as a shitty writer—Something AwfulYou need inner classes to pretend you have first-class functions, don't you? In any practical sense.
edited 1st Jun '11 3:47:05 PM by Tzetze
[1] This facsimile operated in part by synAC.Yeah, it really sucks not having stuff like function pointers/objects with () operators. Or references. Or templates. Heck, it seems to me like half the features and patterns in Java are just there to make up for stuff they took out of C++.
Edit: I just remembered an even more ridiculous use of inner classes: to support a notion of constness.
edited 1st Jun '11 3:53:43 PM by storyyeller
Blind Final Fantasy 6 Let's PlayStuff is context sensitive, that's the main reason why I say you can't make blanket statements (like about memory).
So in terms of jobs, C++/Java are your main languages. You know those two, you can pick up most other ones fairly quickly. C, C# and so on, are all the same in the end (in terms of learning program in them, not in terms of what you can do with them).
Memory isn't nearly as much of an issue at starting levels, but once you start getting into applications of decent weight that need to be optimized you need to be really good about keeping memory handled properly. Java garbage collector can only work so hard.
Case in point, my senior project was to port a thing for terrain analysis onto a laptop, which means huge datafiles and a lot of solid computation on a system not designed to handle that scale. Had to pull every trick I knew to get it to run smoothly and not take forever.
edited 1st Jun '11 3:55:40 PM by Pykrete
I remember someone hilariously tried to use Java for a hardware controller. Needless to say, the idea failed fairly quickly.
edited 1st Jun '11 3:55:30 PM by Yej
Da Rules excuse all the inaccuracy in the world. Listen to them, not me.What are you, troll man, master of the trolls?
I don't know Java.
Da Rules excuse all the inaccuracy in the world. Listen to them, not me.But yet again, I program mostly in C (where this isn't even an issue) and Objective-C, which has its own interesting features that I love but others probably wonder about.
Java doesn't have const, but it has final, which does the exact same thing.
edited 1st Jun '11 3:58:19 PM by Linhasxoc
Operator overloading is just a syntactic convenience, and I'm not even sure where it would come up if you had primitive vector/matrix/tensor (or more exotic junk, like Steele's presentation) types, not that Java does.
[1] This facsimile operated in part by synAC.^^ Except that final isn't the same thing at all, since it applies to the pointer, not the actual object. Though I guess the real problem here is a lack of references.
Also, operator overloading is syntactic sugar. It's entirely possible to write code like A.Assign(Add(B, C)); instead of A = B + C; but it's just not as nice to read.
edited 1st Jun '11 4:07:02 PM by storyyeller
Blind Final Fantasy 6 Let's PlayNot to mention most overloaded functions just call the other overloaded functions with slightly different arguments >_>
Java final is a bit bigger than C const, but for purposes you'll be seeing for the first long while yeah they're basically the same thing.
They're not the same thing at all.
class Foo { int i; void Set(int x) { i = x; } int Get() const { return i++; //Compile Error } }; class Foo { int i; void Set(int x) { i = x; } final int Get() { return i++; //Oops! } }
edited 1st Jun '11 4:14:44 PM by storyyeller
Blind Final Fantasy 6 Let's PlayI could be weird here, but I honestly don't see the need for a construct such as that, since good practices should prevent the need for that sort of thing.
Const correctness helps to catch a surprising number of mistakes at compile time. You don't have to use it, but it's definitely useful. It also makes code slightly easier to understand since a const method usually signals that a method won't modify the object.
It's a lot more useful when you have references though.
edited 1st Jun '11 4:26:52 PM by storyyeller
Blind Final Fantasy 6 Let's PlayI hate operator overloading, because I prefer my function calls to look like function calls rather than disguising them as something they're not.
Or you could just consider arithmetic operations/other syntactic workarounds as (probably inlined) function calls.
edited 1st Jun '11 4:34:32 PM by Tzetze
[1] This facsimile operated in part by synAC.^^ Well then you don't have to use them.
edited 1st Jun '11 4:35:39 PM by storyyeller
Blind Final Fantasy 6 Let's PlayIt's not the same. Without overloading, operators are part of the language specification and mean the same thing in every program. With overloading, those symbols could do anything. The only cases where they make sense to me is implementing types that work like the basic ones (i.e. MySpecialInt stuff), and maybe the ubiquitous complex number class that everyone uses in the example. Otherwise I've found they cause me more pain than their usefulness.
I don't, at least for my own stuff. (Although I haven't written C++ code in a while...)
edited 1st Jun '11 4:52:09 PM by TrapperZoid
Operator overloading is syntactic sugar... As long as it's used consistently across the board :P.
Method and constructor overloading, on the other hand... is vital.
You exist because we allow it and you will end because we demand it.I don't think anybody would define + to mean something that isn't addition... oh wait, we have it for string concatenation, and the C++ standard library using bitshift operators for i/o, so nevermind. -_-
[1] This facsimile operated in part by synAC.- for string concatenation actually makes some sense... From a Certain Point of View. After all, you add a string at the end of another.
So it has nothing to do with Coffee, or the Indonesian Island that is West of Krakatoa?