Promoting C++11 and the STL

Pages: 123
Well, think of it this way. No, you don't go into calculus and study pre-calc, because it's presumed that when you study calculus, you've already studied pre-calc. But you don't go into calculus and immediately learn multivariate transformations. You start with simple functions.

Of course they shouldn't only teach you C, but IMO they should teach the fundamentals first. That's why it's called "fundamentals". It comes from the Latin word for foundation.
What was the point of this? Nobody said "hey let's just have beginners on a random forum teach C++ classes".

You had said the worst teachers of C++ are college professors. I had replied with a teacher worse than the average college professor - a beginner. Those learning from this teacher clearly do not know they are learning from someone ignorant of the language. But you are right, I doubt anyone has every said that.
Last edited on
I actually have not taken a course in C++. My intro class started in C and then went to Java.

Still, my observation has been that instructors purposefully try to limit how much information they give per lecture. It is for a good reason they do this. It comes down to not overwhelming the core of the class with information. They have a strategy to teach you the most important stuff as effectively as possible in a given time frame.

This is why the best Universities (like MIT) use languages like python for intro classes. They don't want to need to worry about going over specific stuff like what is size_t. They want to make you into a good programmer who can learn, and be proficient in, any language.

Last edited on
I don't think C is a prerequisite to C++, learning Java is as helpful or any other C based language. Even memory management is different in C as it is in C++ so why learn mallocs when you're just gonna use new anyway? sure its good to know these things but C++ can be used in such a high level way that knowledge of C is not needed. Now thats not to say learning C isn't good. It is and I have the basics of C that if I ever need to do a C program I can transfer my C++ skills pretty easily. But when I see professors teaching students char* instead of std::string it just angers me because they are learning C++ not C for godsake. Use what the language gives you to your advantage. Good habits in C are not necessarily good habits in C++ and vice versa so why teach them? thats just my opinion though.
I wrote:
And the C v C++ style is BS as well.
Catfish3 wrote:
What do you mean, is BS?

Okay what I mean is, Procedural C++ is just that...Procedural C++. It is not C. If you want to learn C++, learn it how it relates to the paradigms that it supports. Don't throw out a large portion of what the language can do because you are misguided enough to thing that C++ should only be Object oriented or that skills in procedural programming are old school.

C is C and C++ isn't. Learn C is not a good way to learn procedural C++.
When I hear "C vs C++ vs C++11", the first thing that comes to mind is "malloc vs new/delete vs smart pointers" and "calloc vs new[] /delete[] vs std::array".

Language paradigms hold no bearing on "deprecated" technologies...

"deprecated" isn't quite the correct term in hindsight...
Last edited on
@Luc Lieber I'm not suggesting you are, I'm just curious but are you saying that C is a deprecated technology?
Deprecated really isn't the right term as I've stated...it's quite a touchy subject, but in my opinion, when one is writing modern C++, certain artifacts of C should not remain, calloc / malloc / c-strings being the most obvious exclusions, except when optimization is both required and proven after the fact.

In other words, if someone wants to use C, use C. If someone wants to use C++11, why mix in dangerous C artifacts for no apparent reason?

Damn it, now I'm calling C dangerous...I'm starting to sound like a java programmer.
Last edited on
"deprecated" technologies... 0_o

missed an update
Last edited on
Oh I agree when it comes to C++ using cstrings and malloc and such is not useful but C the language is not and never will be deprecated. Keep C specific stuff for C is my opinion and in certain circumstances its good to use C specific stuff for C++ but I agree with you more or less that stuff like that shouldn't be really used in C++.

Don't teach the C subset of the language.

For many students, they are learning how to program. C++ is just a tool. It's more important for them to learn the ideas behind programming first before they can be taught the intricacies of a language.

Don't worry about the return type, 'size_t' -- you can think of it as 'int'.

We can't just go off on tangents everytime we introduce a new function. It's more important for the student to know what functions are out than it is to than to discuss the specifics of typedef'd return types.

These courses are introductions only. Overloading beginners with the nitty gritty language intricacies unnecessarily distracts them from learning the core concepts of generic programming which is the aim of these beginner courses.
Last edited on
^^^
That being said, I like the idea of promoting the C++ standard library. At work, we use a C/C++ mix and I know surprisingly few people that have ever pulled anything out of std:: or any other namespace. char* seems to be king which makes me shudder.
closed account (iw0XoG1T)
I don't really understand some of the points being made.

oop is a paradigm, and procedural programming is also a paradigm; they are both just abstract ideas used to model a program.

So how is using an array instead of a vector, char* instead of string make one program oop and another procedural? My point is that the tools you use do not make your program oop or procedural it is how you solve the problem that makes it oop or procedural.

If I am wrong please correct me-- I would appreciate it ( This is a sincere statement).

Last edited on
Well I think its more to do with how you use the language and its tools, string is a class of its own so if you're doing C++ why not use the string class instead of using char*, I see it loads where people are being taught C++ and the lecturer makes them use char* instead of string, for what reason I do not know.
closed account (iw0XoG1T)
I see it loads where people are being taught C++ and the lecturer makes them use char* instead of string


I imagine that the reason is the lecturer is not a C++ programmer and they want to limit the students to what they are familiar with. I have seen this discussed before and the response is "we are teaching how to program, not how to program in C++".
Last edited on
Its not a good enough excuse though, you can teach someone how to program with std::string too, why not teach both and let the programmer decide which s/he prefers. There's no reason you should limit someone to just char* and not std::string, now if someone can tell me if there is a good reason I'd listen but for me for what I know there is no good reason.
closed account (o1vk4iN6)
let the programmer decide which s/he prefers


It's not about preference, it's about functionality. What do you think you are using when you use a string literal ?
I'm using a dynamically allocated string object as opposed to a stack initialised scalar char array, now I could be wrong and please tell me if I am.
What do you think you are using when you use a string literal ?


An argument to a string constructor?
We can't just go off on tangents everytime we introduce a new function.


No need for a tangent, just tell it as it is. Comparing apples to apples is a one-time, fits-all lesson.

College Professor wrote:
Don't worry about the return type, 'size_t' -- you can think of it as 'int'.


I wrote:
'size_t' is an unsigned integral data type that is defined in the <cstring> header. It may vary between platforms, and because of that, it's important not to compare 'size_t' to 'int', as there is no hard guarantee that the two data types are the same.

If you don't know what 'unsigned', 'integral', or 'platform' means, or are confused about the term 'data type', then I urge you to look over your notes from past courses dealing with the fundamentals of computer programming.


I can't think of a platform where 'size_t' can be safely compared to 'int', perhaps 'unsigned int', but even then there is no guarantee.

1
2
3
4
// my platform
int x = -1
size_t y = 4294967295;
x == y


I probably get worked up over this too much, but it's just so aggravating that this stuff is blatantly wrong and is still being casually taught to new students...
Last edited on
Pages: 123