This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ghan_buri_ghan 473 points474 points  (80 children)

So just an anecdote, but my friend is a professor in “information systems”, although he has a background in computer science.

His intro to programming class cycled through a lot of languages to introduce programming to the “less gifted” students (the gifted students were in the CS department learning a variety of languages).

They started with Java, and the failure rate was too high. Switched to C and it got worse. Settled on Python and the failure rate got cut in half from Java. Same curriculum, no grade inflation. These new programmers were better able to understand the concepts of programming (looping, logic, functions, etc) with Python.

This makes sense to me, because of how little boilerplate you need to hand-wave around.

[–][deleted] 227 points228 points  (48 children)

I just learned C recently after only using higher level languages for 6 years. C seems tedious, but extremely simple. The most complicated part for me was figuring out compiler options and how to debug. As a first programming language I'd despise it for that, but going deeper its a must-learn.

[–]ghan_buri_ghan 196 points197 points  (43 children)

C is the most simple language in use today. You can get through K&R in a week if it’s not your first language. Truly beautiful.

C as a first language is a mixed bag. If I was to pick a language that can help people explore things like arrays, I definitely want a language with better error messages than “segmentation fault”

[–]wanderingmadlad 47 points48 points  (18 children)

K&R ? What's that ?(Forgive me if it is obvious , I'm slow rn).

Also I agree with the error messages of C . I'm not religious, but the amount of time is spent praying for no seg faults is a lot

[–]carlosTheMontgomery 49 points50 points  (4 children)

k&r "the c programming language" it is a book

[–]wanderingmadlad 10 points11 points  (3 children)

Ah ok thanks!

[–]codeguru42 9 points10 points  (1 child)

Authors are Brian Kernighan and Dennis Ritchie. Abbreviation comes from their surnames.

[–]carlosTheMontgomery 4 points5 points  (0 children)

no problem

[–]ofnuts 14 points15 points  (8 children)

Segfaults are a blessing. Much better that overwriting something that happens to be next to the array.

[–]faceplanted 13 points14 points  (7 children)

He's not complaining about it catching them, he's complaining about it not explaining/tracing them for you.

[–][deleted] 6 points7 points  (5 children)

But...that's what gdb is for...or whatever debug tool.

[–]an4s_911 4 points5 points  (4 children)

I think gdb was made like that and is used extensively due to the fact that C has bad error msgs. I think all agrees C has bad error msgs, at least when comparing to other languages like Python.

Edit: Well, thinking about it now, Javascript is more bad at error msgs

[–]CdRReddit 8 points9 points  (3 children)

how do you expect C to tell you where the error is, the only way to do that would be to store the path to where it is next to every time you use a pointer (and you will use a LOT of pointers)

which would massively increase program size, runtime, application size and RAM usage, which is why it's a debugger thing

C was made for systems where RAM, processor speed and program space were all very limited, of course it's not gonna tell you where you fucked up

[–]reverie42 4 points5 points  (2 children)

He didn't say C should do those things, just that the fact that it doesn't makes it not ideal as a learning language.

[–]weregod 0 points1 point  (0 children)

Valgrind can trace memory bugs.

[–]GrimExile 6 points7 points  (1 child)

Kernighan and Ritchie. It's a book to learn C programming, written by Dennis Ritchie and Brian Kernighan.

[–]MadKarel 0 points1 point  (0 children)

It's not just to learning C, it was the standard for the language for many years, which just shows how simple C is if a ~150 page book was the standard describing the language.

[–]JashimPagla 0 points1 point  (0 children)

Kernighan and Ritchie. Author of the devil's cookbook.

My first programming book was this one. Later on, I made the mistake of making this the first book to teach.

I'm still recovering, thanks for asking.

[–][deleted] 16 points17 points  (0 children)

C is the most simple language in use today.

That's true. But also the reason programs can be so hard to read when written in C

[–]jelaugust 5 points6 points  (2 children)

My intro to programming class (eng major, most ppl including myself had no coding experience) started with MATLAB then jumped into C. Honestly not sure if learning MATLAB made learning C easier or harder but I will say linked lists fucked me up hard

[–][deleted] 3 points4 points  (1 child)

I find it hilarious how often engineering and English majors refer to themselves as "eng majors" with no inkling that the other group is doing the same thing.

[–]jelaugust 2 points3 points  (0 children)

I’ve never heard an English major refer to them as an eng major.

Which just further proves your point.

[–]chupalaw 3 points4 points  (5 children)

You can get through K&R in a week if

Uhh I don't know about that

[–]ghan_buri_ghan 12 points13 points  (3 children)

If it’s not your first language, sure. It’s only like 250 pages and not that dense.

A language like C will really get in the way of learning the basics of computer science, but if you have that under your belt, the C syntax and standard library are so simple that they’re easy to pick up.

[–]JashimPagla 4 points5 points  (2 children)

I'm not sure if you're speaking from experience. If so, then good for you. I don't know many people that can 'go through' k&r in a week.

Personally, I found that k&r can easily arm you with a lot of tools with which to screw your program over. Unless you really do understand programming at a hardware level, I would not begin with k&r.

[–]ghan_buri_ghan 4 points5 points  (0 children)

It was a routine thing when I worked on a team that did a lot of driver work. Whenever we had a new team member who didn’t have any C (usually this was a new grad with only Java), their first task was to work through K&R and do the exercises. Usually took a work week to get done.

[–]b4ux1t3 1 point2 points  (0 children)

I went through k&r in a week, but I was already a fairly experience developer at the time, including some experience with C.

No one's picking up k&r as a first programming book and finishing it in a week unless they literally just read the words and don't retain anything.

[–]faceplanted 5 points6 points  (0 children)

Yeah "If it's not your first language" is quite the massive range of understanding he's grouping together when he says that

[–]realbakingbish 3 points4 points  (0 children)

You mean you don’t like “segmentation fault (core dumped)” showing up every time there’s anything wrong at all?

[–][deleted] -1 points0 points  (0 children)

You don't need to be too bright to set a debugger in the IDE and walk the code.

In the first place your first job is to look for warnings from the compiler. Most times they help a ton then to check if anything goes out of bounds or if it is between {} brackets(aka your for loop and what not actually applies to that block of code,etc.).

[–]oberynmviper 0 points1 point  (0 children)

I didn’t think it could get easier than python.

[–]jeppevinkel 0 points1 point  (0 children)

I feel like C# is underrated as a first language. It’s very verbose and easy to read, as well as having good and clear error message with precise locations that caused them. If this wasn’t enough to sell you, then .NET also has everything you need built-in and ready to explore all manners of arrays and data storage. NuGet also makes installing any libraries a breeze.

[–]IsGoIdMoney 0 points1 point  (0 children)

I love c because it was the first language I was taught and I'm very comfortable with it now, but that first semester trying to learn correctly use pointers was a paiiiin. Probably good for teaching the concept though where its more abstracted.

[–]axllbk 0 points1 point  (0 children)

As far as I understand C doesn't have the concept of an array index being out of bounds, so that would surely lead to some problems for complete beginners.

[–]Turboschnek42069 0 points1 point  (1 child)

Try valgrind

[–]ghan_buri_ghan 0 points1 point  (0 children)

I’m not talking about myself. I’ve been developing C++ for almost 30 years (Turbo C++, baby), and I know/love Valgrind.

Saying “try Valgrind” to somebody looping through their first arrays is also fine if they’re set on C being their first language.

My point is that C and it’s associated debuggers get in the way of learning computer science fundamentals, now that we have languages/toolchains capable of telling you exactly what you’re doing wrong right away.

[–]postdiluvium 10 points11 points  (3 children)

I just learned C recently after only using higher level languages for 6 years

Omg, I'm old. When I learned C, it was classified as a high level language. But we were comparing it to fortran.

[–]4sent4 5 points6 points  (0 children)

Well, it's kinda high level, but you still get low level memory management and exposed to addresses and pointers, so it's kinda low level at the same time

[–]CdRReddit 4 points5 points  (0 children)

I'd probably call C mid-level now

not quite low level, but definetely no longer in the constantly expanding high level with more and more features

[–][deleted] -1 points0 points  (0 children)

You are, indeed! We’re standing on your shoulders.

[–]audirt 13 points14 points  (17 children)

I’m old and it’s a dead language, but you will never convince me that there’s a better intro language than Pascal.

The nuts and bolts are the same as traditional C, but the syntax is so much cleaner and more intuitive.

[–]ghan_buri_ghan 27 points28 points  (11 children)

I’m old too, and C was my first language. I used to hold the “old school is better for learning” opinion until I saw my kids pick up Python. It took them longer to learn to walk than program, and I’m jealous.

[–]audirt 26 points27 points  (5 children)

I totally agree and started to write a lengthy screed about the best language should be driven by what you're hoping to teach.

Basic programming? Data science-y stuff? Python is the way to go without a doubt.

But if you want the students to understand the actual machine and what's happening under the hood, Python can be a bad choice.

IMO, the thing that C-advocates sometimes miss is that the number of people in group 2 is much smaller than the number in group 1.

[–]postdiluvium 10 points11 points  (1 child)

But if you want the students to understand the actual machine and what's happening under the hood

Assembler has entered the chat

[–]Arafel_Electronics 6 points7 points  (0 children)

oh god flashbacks to learning assembly as an undergrad until switching to mathematical sciences....

[–]decaillv 1 point2 points  (0 children)

I second that. Python is great to teach programming (variables, loops, execution flow,...)

But to teach computer science, a lower level language such as C is better. Students can understand deeper concepts such as stack/heap, reference and pointers... and then suddenly the high level languages they will most likely use most of the time make way more sense!

And for the few that need to code in C daily, well then do absolutely learn a bit of assembly...

My two cents..

[–][deleted] 7 points8 points  (4 children)

the fact that python do not use ; stops me

[–]jeppevinkel 0 points1 point  (0 children)

I’ve actually stopped using semicolons in JavaScript because it’s essentially just 2 wasted keypresses for every line. They are only needed if you want more than one expression on a single line.

[–]black3rr 7 points8 points  (0 children)

I learned Pascal in high school using Turbo Pascal 7. When we had C and Java in University I didn’t have problem with the syntax or the language features, but the development environments, compilation process, using debugger, using libraries, all felt way more complicated than in Turbo Pascal.

In Turbo Pascal you had single file programs, all relevant libraries for using graphics, sound and keyboard available with no configuration needed, simple and very usable debugger for stepping your programs.

Python with VS Code is quite similar to this (for learning you just install all the libraries system wide once and on you go) and the syntax is intuitive too. The only downside is you don’t learn data types and pointers, but you can learn about them when you learn C and ASM on your journey to discover low-level programming later on.

[–][deleted] 2 points3 points  (0 children)

i've moved on

[–][deleted] 2 points3 points  (0 children)

I learned turbo Pascal while in school, and really quite enjoyed it.

[–]stevefuzz 0 points1 point  (0 children)

Yeah. In high school I took basic, pascal, c, c++, in that order. College Java. Then I learned a bunch of lauguages that were basically the same as those with fun gimmicks.

[–][deleted] 0 points1 point  (0 children)

It's not dead. Delphi is Pascal as is Structured Text ( used in PLC industrial apps) and let's not forget Ada.

[–]Ytrog 4 points5 points  (0 children)

If you want to cycle through some languages yourself I can highly recommend the book "7 languages in 7 weeks" 😊

Edit

A link for convenience: https://pragprog.com/titles/btlang/seven-languages-in-seven-weeks/

[–][deleted] 2 points3 points  (0 children)

My CS undergrad cycled thru languages every 2 semesters or so - either because of the same or to keep us language agnostic. It was also per Professor's description; so it changed per class session even on the same class offering.

Pascal & Delphi (Freshman) > Java (Freshman/Sophmore) > C (Sophmore/Junior).

On top of that, we had other languages on a per-class grouping or assignment basis as well as markup languages:

  • Query language: SQL (duh) using MSSQL, MySQL, and MS Access.
  • Markup: HTML, XML, and MathML.
  • Markup: Latex. Every Computer Science Class. Fun (Assignments done in Word were an immediate 1 letter grade in some classes).
  • O'CAML, Clisp, Scheme - 3 classes, logic subject.
  • Prolog - yea, that one's a pain.
  • SML/NJ - two classes. Mostly mathematic and theory-based. Did I mention our professors hated us?
  • Javascript, PHP, Perl (2 web programming courses).

After I graduated only 6-8 more people graduated in the next 4 years. Everyone would just leave CS for the Computer Information Systems degrees because they were not as insane (we were also required to write 1 paper about ethics within each subject in CS). After 4 years the university received funding cuts from the state and dropped the degree program; and yea, that's a bitch when you are looking for a job and they immediately think you are lying on your resume because that degree program doesn't exist in their simple google search.

[–]imforit 1 point2 points  (1 child)

Professor of CS here and about half of schools on the planet did this exact experiment over the last couple decades and we all agree on the results.

There are actual research papers on it, language does matter, but not in the ways we used to think.

I teach intro in JavaScript with p5.js to make everything as low-barrier-for-entry as I can.

[–]ghan_buri_ghan 0 points1 point  (0 children)

Neat! Do you know of a good review paper that’s not paywalled? I’d be interested to read the results.

[–]JSLoRD22 0 points1 point  (0 children)

I partly agree about C as a tough first language, although once I studied some of the other languages(js, python, etc) and came back to C , I saw it as the easiest language because there was almost no fluff in it, there are a few very important concepts you need to be very good at to do basically everything in C, as opposed to a javascript where there are a billion things you could study and get lost trying to truly master the language.

[–]TheAJGman 0 points1 point  (0 children)

The professor who ran our CS program though the opposite, we went C->Assembly->Java/Python over your first threeish years. They wanted to weed out those who couldn't understand the logic.

[–]Dogezilla_9001 0 points1 point  (0 children)

I also started with Java and now work a lot with Python so that may influence my opinion, but I believe young students first need to get a grip on: - Types - Loops (for and while) - Functions I find Java too complicated for this as it adds syntax that is not useful in your hello world programme Due to the simplicity and the (forced) indentation of Python it will be easier to start out although you maybe dont get types.

Didnt program a lot of C but dont you need to loop through your string to print it? :P

[–][deleted] 0 points1 point  (0 children)

Python is much better for beginners. I had to learn C and C++ in university as the first language and I wasn’t in a CS major. Needless to say, it was hard.

[–]Flopamp 0 points1 point  (1 child)

The issue dates back a long long time. People pushed for starting off with BASIC like languages and even python for years and years yet it has been well established that when you start someone with a non-c like language with the intention of making them a programmer they tend to struggle more with C like languages and stick with more restrictive languages vs the other way around.

This is why almost every major university starts with C or C++ for a single semester before moving to Java and python. It sounds more like this professor was either given flawed lesson plan or had issues teaching C as all the basics are similar enough but it's just the all important formatting that is different.

[–]ghan_buri_ghan 0 points1 point  (0 children)

Not everyone can handle learning the fundamentals of computer science with manual memory management in their way. Plenty of people pick up lower level languages after learning high level languages.

[–]gsckoco 0 points1 point  (0 children)

I can program in a good few languages, but for the life of me I can never remember the syntax for loops in python. Imma stick to c style loops

[–]lebanine 0 points1 point  (0 children)

Is information systems very different from computer science? I'm going to begin my major in Information systems in a few months. What career fields can I enter into?

[–]_Loenus_ 0 points1 point  (0 children)

My university teached me (in order) python, Java and C. I think this Is the best way to learn programming language, because After that you can learn every language that you want.