Live data from Hacker News

Ask HN: How to learn best practices when you have no one to teach you?

news.ycombinator.com

101–110 of 209 posts

Re: Ask HN: How to learn best practices when you have no one to teach you?

#101
post #98

Earlier quoted context omitted.

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.

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…

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 to teach you?

#102
Everyone is already piling with sources to learn from, so my biggest advise is avoid falling into the trap of cargo culting and overfollowing the internet echo chamber. Personal experience is worth so much more than reading something from a blog post somewhere, even if that somewhere would really be good information which is not at all such a given

Re: Ask HN: How to learn best practices when you have no one to teach you?

#103
All of these responses are missing a huge point here:

If you're a solo developer, stick to _standards_. There are standards for how something should be implemented (like REST), there are standards to how things should be written (like PEP8 for Python), etc.

Follow those standards as close as you possibly can. Ultimately, you'll find issues with them -- that's great! Perhaps you'll even find a more clear way of doing something that the standard doesn't suggest. This means you can probably iterate on your original design.

Join a Slack/Discord/IRC with other developers using your toolchain and ask questions there if you have concerns. If you're worried about design decisions, find others who have been in similar boats and ask how they did things and what the result was like.

Typically, best practices are those that emphasize 1) clear code, 2) readable code, and 3) the KISS principle. Anything that favors complexity over simplicity _must_ have a good reason for doing so.

Re: Ask HN: How to learn best practices when you have no one to teach you?

#104
Reach outside your company. Genuine appeals for focused help are rarely dismissed.

You don't need to know almost everything (and derive what you don't from first principles), that is unreasonable. You do need to have a network of folks you can ask help or feedback from.

Being on a small team without much support will force either very fast growth or failure, and your ability to be intellectually honest (is this true or do I want it to be true?) and identify folks who can and are willing to genuinely help are important factors.

Re: Ask HN: How to learn best practices when you have no one to teach you?

#105

Earlier quoted context omitted.

That really doesn’t help. How do you know that what you are doing is a “mistake” if it works? 10K line UserManager classes “work”. That’s how you get the “expert beginner”. https://daedtech.com/how-developers-stop-learning-rise-of-th... The only feedback you get as a sole developer are your compiler and errors in production. You would never know that it isn’t a good idea to write your own AcmeDatabaseManager or AcmeL…

> How do you know that what you are doing is a “mistake” if it works? Because it hurts.

So even if you see that your 10K line UserManager class is hurting your velocity and you are spending more and more time maintaining your AcmeDatabaseManager and AcmeLogManager, you still don't why it's taking longer or what to do about it.

Re: Ask HN: How to learn best practices when you have no one to teach you?

#106
Today's best practices are tomorrow's legacy codebase. Don't get hung up on "doing it right" if your code works & your comfortable with it, i.e it is maintainable and it is reliable.

My best advice would be to try and use one of the publicly published coding standards from a big company as there is usually a lot of good knowledge/experience baked into those. Use a linter religiously and do not commit code with lint errors. For every commit, take a step back and think "is this code shit?" If I had to explain it to someone who I thought was a 'better' or more experienced coder than me, would I be embarrassed about it?

Generally you'll get a gut feeling about code being good or bad - how reliable it is, how often you have to tweak it, how easy it is to change etc. If it is hard to make changes to some code or its really buggy or brittle then trust your gut: You Are (probably) Doing It Wrong. That is when you can go and read around different approaches online to see what other people have done to approach the same/similar issue and learn from them. Some approaches will resonate with you, some won't. Make a professional judgement on which (if any) you want to learn from/emulate in your codebase and why you made that decision (the thought process helps - sometimes you just need an 'ah ha' moment to work out your own approach)

tl;dr - beyond fundamentals, everyone does things differently. Do what works for you and what is reliable and maintainable.

Re: Ask HN: How to learn best practices when you have no one to teach you?

#107
> The other developers don't really assist me since they have their own projects to work on, and, honestly, they have less experience and knowledge than I do.

Best practice tip: no developer should be an island. You should all have some idea what each other is doing, at least once a week. You should be reviewing each others' code, and asking about the decisions and tradeoffs involved.

Re: Ask HN: How to learn best practices when you have no one to teach you?

#108
post #98

Earlier quoted context omitted.

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.

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…

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 to teach you?

#109
post #49

1. Make lots of mistakes. 2. Experience pain in the form of late, buggy software and angry clients. 3. Read books and work on side projects. (Martin Fowler’s were my favorite). 4. Repeat for 5-10 years with hopefully ever-decreasing amounts of 1 and 2. You probably think I'm kidding...

This. I have been looking for a company to be mentored at for the past 8 years. They don't exist (well they do, but they are few and far in between - and it varies from team to team even in a company) The way I've learned is through books/talks, common sense (often things are clearly terrible for obvious reasons), people willing to take risks on giving me projects, and sweat/mistakes/learning how to focus on the righ…

They do but they're extremely rare. Before I started for myself I spent a lot of time mentoring my team. Most if it was building their confidence up so they could think critically themselves whilst reading the right books.

I myself have never had a technical mentor. Never needed one. What I did need and have were mentors for the other 90% of being a successful professional (and people who built my self confidence up).

Re: Ask HN: How to learn best practices when you have no one to teach you?

#110

Earlier quoted context omitted.

> How do you know that what you are doing is a “mistake” if it works? Because it hurts.

So even if you see that your 10K line UserManager class is hurting your velocity and you are spending more and more time maintaining your AcmeDatabaseManager and AcmeLogManager, you still don't why it's taking longer or what to do about it.

Neither did the first person to encounter it, but they figured it out anyway. There is no magic one-size-fits-all process for this.
Post reply on HN