News for hackers. Stuff that matters.
Re:Do the Real Thing by gitgud on Saturday June 20, 2020 @09:39PM (#23588996)
> Want to get better at programming? Write a lot of programs. Yes. But also read a lot of high quality code written by others.

Well, do this in moderation, as reading "high quality code" can lead to a premature focus on code-quality.

Most "high quality code" is the result of many iterations of ideas and use-cases. And trying to emulate that style can be counter-productive in many cases.

I find going back in the history of the code-base helps you see how simple the project used to be, which is helpful when learning to code.

Re:Do the Real Thing by MaxBarraclough on Sunday June 21, 2020 @06:38PM (#23595923)
> reading "high quality code" can lead to a premature focus on code-quality

I don't think so. There's a difference between a skilled software developer making tradeoffs under time pressure, and someone who doesn't know what good code even looks like.

If you aren't capable of writing good code, you aren't qualified to make the right tradeoff.

Re:Do the Real Thing by gitgud on Monday June 22, 2020 @12:32AM (#23597355)
> "If you aren't capable of writing good code, you aren't qualified to make the right tradeoff."

So you should probably limit the amount of "good code" you read when you're learning something right?

Or else (as you say) you won't be able to understand why it's good and what trade-off's it will cause...

I guess my main point is, don't dive into the linux kernel if you're learning C, as you'll learn optimisation strategies that probably aren't useful in your context and will only slow you down...

Re:Do the Real Thing by MaxBarraclough on Monday June 22, 2020 @04:52AM (#23598379)
> So you should probably limit the amount of "good code" you read when you're learning something right?

Why? If you're learning a dance, you try to copy the teacher, not other students. You don't need to study the mistakes of others, you are sure to make plenty of your own.

> don't dive into the linux kernel if you're learning C, as you'll learn optimisation strategies that probably aren't useful in your context

Unless you're learning C for the purpose of kernel programming, sure. That's not really the same question.

Re:Do the Real Thing by throw10382 on Sunday June 21, 2020 @04:44AM (#23590742)
And if you're a beginner, what you think is high-quality code is probably just wrong. You don't have the experience to differentiate. Over-abstracted code that is extremely visually clean at each of its 8 levels of indirection and is so perfectly cohesive that any modification would destroy the entire artwork looks great to most beginners.
Re:Do the Real Thing by tosama on Sunday June 21, 2020 @04:01PM (#23594914)
Agreed, I'd replace that with "watch good programmers program", or even "pair program with great programmers" if that's an option.