Live data from Hacker News

Getting started with C

not.cafe

61–70 of 106 posts

Re: Getting started with C

#61
I understand the motive to let readers get up and running quick, getting some graphical window instead of terminal black box, but if you think users want to avoid terminals and get to graphics, why spend a chunk of the article talking about it? Just when readers starting to like the terminal and the culture, the author goes "anyway, terminal sucks, let's get a graphic window! here's 100 lines of code you'll never understand"

I don't understand the bloat of introdocing gtk, meson and ninja, more deps means more code, more code means more bugs, more steps and more difficult to compile, I'm sure a lot of people will fail to compile this, which is very frustration for beginners who're not familiar with error messages. You might think meson and ninja makes it easy for building, but that's wrong, that might be true for engineers who build 1000 times a day, not for one off beginner situations like this. Abstractions is for people who understand why the abstraction is needed.

Re: Getting started with C

#62
post #55

Can AI generate a better tutorial? To test my theory, I asked the OpenAI API to complete the following sentence: This tutorial will guide you through writing the "Hello World" program in the C programming language. And here's the result: This tutorial will guide you through writing the "Hello World" program in the C programming language. Hello World Program Structure The "Hello World" program is a very simple program…

I want to believe this is real.

Re: Getting started with C

#63
I'd recommend An Introduction to C & GUI Programming by Simon Long[0] instead. It's much more beginner friendly and is very well written. Doesn't go super in depth but it's a quick intro book so it shouldn't. Plus it's a book and it's cheap/free;

[0] https://magpi.raspberrypi.org/books/c-gui-programming

Re: Getting started with C

#64
It is funny if this was not intended as funny. An instance of "now draw the rest of the owl" meme. I can see the need to teach a bit of the surroundings of C, but it ended up having very little to do with C.

Re: Getting started with C

#65
post #11
post #5

Earlier quoted context omitted.

I would be really interested in a course that actually holds true to the premise in the title here. I know my way around the JVM and python and started learning a little Rust on the side. However, I feel the need to at least dive my toes into C for a couple of weeks for completeness sake. Do you have a recommendation for something that is a little less than a book and a little more than learnCin10minutes?

It kind of depends on what you need out of C. The only real reasons left to use C in the wild are: * Legacy code * Embedded (including drivers, bare metal etc.) * Portability, FFI, etc. Performance used to be another major reason, but in $CURRENT_YEAR, if that's your goal, C++ and Rust are just as performant and there's very little reason not to opt into them. The other major reason to learn C is that it's a great "h…

Strong disagree. Unless you're using it as "C with classes", C++ is a nightmare hell language that you should only use if you're forced to by your environment. Stay far away.

C is a fine language, but it is from the 60s and 70s and feels like it. Rust is very nice, although poor for half-assed prototyping (which is actually maybe a good thing). Both are fine choices for systems-level programming.

Re: Getting started with C

#66
Learned a bit of C, not convinced it had any real benefit besides learning about pointers kinda drives things home for you about passing stuff around by values or reference if you are a self-taught Java / C# developer.

What set me on this path to enlightenement was an e-mail article from Dan Abramov (https://github.com/HackYourFutureBelgium/just-javascript/tre...) - here's an excerpt:

"We will learn about the JavaScript world for what it is — without thinking about how it’s implemented. This is similar to how physicists can talk about properties of stars without answering the question whether the physical world is real. It doesn’t matter! We can still describe it on its own terms.

Our mental model does not attempt to answer questions like “How is a value represented in the computer memory?” The answer changes all the time! In fact, the answer to this question changes even while your program is running. If you heard of a simple explanation about how JavaScript “really” represents numbers, strings, or objects in memory, it is most likely wrong.

To me, each string is a value. Not a “pointer” or a “memory address” — but a value. In my universe, a value is good enough. Don’t allow “memory cells” and other low-level metaphors to distract you from building an accurate high-level mental model of JavaScript. It’s turtles all the way down anyway!

If you’re coming from a lower-level language, set aside your intuitions about “passing by reference”, “allocating on stack”, “copying on write”, and so on. These models of how a computer works often make it harder to be confident what can or cannot happen in a JavaScript program. We’ll look at some of the lower level details, but only where it really matters. They can serve as an addition to our mental model, rather than its foundation.

...

As for these strange visions, I don’t pay as much thought to them anymore. I have wires to point, questions to ask, and functions to call. I better get to it! The stars are bright when I look at them.

Are they still there when I blink? I shrug.

Re: Getting started with C

#67

Earlier quoted context omitted.

Maybe they meant an absolute beginner to C and not programming in general.

I definitely agree that's possible, but then they go over what a terminal is and what the "ls" command means, and how case-sensitivity and using commas in the correct places are important when programming, which strike me as things which would be assumed knowledge if the audience were expected to have any programming experience.

Good point, although a lot of programmers now use an IDE for everything, so they may have no working knowledge of the command line (or a very limited knowledge).

Re: Getting started with C

#68

Earlier quoted context omitted.

:-) I wish people would stop recommending this outdated book, along with a few other default goto books (say, the Dragon book). Its super optimistic approach is more about the language K&R wanted C to be than the real thing.

Maybe there aren't any good alternatives to "read this go to book as the first book on the topic". Prove me wrong. (Please)

If an absolute beginner were to use K&R as a start they'd be learning C from 35 or so years ago. It's well written, but not helpful as a reference. Even something as simple as how a function is organized has changed.

C Programming: a Modern Approach teaches C89 and C99, pointing out the differences in features when appropriate. Having used it myself this year, I found it much more helpful than K&R

Re: Getting started with C

#69
post #5
post #3

Introducing newbies to GTK is a great way to show them a lot of code they don't understand, will take a while to understand, and will break in non-obvious ways.

I would be really interested in a course that actually holds true to the premise in the title here. I know my way around the JVM and python and started learning a little Rust on the side. However, I feel the need to at least dive my toes into C for a couple of weeks for completeness sake. Do you have a recommendation for something that is a little less than a book and a little more than learnCin10minutes?

I have lecture notes for the intro programming course I taught a few years ago: https://a-nikolaev.github.io/cpp-spring-2015/

It is actually in C++, but the goal was to cover C features first as the foundation, before going into objects, strings, and similar more advanced concepts. (It still uses C++ I/O from the very beginning, since it's was a C++ course.)

Re: Getting started with C

#70
post #11
post #5

Earlier quoted context omitted.

I would be really interested in a course that actually holds true to the premise in the title here. I know my way around the JVM and python and started learning a little Rust on the side. However, I feel the need to at least dive my toes into C for a couple of weeks for completeness sake. Do you have a recommendation for something that is a little less than a book and a little more than learnCin10minutes?

It kind of depends on what you need out of C. The only real reasons left to use C in the wild are: * Legacy code * Embedded (including drivers, bare metal etc.) * Portability, FFI, etc. Performance used to be another major reason, but in $CURRENT_YEAR, if that's your goal, C++ and Rust are just as performant and there's very little reason not to opt into them. The other major reason to learn C is that it's a great "h…

Not quite. I use C to interact with scientific libraries and to do some image processing. I would like to learn and use Rust but is still lacking in the scientific libraries department. I avoid C++ because it's a nightmare of complexity.
Post reply on HN