Thomas Hruska wrote:
>  
>
> Christopher Coale wrote:
> > Thomas Hruska wrote:
> >> I'm probably the most guilty party here. My view is that pointers are
> >> an _advanced topic_. It doesn't mean you shouldn't learn how to use
> >> them nor use them at all.
> >>
> >
> > I'm moreso referring to this question by Paul Herring, "Why are you
> > using pointers in C++?" That seems to imply that we should not use
> > pointers in C++. I agree with you that pointers should not be taught
> > right away, and most formal curricula do not teach it right away (in
> > fact, you'll probably go at least half a semester before reaching them).
>
> Because exposed pointers at the Application layer almost always shows a
> lack of understanding of what templates and classes are for.
>

I don't see the connection. Can you not have a pointer based on a 
template? Can you not have an object-pointer?

>
> > In a formal curriculum, C++ is not the first language you take.
> > Generally you start with "Computer Logic" (which is an introduction 
> to a
> > language like Java, VB.net, etc.), followed by C/pascal, then C++. So
> > generally, all they need to do is carry over the same logic but 
> adapt to
> > the C syntax (which is really just memorization, the logic is the 
> same).
> > They won't be "learning" basic code structures, but rather learning the
> > C++ syntax and how to adapt their logic to it. But if you are talking
> > about simple tutorials to learn C++, then I agree.
>
> You must be living in a completely different world from the one I live
> in.
>
Well that is for damn sure. If you started with C++ at school, then you 
went to a horrible school. I am a paid tutor at my college and see how 
well it works when you teach the student logic prior to teaching them a 
low-level language. And even beyond that, teaching them C before 
teaching them C++ (which is debatable and besides the point of this 
topic). So, you must be living in a different world than I.

> Most educational institutions I'm aware of that teach C/C++ start
> with C/C++ with _optional_ starter courses in another language.
>

Rarely will you see a C/C++ course without prerequisites in a logic 
course, introduction to computer science course, etc. So, as I said 
before, if they throw you into C++ then either it is a terrible 
school/curriculum.

>
> >> C++ makes it possible to defer teaching pointers until MUCH later on.
> >>
> > I agree.
> >
> > So here is my conclusion: you should *not* avoid pointers in C++. If
> > they consistently cause your program to develop memory leaks and
> > crashes, then you need to go back and re-learn how pointers work. I
> > agree that pointers should not be taught too early when learning C++
> > (and they usually aren't in a formal curriculum).
>
> By "much later on", I mean several years, not half a semester.
>

I dare you to mention that to any real computer science/engineering 
professor. The problem doesn't lie within the difficulty of pointers - 
it lies in the student's lack of understanding of how the computer 
actually works (hence leading to not actually understanding what a 
pointer is).

>
> And I am extremely well-versed in pointers. They may be useful but are
> advanced and dangerous. Improper use causes crash bugs, memory leaks,
> memory corruption, _security vulnerabilities_, etc.
>

*Improper use*, exactly.

> After watching
> http://nvd.nist.gov/ <http://nvd.nist.gov/> for several months, I 
> became entirely convinced
> that pointers at the Application layer are a VERY bad idea.
>

Code the software properly and you have nothing to worry about. (and I 
am simply talking about pointer-related bugs, not exploitations that can 
happen regardless of pointer usage.)

>   I read that as "programmers can't write stable software to
> save their lives."
>

Therefore, to accommodate the stupid programmer, we should ban the use 
of pointers? Good idea.

> Every major security vulnerability that says "crash"
> or "buffer overflow" or "exploitable memory leak", etc. is caused by a
> programmer mismanaging their pointer logic.
>
Again, notice that you have consistently blamed the programmer. I agree 
entirely.

> And they are mismanaging
> their pointer logic because they don't know how to develop software.
> They don't know how to develop software because they weren't taught how
> to develop software in school.
>
Assuming you are talking about U.S. schools, I agree. I catch this all 
of the time with my students. If I had the power to reform the computer 
science curriculum at my school, believe me, I would. Before teaching a 
programming language, I would want the student to understand how the 
computer actually works. One of my Logic students doesn't even know what 
"RAM" is - they are not properly prepared prior to taking a course like 
C/C++ (I see this *everyday* with my students).

But again, I repeat, this is the *programmer's fault*.

>
> Migrating pointers to a Library layer and then not using pointers at the
> Application layer introduces a level of stability to the Application
> layer not otherwise achieved. Libraries are viewed as reusable code
> that generally stabilize over time. Even within my own Library layer, I
> prefer to migrate pointer use to templates only (specifically, Block and
> BString handle almost everything I need). So, if the same Library is
> used from year to year with enhancements and fixes as the students go
> along, it becomes possible to create incredibly powerful, yet stable
> programs WITHOUT using pointers in the Application layer.
>
I understand, and also agree with you (to an extent). However, pointers 
should not be avoided for that sole purpose. It is illogical to write a 
wrapper around a library simply to avoid using a pointer in your 
"Application layer".

> I'd love to
> see first-year students leveraging files, databases, sockets, and GUIs
> in C++ without having to worry about silly things like pointers, crash
> bugs, memory bounds, etc.
>
I would hate to see first-year students doing any of that in C++. They 
shouldn't be in C++ (unless they have tested out of prerequisite 
courses). What you are doing is dumbing down the language so it suits a 
dumbed down society.

>  I'd rather see students leaving college with solid software
> development practices under their belt than wrestling with the
> unnecessary nuances of pointers and, still not understanding them,
> introducing vulnerable software into the wild.
>

I would love that, too. Perhaps if they had a proper understanding of 
pointers before trying to use them they wouldn't be in that situation. 
Hiding pointers from them no way solves that problem - like I said 
before, you are dumbing down a language to suit a dumbed down society.

> I know you will disagree with me on several (perhaps all) points.
>

Not all of them. ;)

> I see
> C++ as a stagnant language with numerous problems in danger of dying.
>

Sadly, as do I. It is quite frustrating to see this. Too many people are 
switching to languages like C#.

> I
>
> see the future being in mobile devices - and none of the currently
> popular mobile OS platforms host C/C++ as a native compiled language for
> the apps that run on those platforms.
>

I see mobile devices keeping their same market (perhaps expanding, but 
not taking over). C/C++ has its place (for a while, anyways).


[Non-text portions of this message have been removed]

Reply via email to