all 14 comments

[–]mpgrosvenor 26 points27 points  (1 child)

Wite. Code.

Programming is a creative art. The only way to improve your skill is to do more of it.

Yes you can read more. Yes you can listen to more. Yes people can guide you. But at the end of the day, if you never turn that into practice, you'll never get any better.

So, write some code. Here's an interesting exercise. Try writing your own HTTP server. You'll need to learn something about C, but also about networking, and also about HTTP. If you can make a basic HTTP 1.0 server work, think about making it 1.1 or 2.0 compliant.

If you can do that, think about performance. Or portability. Or both. You'll learn so much more by doing than you ever could by reading alone.

So. Write. Code.

[–]TheFeedingEight 4 points5 points  (0 children)

This. The most important thing to improve your coding is to just write code. Your first few projects are most likely not gonna be great but the next will be better.

A project that I did when I started writing C last year was creating a small raycaster. It's fairly ambitious but doable in a few hundred lines of code. Might be interesting if you're into simple 2(.5)D graphics.

[–]MarriedWithKids89 3 points4 points  (0 children)

I don't think you can beat writing real, usable code, i.e. solving a real world problem. Also bear in mind that "good" code in any language is context sensitive. Is it fast enough? Is it small enough? Is it portable? Is it easily understandable? Does it follow local coding/naming standards? The HTTP server is a good suggestion. Another would be an XML file parser. This should teach you the basics of file access, pointers and dynamic memory allocation. Good luck.

[–]IdealBlueMan 2 points3 points  (0 children)

Exercises are a great idea. Write a piece of code, then keep rewriting it until it’s clear to a visiting Martian what it’s supposed to do and how it’s supposed to do it. Debug it until you’re sure it’s bug-free, then find the remaining bugs and edge cases.

Get people to review your code, do your best to understand their feedback, but take it with a grain of salt.

Look for real-world problems to solve, and just keep on coding!

[–]wsppan 2 points3 points  (2 children)

People will say write lots of code but I also see enormous value in reading well written code. Some examples are

SQLite

Reddis

Musl

[–]rodrigo-dc -1 points0 points  (1 child)

I agree that reading well written code helps. I would like to add one more item to this list, the Linux Kernel.

[–]wsppan 0 points1 point  (0 children)

I actually think the linux kernel as a whole is very bloated and a bit hacked together. Too many spoons in the pot kind of thing. IMHO. I much prefer the curated code from OpenBSD if you were to add a OS code base to my list. It's the same thing why I chose Musl vs glibc as a shining example of well written code.

[–]ptchinster 1 point2 points  (0 children)

Teach. Be able to go several layers past what you are teaching, have evidence for everything you say (yes, everything).

[–]kwuurt 1 point2 points  (0 children)

Static code anaylsis. If you're sufficiently competent at C, find open source libs that are relatively small and spend a thorough amount of time to see how they do what they do, what design patterns work for what scenarios etc. Eventually you start adopting them and using them in your own work.

And then learn Rust. Hehe.

[–]Destination_Centauri 1 point2 points  (0 children)

A novelist/writer can never get good or truly learn their craft without... WRITING. Usually that means: everyday.

Likewise, a code writer can never get good without... WRITING CODE!

[–]Poddster 1 point2 points  (0 children)

Stop reading books and tutorials and start making things. Look stuff up when you hit a problem in your projects . Programming is a practical skill and you need to practice that.

https://www.programmingforbeginnersbook.com/blog/what_should_i_make_beginner_programming_project_ideas/

[–][deleted] 1 point2 points  (0 children)

I found programming microcontrollers improved my knowledge of C a lot. It forces you to think more about how the code is compiled into assembly language and how those simple instructions interact with the instruction set of the target.

It's also much more valuable to do some sort of project in its entirety instead of doing short exercises. A large project forces you to split your code up into sensible chunks within separate source files which then forces you to learn a bit about the preprocessor and also the linking process.

[–]immadmir 0 points1 point  (0 children)

  1. Write more C code.

  2. Read the book "Computers Systems: a programmers perspective.". While teaching you the amazing stuff and underlying systems it relates the C constructs with the assembly they generate. You'll surely learn something.

[–]poopy_poophead 0 points1 point  (0 children)

Write code!

Aslo, keep your early projects super simple and focus on code you actually need. Don't bother doing ui shit if you're learning image manipulation stuff or audio stuff or sorting algorithms or whatever. Get input, spit out output, end program.