News for hackers. Stuff that matters.
Re:Ask HN: How to learn best practices when you have no one ... by mindcrime on Monday March 18, 2019 @04:57PM (#19425201)
How do you know that what you are doing is a “mistake” if it works?

Reading. Plenty of books, blog posts, and forum posts point out that you shouldn't have "10 KLOC UserManager classes".

The thing is, one has to figure out how to integrate "book learning" AND real world experience, so that they're constantly synthesizing a newer, better understanding.

Re:Ask HN: How to learn best practices when you have no one ... by badpun on Monday March 18, 2019 @05:36PM (#19425575)
Funny thing is, if you look at codebases of some opensource projects [1] doing complex and ambitious stuff, written by some real experienced engineers, you’ll see the common „dogmas” (don’t have long classes, don’t have long methods etc. etc.) are not obeyed. And yet, they shipped very complex and successful software. It’s almost as if these rules are mostly arbitrary and don’t really matter.

[1] I’ve noticed that in codebases of Apache Spark, Apache Oozie, Apache Cassandra, and Firefox.

Re:Ask HN: How to learn best practices when you have no one ... by mindcrime on Monday March 18, 2019 @05:41PM (#19425615)
It’s almost as if these rules are mostly arbitrary and don’t really matter.

Definitely. I mean, some of them probably have some objective basis. But clearly some of them are indeed subjective and arbitrary. Take "long method names" for example... I believe method names should state what they do, and should be however long it takes to do that. To my way of thinking, making a method name shorter just for the sake of being shorter, and eliding semantic information, is an anti-pattern, not a best-practice. shrug

Re:Ask HN: How to learn best practices when you have no one ... by sbov on Monday March 18, 2019 @06:30PM (#19426020)
Reminds me of other comments on this subject: one person's best practice is another person's bad practice.
Re:Ask HN: How to learn best practices when you have no one ... by scarface74 on Monday March 18, 2019 @05:48PM (#19425682)
I wrote some really long functions in C back in the day just to avoid the overhead of function calls. Yes, this was after running a profiler and we had massive amounts of data (for the time) to crunch within a short window.
Re:Ask HN: How to learn best practices when you have no one ... by peller on Monday March 18, 2019 @05:02PM (#19425266)
Yes. I would also include reading other more-experienced developers' code in bullet point #3. Pick a well-respected project from a language you're looking to get better at, and dive in.