Live data from Hacker News

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

news.ycombinator.com

191–200 of 209 posts

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

#191

Earlier quoted context omitted.

Not crazy at all. Problem is YouTube only goes to 2x

Highly recommended: Video Speed Controller. Firefox: https://addons.mozilla.org/en-US/firefox/addon/videospeed/ Chrome: https://chrome.google.com/webstore/detail/video-speed-contro...

Been using this for years.

You can go up to 16x speed and turn on captions to speed-read through

Really just depends on how much content the video has

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

#192
post #187

Earlier quoted context omitted.

How do you learn to read code without guidance and without getting lost? How do you keep your thoughts organized? At each step, how do you confidently decide where to go next? ——— I’d like you to take as given that I’m reasonably intelligent — I graduated from MIT and have been working as a software engineer for 6 years. Yet when I sit down to read https://github.com/cypress-io/cypress or https://github.com/webpack/w…

I've spend my career reading code. I find it particularly difficult without guidance. I would recommend using some old school technology (pen/pencil and blank paper) and draw diagrams, write down every question and observation, notes. Others may recommend using some digital tool, but be mindful how much energy you spend organising your thoughts, drawing with a digital tool. If your goal is to understand a software, t…

This is all great advice. Two things that have helped me in particular

(1) applying the "analytical reading" rules defined in "How to Read A Book" to a code base. One of those rules, as Olikas said, is formulating hypotheses and questions and "actively engaging" with a code base (or any text).

(2) Compare and contrast a similar project (i.e. using the same language and framework) to figure out whether the structure of the project in question is following a general layout or not (e.g. Maven projects in Java).

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

#193
post #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…

I massively disagree with this, as the other part said a lot of standards don't make any sense. REST always seemed very suspect to me, and Facebook with some of the best developers in the works basically threw it straight out of the window with graphql, seeming to validate the scepticism. Html also has complicated standards about elements which everyone ignores with divs everywhere. There seem to be a lot of nonsense standards around.

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

#194
Read code reviews of senior developers.

I follow several public and private projects that I do not contribute at all. Any time there is a review comment on a pull request from senior devs, I try to check if it is new to me. If so, I note down the problem and suggestions.

Here are some examples:

- Aleks suggested to limit the try to the places where exceptions can be thrown and move everything else out of the try.

- Thomas suggested to use =StringBuilder= instead of =String.format=. The former is faster and more robust.

- Oscar suggested to use a =parameter object= or a =builder= when there are many (more than 3-4) parameters.

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

#195

Conference Youtube videos. They are a goldmine of useful tips and tricks. Go look for videos from the Node [1] and MongoDB [2] conferences and you will find tons of war stories and what is actually working for people. Using this option arguably connects you directly with some of the best people in the world who are actually using this stuff. ps. using the youtube 2x playback speed option can really help digest lots o…

Yep, seconding this.

https://www.infoq.com/ is my favorite because they get talks from some of the most experienced software dev folks, and they cover almost every topic of software engineering

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

#196
post #143

Conference Youtube videos. They are a goldmine of useful tips and tricks. Go look for videos from the Node [1] and MongoDB [2] conferences and you will find tons of war stories and what is actually working for people. Using this option arguably connects you directly with some of the best people in the world who are actually using this stuff. ps. using the youtube 2x playback speed option can really help digest lots o…

I would say do not look to conference videos for how to write production quality code... Most talks at conferences are shallow and at worst just the blind leading the blind. Be very careful, I've even seen people from places like Microsoft showing code at conferences that would fail even a decent code review process. I think for this reason conferences are a complete waste of time. Talks are too short to go into anyt…

This often happens when conferences and blogs are used as a marketing outlet. There is still plenty of gold, but you have to sift through all the garbage of people using it as a way to make themselves more visible.

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

#197
Keep things simple and idiomatic. Use dependency injection and hook everything up in main. You should be able to open up your code and understand what's going on just by looking at this setup.

Your public apis should be based on the shape of your data. I would prefer postgres over mongodb because your data probably has a schema.

If you have the time, learn some other languages. Each language has their own ecosystem where problems are approached slightly differently. You'll pick up patterns and be able to apply them to your work. I would recommend elixir, which has a very focused ecosystem and a standard library with well thought out apis.

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

#198

I did a quick control-f "read" and almost everyone is telling you to read books or articles about best practices. That might be useful once as a highlevel overview when getting started on a topic, but my personal advice is to only do that briefly. You'll get the most bang for your buck READING CODE. There is no better way to improve as a developer than reading good code. Reading articles and books will teach you thin…

How do you learn to read code without guidance and without getting lost? How do you keep your thoughts organized? At each step, how do you confidently decide where to go next? ——— I’d like you to take as given that I’m reasonably intelligent — I graduated from MIT and have been working as a software engineer for 6 years. Yet when I sit down to read https://github.com/cypress-io/cypress or https://github.com/webpack/w…

I emailed you. For everyone else, here’s a rough article I’m writing on reading code for my Notes to a Young Software Engineer series:

https://www.dropbox.com/s/q5mtxxk6bswkag6/Read%20Code.pdf?dl...

https://www.nemil.com/on-software-engineering/index.html

(The article has a few great HN threads on reading code; after all, there are lots of contexts where you need to read without working someone in person who’s been involved in that code)

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

#200
post #192
post #187

Earlier quoted context omitted.

I've spend my career reading code. I find it particularly difficult without guidance. I would recommend using some old school technology (pen/pencil and blank paper) and draw diagrams, write down every question and observation, notes. Others may recommend using some digital tool, but be mindful how much energy you spend organising your thoughts, drawing with a digital tool. If your goal is to understand a software, t…

This is all great advice. Two things that have helped me in particular (1) applying the "analytical reading" rules defined in "How to Read A Book" to a code base. One of those rules, as Olikas said, is formulating hypotheses and questions and "actively engaging" with a code base (or any text). (2) Compare and contrast a similar project (i.e. using the same language and framework) to figure out whether the structure o…

> “How to Read a Book”

I’d seen that book a while ago but not picked it up. I’m now going to. Thanks!

> formulating hypotheses and questions

I think this reduces to “how do you keep those hypotheses organized?” which sounds kinda like the problem of “How do I write an outline?”

> Compare and contrast a similar project

This makes sense to me for web apps. Less so for a package manager.

I suppose that means the questions splits off into lots of domain-specific quesions like, “what should I pay attention to when reading a RESTful service?” “What should I pay attention to when reading a package manager?” Etc.

————

For a RESTful service, I would recommend first getting and idea of the core models from the API docs and then from reading structure.sql or models.py or whatever holds the relationships among tables. Draw an entity-relationship diagram on a big piece of paper of the important models.

Then, try and trace the path of a web request from the outside in through middlewares to the controller then to rendering and back out again.

Post reply on HN