Author Topic: "Stop Teaching C" - Kate Gregory  (Read 29977 times)

0 Members and 1 Guest are viewing this topic.

Online legacy

  • Super Contributor
  • ***
  • Posts: 4348
  • Country: ch
"Stop Teaching C" - Kate Gregory
« on: October 30, 2016, 11:33:16 pm »


Kate Gregory explains her reasons in this funny video  :-+
 

Offline dave_k

  • Frequent Contributor
  • **
  • Posts: 265
  • Country: au
Re: "Stop Teaching C" - Kate Gregory
« Reply #1 on: October 31, 2016, 12:53:39 am »
.. and it's for sale? Or you want to swap it for a tin of striped paint?  :-DD
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 18013
  • Country: nl
    • NCT Developments
Re: "Stop Teaching C" - Kate Gregory
« Reply #2 on: October 31, 2016, 01:07:13 am »
Maybe Legacy figured out tggzzz isn't browsing this section and wanted to hide this lecture  :popcorn:

IMHO this thread should be moved though and I think the lecture has some very valid points on how to use C++ to create robust programs and leave the bad things of C out.
« Last Edit: October 31, 2016, 01:22:10 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 9403
  • Country: au
Re: "Stop Teaching C" - Kate Gregory
« Reply #3 on: October 31, 2016, 01:53:16 am »
Yes.  Move it.  This is the wrong place.


As for the content - I must applaud it wholeheartedly.

Teaching new people the old ways - and then having to un-learn a lot of that to be able to learn the better way of doing things is demonstrably idiotic - but it happens through laziness and complacency... and, all too often, through the lack of support by the establishment to retire the archaic tools they were brought up on.

There was one line near the start that I found as rather profound - and a key element of learning

"You can focus on whatever you want to focus on - whether it's "If"s or loops or something... the fact that there's a string class for them is a minor miracle to those of us who started learning in the 80's.  It's not a minor miracle to the people you are teaching today - it's just how the world is."

This is why the kids of today grow up using the technology as they do.  They don't need to understand the history; they don't need to understand the engineering to get to make the technology do something useful - and they can get pretty advanced in the utilisation without it.  Certainly, there will be a point where some individuals will take things further and some of this obscure information may be necessary, but not for 80% of those who want to get into it - at least not in the first day or two!
« Last Edit: October 31, 2016, 02:19:39 am by Brumby »
 

Offline DimitriP

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: us
  • "Best practices" are best not practiced.© Dimitri
Re: "Stop Teaching C" - Kate Gregory
« Reply #4 on: October 31, 2016, 02:43:02 am »
Yes.  Move it.  This is the wrong place.


As for the content - I must applaud it wholeheartedly.

Teaching new people the old ways - and then having to un-learn a lot of that to be able to learn the better way of doing things is demonstrably idiotic - but it happens through laziness and complacency... and, all too often, through the lack of support by the establishment to retire the archaic tools they were brought up on.

In some cases a one trick pony is better than a jack of all trades. But not in most.
Eventually people gravitate to sowemewhere in between. A few tricks pony or a jack of most trades , master of some.
Deciding what should be considered for retirement as archaic, would make a great PhD thesis, getting a concensus and applying it in real life would be a different story.

Most of the annoying/long running/recurring threads "here" are mostly because of lack of basic fundamental "archaic" knowledge or skills.

 


   If three 100  Ohm resistors are connected in parallel, and in series with a 200 Ohm resistor, how many resistors do you have? 
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2009
  • Country: au
Re: "Stop Teaching C" - Kate Gregory
« Reply #5 on: October 31, 2016, 03:07:22 am »
The crux of the story can be summarised into one short paragraph, as it is in most C++ books, and easily undersood...
It takes a c++ devotee to drag it out to an hour, not unlike a lot of c++ code >:D  :box:
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2528
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
"Stop Teaching C" - Kate Gregory
« Reply #6 on: October 31, 2016, 05:43:45 am »
Yes.  Move it.  This is the wrong place.


As for the content - I must applaud it wholeheartedly.

Teaching new people the old ways - and then having to un-learn a lot of that to be able to learn the better way of doing things is demonstrably idiotic - but it happens through laziness and complacency... and, all too often, through the lack of support by the establishment to retire the archaic tools they were brought up on.

In some cases a one trick pony is better than a jack of all trades. But not in most.
Eventually people gravitate to sowemewhere in between. A few tricks pony or a jack of most trades , master of some.
Deciding what should be considered for retirement as archaic, would make a great PhD thesis, getting a concensus and applying it in real life would be a different story.

Most of the annoying/long running/recurring threads "here" are mostly because of lack of basic fundamental "archaic" knowledge or skills.

Fun Fact: Most people quote the "Jack of All Trades, Master of None" part of the saying, but invariably leave out the ending...

"Jack of All Trades, Master of None, but surely better than a Master of Some."
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9209
  • Country: my
  • reassessing directives...
Re: "Stop Teaching C" - Kate Gregory
« Reply #7 on: October 31, 2016, 05:59:27 am »
i dont read it but i kinda agree with the topic. reusable functions "only" procedure as in C is obsolete. what we need is reusable object and of course still reusable functions. i cannot distinguish a pure C code since when i learnt C/C++, C++ was already there, so terms like "extern C" is pure nonsense to me. they should teach C++ first, and then if necessary C just for additional knowledge, or limited resources platform like embedded mcu.

if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 9403
  • Country: au
Re: "Stop Teaching C" - Kate Gregory
« Reply #8 on: October 31, 2016, 06:16:48 am »
they should teach C++ first, and then if necessary C just for additional knowledge, or limited resources platform like embedded mcu.

I think Kate Gregory might agree with you.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9209
  • Country: my
  • reassessing directives...
Re: "Stop Teaching C" - Kate Gregory
« Reply #9 on: October 31, 2016, 07:33:09 am »
they should teach C++ first, and then if necessary C just for additional knowledge, or limited resources platform like embedded mcu.
I think Kate Gregory might agree with you.
btw i think learning C++ is also learning C at the same time, its just C is subset of C++, and C++ is superset of C. so when we learn C++, all is not lost in C, except some subtleties specific to C calling convention important when you want to interface with older/external codes/binaries.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline blueskull

  • Supporter
  • ****
  • Posts: 12479
  • Country: cn
  • Power Electronics Guy
Re: "Stop Teaching C" - Kate Gregory
« Reply #10 on: October 31, 2016, 07:40:13 am »
i dont read it but i kinda agree with the topic. reusable functions "only" procedure as in C is obsolete. what we need is reusable object and of course still reusable functions. i cannot distinguish a pure C code since when i learnt C/C++, C++ was already there, so terms like "extern C" is pure nonsense to me. they should teach C++ first, and then if necessary C just for additional knowledge, or limited resources platform like embedded mcu.

extern C tells the linker to find library in C calling convention, which is standardized. C++ calling convention is not, so MSVC's output may not be linkable with GCC's object file.
Using extern C allows the linker to forget about overload and only search for a single function prototype which fits exactly the name.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9209
  • Country: my
  • reassessing directives...
Re: "Stop Teaching C" - Kate Gregory
« Reply #11 on: October 31, 2016, 07:47:48 am »
Fun Fact: Most people quote the "Jack of All Trades, Master of None" part of the saying, but invariably leave out the ending...
"Jack of All Trades, Master of None, but surely better than a Master of Some."
why people ruling out the possibility of "Jack of All Trades, Master of Everything"? dont tell me what i cant do! :P

extern C tells the linker to find library in C calling convention, which is standardized.
yeah i mean if you are building your app from scratch, there is no reason for you to make an archaic convention for new functions anymore. hence there should be no need for "extern C". except for some specific, diminishing and subjected to extinction reasons mentioned above.
« Last Edit: October 31, 2016, 07:51:54 am by Mechatrommer »
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline DimitriP

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: us
  • "Best practices" are best not practiced.© Dimitri
Re: "Stop Teaching C" - Kate Gregory
« Reply #12 on: October 31, 2016, 07:52:46 am »
Fun Fact: Most people quote the "Jack of All Trades, Master of None" part of the saying, but invariably leave out the ending...
"Jack of All Trades, Master of None, but surely better than a Master of Some."
why people ruling out the possibility of "Jack of All Trades, Master of Everything" dont tell me what i cant do! :P


Anarchy!!! How can quarterly earnings be possibly predicted when too many people have this kind of attitude ?  ;)
   If three 100  Ohm resistors are connected in parallel, and in series with a 200 Ohm resistor, how many resistors do you have? 
 

Offline blueskull

  • Supporter
  • ****
  • Posts: 12479
  • Country: cn
  • Power Electronics Guy
Re: "Stop Teaching C" - Kate Gregory
« Reply #13 on: October 31, 2016, 08:00:01 am »
yeah i mean if you are building your app from scratch, there is no reason for you to make an archaic convention for new functions anymore. hence there should be no need for "extern C". except for some specific, diminishing and subjected to extinction reasons mentioned above.

With the standardized calling convention, I can write my GUI in C++ form MSVC, then link some C libraries compiled with a different vendor's compiler, such as OpenACC compiler pgcc, or icc, or gcc.
Had I wrote my library in C++, I have to stick with a compatible compiler.
Also, due to minor differences of runtime functions, a C++ object file may not statically link correctly to object files compiled with different version of the same compiler or a different compiler using same calling convention. In C, none of these issues exist.
Finally, I have to include a several MB runtime library for my C++ programs, while many C compilers depend on no DLL files except for msvcrt.dll and common Win32 dll files.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9209
  • Country: my
  • reassessing directives...
Re: "Stop Teaching C" - Kate Gregory
« Reply #14 on: October 31, 2016, 08:05:26 am »
Fun Fact: Most people quote the "Jack of All Trades, Master of None" part of the saying, but invariably leave out the ending...
"Jack of All Trades, Master of None, but surely better than a Master of Some."
why people ruling out the possibility of "Jack of All Trades, Master of Everything" dont tell me what i cant do! :P
Anarchy!!! How can quarterly earnings be possibly predicted when too many people have this kind of attitude ?  ;)
i'm not sure what you mean, but what i understand is why people who spend to much things on a particular timeframe can be the same as a person who spend on one particular thing on that same particular time frame? right? well my answer is because that "speciallized" person who spent on one particular thing to become a master could waste alot of time in the process in clubbing, beering and partying, the jack of all trades could be not.

Finally, I have to include a several MB runtime library for my C++ programs, while many C compilers depend on no DLL files except for msvcrt.dll and common Win32 dll files.
mee too, but its (calling convention) handled by macro nowadays, and i will avoid nasty call like passing the whole class to a dll with hope that the pointer who take it whatever data type it is, will point to the right location, because i'm aware of runtime virtual table.
« Last Edit: October 31, 2016, 08:15:06 am by Mechatrommer »
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline blueskull

  • Supporter
  • ****
  • Posts: 12479
  • Country: cn
  • Power Electronics Guy
Re: "Stop Teaching C" - Kate Gregory
« Reply #15 on: October 31, 2016, 08:14:52 am »
and i will avoid nasty call like passing the whole class to a dll, because i'm aware of runtime virtual table.

Same here. When I have to export a C++ DLL for some reason (for example, a GUI panel in a library to be called by a console program), I statically compile it as a standalone DLL without dependencies and export only functions without classes and declare them as standard calls.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1401
  • Country: 00
Re: "Stop Teaching C" - Kate Gregory
« Reply #16 on: October 31, 2016, 08:17:55 am »
"C++ is a horrible language. It's made more horrible by the fact that a lot
of substandard programmers use it, to the point where it's much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C."

http://harmful.cat-v.org/software/c++/linus

From my personal experience, I tend to agree with this.
I want to believe that there are C++ programmers who really know what they are doing.
I guess I just haven't met them...
The difference between theory and practice is less in theory than
the difference between theory and practice in practice.
Expensive tools cannot compensate for lack of experience.
 
The following users thanked this post: boffin, Ian.M, Bruce Abbott, george.b

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9209
  • Country: my
  • reassessing directives...
Re: "Stop Teaching C" - Kate Gregory
« Reply #17 on: October 31, 2016, 08:22:09 am »
"C++ is a horrible language."
here we go again :palm:
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline setq

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: "Stop Teaching C" - Kate Gregory
« Reply #18 on: October 31, 2016, 08:44:29 am »
C and C++ both have their own problems. Neither is superior to the other. Lisp sucks. ADA sucks. Python sucks. Go sucks. D sucks. This is 50 years of computer science turd shuffling.

We need a new language that reaches down to the hardware and up to the application with some fresh ideas.

But until then everyone needs to STFU with the whining about C and build things with whatever tools you have.
 

Offline blueskull

  • Supporter
  • ****
  • Posts: 12479
  • Country: cn
  • Power Electronics Guy
Re: "Stop Teaching C" - Kate Gregory
« Reply #19 on: October 31, 2016, 08:53:40 am »
But until then everyone needs to STFU with the whining about C and build things with whatever tools you have.

Correct. Till now, our university still offers mandatory C programming for ECE undergrad students, but C++ is not mandatory. In fact, for graduate students, C++ is not offered anymore. Instead, for graduate students we offer Ruby on Rails now.
While being a hobbyist programmer using VB6 and C for more than 15 years and I taught C lab sessions in university, I cannot use C++ except for calling functions in Classes, and I feel C enough for all my needs except for GUI programming, which I use C# or C++.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 10278
  • Country: gb
    • Having fun doing more, with less
Re: "Stop Teaching C" - Kate Gregory
« Reply #20 on: October 31, 2016, 09:32:05 am »
Maybe Legacy figured out tggzzz isn't browsing this section and wanted to hide this lecture  :popcorn:

... which would be mistaken, of course.

I'm certainly not going to waste an hour of my remaining life watching the whole video, but it seems to me she is saying that when teaching beginners (inc 12y year olds!) to use the "high-level" abstractions  in C++, you shouldn't teach C first. That seems pretty sensible.

But most people have figured that if you want to teach "high level" abstractions to beginners in a way they can use them to earn money, there are much better languages to use.

I didn't see (but quite probably missed it in my quick skim), how to teach what people should do when something doesn't work as expected, e.g. a non-standard library or the compiler. The suggestion to use the debugger is, um, optimistic since C++ data in memory is untyped: when you most need a debugger, it can't accurately tell you what's there, let alone how it got there.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline setq

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: "Stop Teaching C" - Kate Gregory
« Reply #21 on: October 31, 2016, 09:51:08 am »
tgzzz - spot on. I rarely use a debugger and only in early dev to debug test cases. It's a crutch that isn't there when you have to take the biggest falls. Most things I get handed are steaming core dumps with no debug symbols. You need to know how to fight these.

I'd rather people started at the bottom and got an idea of assembly and how the CPU works at least roughly, then looked at slightly higher level languages (C), then looked at high level languages (C#/Java) if you need that sort of thing.

As for C vs C++, every place I'd use C++ I could use either Java or plain old C and tend to choose them respectively. C++ lumbers me with abstractions that are historically poorly conceived or memory heavy so I either don't use them and just use C or do use them and might as well use Java and get some higher level OO support. C++ sits in a weird void in the middle full of type, cast, structure and object weirdness.
 

Offline blueskull

  • Supporter
  • ****
  • Posts: 12479
  • Country: cn
  • Power Electronics Guy
Re: "Stop Teaching C" - Kate Gregory
« Reply #22 on: October 31, 2016, 09:59:31 am »
tgzzz - spot on. I rarely use a debugger and only in early dev to debug test cases. It's a crutch that isn't there when you have to take the biggest falls. Most things I get handed are steaming core dumps with no debug symbols. You need to know how to fight these.

I'd rather people started at the bottom and got an idea of assembly and how the CPU works at least roughly, then looked at slightly higher level languages (C), then looked at high level languages (C#/Java) if you need that sort of thing.

As for C vs C++, every place I'd use C++ I could use either Java or plain old C and tend to choose them respectively. C++ lumbers me with abstractions that are historically poorly conceived or memory heavy so I either don't use them and just use C or do use them and might as well use Java and get some higher level OO support. C++ sits in a weird void in the middle full of type, cast, structure and object weirdness.

If you have some weird evil memory access issues that screws up your data structures or pointers, check out valgrind, a powerful memory access sanity and memory leak checking tool.
 

Offline setq

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: "Stop Teaching C" - Kate Gregory
« Reply #23 on: October 31, 2016, 10:10:40 am »
I'm a prolific user of valgrind. Finds all sorts of nasties like use after frees as well.

I wrote my own data type library in C about 15 years ago as well that is quite good in these circumstances. Firstly it is heavily splattered with assert macros to force the fail fast methodology. Secondly, it gives you a to_graphviz() function for each fundamental type that will puke a graphviz file to stderr. Then a shell script that picks these out with cut marks, drops them in tmp and then renders the graphviz when it hits it and throws it in an image viewer. You can step through a program (usually with getc(), no debugger) and see the data structure changes graphically then.

I may tidy it up and stick it on github one day.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 10278
  • Country: gb
    • Having fun doing more, with less
Re: "Stop Teaching C" - Kate Gregory
« Reply #24 on: October 31, 2016, 12:50:11 pm »
As for C vs C++, every place I'd use C++ I could use either Java or plain old C and tend to choose them respectively. C++ lumbers me with abstractions that are historically poorly conceived or memory heavy so I either don't use them and just use C or do use them and might as well use Java and get some higher level OO support. C++ sits in a weird void in the middle full of type, cast, structure and object weirdness.

Yes indeed. I'm reminded, w.r.t. high level abstractions, that C++'s predecessors Smalltalk and Objective-C are an improvement on C++.

C++'s designers chose to take the attitude that "we don't know what's best, so we'll punt difficult decisions to the ordinary developers". The predictable consequence is a range of implementation decisions that significantly reduces the chances that one library/implementation will play nicely with another.

One of the interesting phenomena when Java was introduced was that the papers on it and discussions about it frequently mentioned hard-won experience from other languages. In contrast C++ only mentioned C++ and C, and it was clear that many authors had a very narrow, blinkered view of the world. It is not surprising that they slowly reinvented concepts, poorly.

C has the conceptual integrity of staying close to the silicon, but even then the computer science bods have added a lot of ill-fitting cruft. (Is it possible to "cast away constness" now?)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf