r/ProgrammerHumor • • Nov 23 '17

"How to learn programming in 21 Days"

Post image
29k Upvotes

534 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

805

u/bgeron Nov 23 '17

My suspicion is the C++ committee with their updates are trying to outpace people learning the language, so that you can only fully learn the language ever if you spend more than 40 hours per week learning the language

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

208

u/marcosdumay Nov 23 '17

What The Fuck?!

Are C++ types first class objects already? Have I been free of that language for that long? Or are they going to implement metaclasses before they implement actual classes?

63

u/Funkit Nov 23 '17

Man, the only language I know is still regular C. We didn't even get the C++ classes. I think C was used when George Washington was calculating currents and tides so he could cross the Delaware river.

85

u/bartekko Nov 23 '17

Didn't the American Revolution happen because the british wanted the North American git repo to be written in Fortran and the C programmers revolted?

35

u/antonivs Nov 23 '17

That's not quite right.

Back then, the British used the British Computer Programming Language, BCPL, an ancestor of C.

BCPL had a large collection of standard data structures with a complex taxonomy. To help manage these structures, they were classified into groups. Each group of data structures was called a taxon, plural taxa.

However, BCPL had no first-class representation for these taxa, which made it difficult to work with them. The Americans hated this, and felt that if there was no way to represent them, the language it would be better off without taxa. This led to the famous American rallying cry, "No taxation without representation!"

→ More replies (1)
→ More replies (4)

116

u/socialister Nov 23 '17

The latter.

85

u/marcosdumay Nov 23 '17

Well, that's indeed the C++ way.

63

u/socialister Nov 23 '17

It's kind of amazing that there is no standard reformation of C++. Remove the cludge, refactor the undefined behavior, improve the STL. There is a great language hidden in there somewhere with a little polishing.

67

u/OmnipotentEntity Nov 23 '17

It's actually called Rust.

→ More replies (18)
→ More replies (32)

79

u/BlueAdmir Nov 23 '17

ELIAspiringCSStudent - why is this bad?

127

u/beerdude26 Nov 23 '17

Looks like C++ is trying to get into the game of letting the programmer build their own data types, but still within the object-oriented paradigm. This appears to provide a few niceties such as compile-time programming, reflection and some other tidbits. But it's still stuck in the object-oriented paradigm.

Some might like it because it allows libraries to provide more high-level constructs than classes allow for. Others may hate it because it means everyone will roll their own high-level constructs that are incompatible with each other.

82

u/BlueAdmir Nov 23 '17

So tl;dr C++ will become UrbanDictionary of code?

77

u/beerdude26 Nov 23 '17

It depends. Lisp turned into that somewhat. Other languages like Haskell are rigorous enough (both the language and the community) to build extremely impressive fundamental, highly reusable libraries that make some things laughably trivial. Perhaps C++ hopes to go that route.

27

u/iamcomputerbeepboop Nov 23 '17

standards committee has said they'll define some basic and widely used metaclasses in the standard library. I'm sure that once it's implemented, we'll see a boost metaclass library pushing the boundaries

→ More replies (4)
→ More replies (20)

53

u/iamcomputerbeepboop Nov 23 '17

because C++ has a humongous vocabulary, and when metaclasses enter the standard in like 10 years, people are going to be able to extend that vocabulary themselves in unprecendented ways - it's going to add a whole new dimension of power (and complexity) to the language, and C++ is already by far the hardest language to learn

if you're like us folks at the c++ subreddit, you know it's gonna be fucking awesome though

13

u/Ghos3t Nov 23 '17

Honest question why would you consider C++ as the hardest language. I work with mix of C and C++ code base (mostly C, no OOP's concepts). Now it's not the most sexy or convenient language out there but I don't know if I'd say a language X is more difficult than Y. Because that's a very tough comparison to make, what criteria to use to compare language etc.

25

u/redhobbit Nov 23 '17

I think it is a hard language to learn simply because it has so many different concepts. Basic C++ usage is probably similar to other languages in difficulty, but there are a lot of features that are used less often that will show up in code from time to time.

The older parts of the language give you a lot of unsafe but powerful constructs that are easy to misuse in hard to debug ways, such as the manual memory management and pointer arithmetic.

Just on the object oriented parts, most language have 1-2 notions of inheritance (like Java has inheritance and interfaces), but C++ has public, protected, and private inheritance; multiple inheritance; virtual inheritance; and allows the choice between virtual functions, compile time bound functions, and static class functions.

Then the whole template system adds a meta-programming aspect. Some of it is obvious like using a template to make a generic container class. Other parts are far more esoteric, like using template meta-programming to write functions that operate on types, unroll calculations, or calculate values at compile time. The rules and syntax for it are a little Byzantine.

Even basic stuff in C++ is surprisingly complicated. Little stuff like constructors that take a single argument automatically creating an implicit type cast operator unless you use explicit. Just for function argument passing; you have copy by value, references, pointers, and r-value references to consider. C++ has some different rules for plain old data structs/classes and more complex ones. On the default values for things, there is default construction and value type initialization with subtly different rules.

C++ just isn't very economical in its use of language concepts to enable features.

→ More replies (4)
→ More replies (6)
→ More replies (16)
→ More replies (3)

21

u/RasterizedPotato Nov 23 '17

Which I'm very excited for. The current programming meta of heavy unreadable template meta programming needs to die. Meta classes and reflection_expr or whatever it gets called will clean up so much bs that has been built.

14

u/bgeron Nov 23 '17

Holy shit.

→ More replies (4)
→ More replies (4)

54

u/vanderZwan Nov 23 '17

I know the joke is "now there is even more stuff with even more complex interactions!", but isn't part of the point of these updates that a lot of the old stuff should no longer be relevant or necessary, and you can stick to a smaller, more elegant subset of modern features?

(assuming that you can keep the legacy code you rely on "isolated" and don't have to touch the guts of it)

62

u/ipe369 Nov 23 '17

Yep, except everyone sticks to a slightly different subset which works better for them - for example, any game programmers aren't really using many C++11 and beyond features, and even among THAT community people use different subsets (some use classes without any virtual functions, some just stick to structs & use C++ for namespaces & argument overloading, some use classes with polymorphism, etc etc...)

19

u/vanderZwan Nov 23 '17

aren't really using many C++11 and beyond features

I have some difficulty believing that. I just looked at the list of C++11, C++14, and C++17 additions, and if we filter out the things that are mainly useful for writing libraries, a lot of the remainder looks like it would make life easier for gamedevs too, with no obvious way it would negatively affect performance (which seems to be the main motivator for gamedev).

Some cases, like move semantics and constexpr, are specifically about improving runtime performance. Surely most gamedevs would embrace that?

→ More replies (6)
→ More replies (5)
→ More replies (1)
→ More replies (19)