lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Apr 25, 2017 at 10:38 AM, Gé Weijers <ge@weijers.org> wrote:
>
>
> On Mon, Apr 24, 2017 at 6:33 AM, steve donovan <steve.j.donovan@gmail.com>
> wrote:
>>
>> As for C, I still maintain that C++ is easier to learn - sensible
>> strings, nice containers to put things, etc - until you misplace some
>> punctuation and the compiler shares its confusion with you. Can always
>> drop down to C-level, but C is premature optimization, unless you
>> really have a dinky little micro with 4K RAM.
>>
>
> Writing good idiomatic modern C++ requires a lot of knowledge about
> templates, iterators, smart pointers, exception safety, lambda expressions,
> and lots more. It takes a long time before you're a proficient C++
> programmer. Using it as a first teaching language may be cruel and unusual
> education :-)
>
> Coding in C (and C++, probably) should be part of a CS curriculum, but I
> would suggest teaching the main concepts using something a bit more
> high-level.

"Good idiomatic modern C++" != "good didactic C++". The stuff you're
talking about is a complete non-issue for a beginning programmer.

Templates: You don't need to know how to WRITE templates in order to
USE them. Beginners should be getting vector<> instead of arrays.

Iterators: Beginners will be using integer-indexed loops. Iterators
can be introduced later when non-random-access containers show up.

Smart pointers: Smart pointers are beautiful things, but
beginner-level C++ won't be doing the kinds of memory management that
needs it. This is going to come AFTER iterators, probably.

Exception safety: Beginner C++ programmers are going to want to let
exceptions crash the program. Writing exception-safe code can be
introduced when it becomes necessary, which isn't going to happen
until you get to file I/O.

Lambda expressions: Beginners will learn them idiomatically in the
context of sorting a container. They won't get complicated until they
start closing over references.

You're right that learning C++ to a level that you can write
enterprise-grade software is a long and arduous education, but that
doesn't mean that you have to jump in with both feet.

/s/ Adam