Follow TV Tropes

Following

Is C++ easy to understand

Go To

blueharp Since: Dec, 1969
#26: Jun 1st 2011 at 3:44:56 PM

So it has nothing to do with Coffee, or the Indonesian Island that is West of Krakatoa?

storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#27: Jun 1st 2011 at 3:45:29 PM

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 Play
feotakahari Fuzzy Orange Doomsayer from Looking out at the city Since: Sep, 2009
Fuzzy Orange Doomsayer
#28: Jun 1st 2011 at 3:46:12 PM

I tend to dislike learning Java before C++ because it is important to understand memory management. The difference between good programmers and bad programmers isn't usually experience but understanding memory. Don't get memory, you usually write crappy programs no matter if you have two decades of experience or six months of experience.

I'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. surprised

That's Feo . . . He's a disgusting, mysoginistic, paedophilic asshat who moonlights as a shitty writer—Something Awful
Tzetze DUMB from a converted church in Venice, Italy Since: Jan, 2001
DUMB
#29: Jun 1st 2011 at 3:46:47 PM

You 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.
storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#30: Jun 1st 2011 at 3:48:06 PM

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 Play
breadloaf Since: Oct, 2010
#31: Jun 1st 2011 at 3:53:15 PM

Stuff 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).

Pykrete NOT THE BEES from Viridian Forest Since: Sep, 2009
NOT THE BEES
#32: Jun 1st 2011 at 3:54:13 PM

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

breadloaf Since: Oct, 2010
#33: Jun 1st 2011 at 3:55:03 PM

I remember someone hilariously tried to use Java for a hardware controller. Needless to say, the idea failed fairly quickly.

Yej See ALL the stars! from <0,1i> Since: Mar, 2010
See ALL the stars!
#34: Jun 1st 2011 at 3:55:08 PM

[up][up][up][up] Java doesn't have const?

edited 1st Jun '11 3:55:30 PM by Yej

Da Rules excuse all the inaccuracy in the world. Listen to them, not me.
breadloaf Since: Oct, 2010
#35: Jun 1st 2011 at 3:55:34 PM

What are you, troll man, master of the trolls?

Yej See ALL the stars! from <0,1i> Since: Mar, 2010
See ALL the stars!
#36: Jun 1st 2011 at 3:55:58 PM

I don't know Java.

Da Rules excuse all the inaccuracy in the world. Listen to them, not me.
Linhasxoc Since: Jun, 2009 Relationship Status: With my statistically significant other
#37: Jun 1st 2011 at 3:57:22 PM

I still don't understand how people get by without operator overloading.
And personally, I have never understood why everyone says it's such a great feature. There have been incredibly few instances where operator overloading would be useful in something I'm working on, and most of those could easily be handled by a normal method.

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.

[up] 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

Tzetze DUMB from a converted church in Venice, Italy Since: Jan, 2001
DUMB
#38: Jun 1st 2011 at 3:59:27 PM

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.
storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#39: Jun 1st 2011 at 4:04:19 PM

^^ 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 Play
Pykrete NOT THE BEES from Viridian Forest Since: Sep, 2009
NOT THE BEES
#40: Jun 1st 2011 at 4:08:10 PM

Not 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.

storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#41: Jun 1st 2011 at 4:12:36 PM

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 Play
Linhasxoc Since: Jun, 2009 Relationship Status: With my statistically significant other
#42: Jun 1st 2011 at 4:21:57 PM

I 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.

storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#43: Jun 1st 2011 at 4:23:42 PM

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 Play
TrapperZoid Since: Dec, 2009
#44: Jun 1st 2011 at 4:32:21 PM

I hate operator overloading, because I prefer my function calls to look like function calls rather than disguising them as something they're not.

Tzetze DUMB from a converted church in Venice, Italy Since: Jan, 2001
DUMB
#45: Jun 1st 2011 at 4:34:19 PM

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.
storyyeller More like giant cherries from Appleloosa Since: Jan, 2001 Relationship Status: RelationshipOutOfBoundsException: 1
More like giant cherries
#46: Jun 1st 2011 at 4:35:16 PM

^^ 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 Play
TrapperZoid Since: Dec, 2009
#47: Jun 1st 2011 at 4:51:18 PM

[up][up] It'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.

[up] I don't, at least for my own stuff. smile (Although I haven't written C++ code in a while...)

edited 1st Jun '11 4:52:09 PM by TrapperZoid

SavageHeathen Pro-Freedom Fanatic from Somewhere Since: Feb, 2011
Pro-Freedom Fanatic
#48: Jun 1st 2011 at 4:55:02 PM

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.
Tzetze DUMB from a converted church in Venice, Italy Since: Jan, 2001
DUMB
#49: Jun 1st 2011 at 4:58:24 PM

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.
SavageHeathen Pro-Freedom Fanatic from Somewhere Since: Feb, 2011
Pro-Freedom Fanatic
#50: Jun 1st 2011 at 5:01:40 PM

You exist because we allow it and you will end because we demand it.

Total posts: 205
Top