Live data from Hacker News

Ask HN: How do you get better at coding?

news.ycombinator.com

61–70 of 73 posts

Re: Ask HN: How do you get better at coding?

#61

I get better at coding by coding. No, really. You can read all the books, blog posts, open source code samples you want, but nothing will substitute writing code. I maintain a handful of side projects as well as write code daily for my job. Plus, I love it. Also, my side projects usually encompass something I have no idea how to do, which quickly elevates my skill level. I love learning, so it works for me.

I get even better by coding with others. As I look at their code, as they comment on mine, I learn more than I would simply by working by myself.

Re: Ask HN: How do you get better at coding?

#62

1. Write big enough programs of your own such that you experience them collapsing under their own weight. That forces you to see the consequences of your actions. Only then can you really learn how to structure things better. 2. Try to learn the underlying technologies thoroughly. For example, try writing a simple C compiler and linker. That will teach you about a lot of things that a lot of the programming world sit…

I've learned no greater lesson about program structure than the time I finally got around to writing test cases for my first modest (~10k lines of C) personal project.

Re: Ask HN: How do you get better at coding?

#63

I get better at coding by coding. No, really. You can read all the books, blog posts, open source code samples you want, but nothing will substitute writing code. I maintain a handful of side projects as well as write code daily for my job. Plus, I love it. Also, my side projects usually encompass something I have no idea how to do, which quickly elevates my skill level. I love learning, so it works for me.

This. I have a large directory containing side projects that will never and were never intended to see the light of day; solely built for the learning experience.

Generally speaking, when I discover some interesting technology, I attempt to implement it in whatever language I am currently trying to improve my skills with, regardless if it's not the best environment. A good example of this was implementing the Ethereum VM in PHP. After just a few weeks of tinkering, some takeaways were learning the best and fastest ways to interact with binary data in PHP, improving my mental model of state machines, improving my debugging skills, learning how JIT compilation works, handling "big numbers" properly and caveats between several available libraries, etc...

A few important rules that have proven successful for me:

1. If available, your first iteration should be built purely following a specification (e.g.: RFC, whitepaper, yellowpaper), otherwise, if you have enough domain knowledge and understanding of what the program should actually do, build it without any reference, but allow an exception for researching (when required) very specific problems such as determining the best sorting algorithm for some function. Performing either of these will challenge and improve your ability to carry out the SDLC.

2. Hand-in-hand with #1: Don't start testing against (or even looking at) other reference implementations until at least iteration two. Whichever iteration this lands on, it'll likely be your first major refactor and will be the most time consuming, but most satisfying step. You will discover things you've (supposedly) done right (awesome++), things you've done wrong (learning++), and maybe even novel solutions to problems that end up being noteworthy contributions to the community (really awesome++++).

3. For lack of better phrasing: Focus on the specific task of the program or library. For example if your project is multiplayer netcode, you will of course need a game engine of some sort to capture a realistic state from, feed the data to, display it, etc. Sure, go ahead and write a simple game engine, but as cool as it is, don't focus on that...just get it to do what you need for your netcode! Game engines are cool and so are other subsystems of multiplayer games, but don't get distracted. This example is being used because multiplayer games are complex and meticulous and spending too much time on each subsystem may lead to burn-out or disinterest for what should be a far smaller project.

4. Don't worry (too much) about the language or environment being used. Unless you're planning on the project materializing in to a product, the sole intent should be becoming a better programmer, which requires only one language and a fresh project. Learning a new language isn't going to immediately make you better at programming, although there are plenty of benefits in learning new syntaxes and paradigms. Plus, you may always use your newfound domain knowledge as motivation to pick up the appropriate language and/or platform.

5. Never be intimidated.

Re: Ask HN: How do you get better at coding?

#65
The old adage of “practice makes perfect” definitely applies.

However, working with other smart (ideally smarter) people really helps a lot. Code review of my own code is helpful. But also reviewing other people’s code. I find that reviewing other people’s code from projects I am familiar with is more valuable than just reviewing any code.

I’m also a musician, the same approach applies there too. I always try to play in bands where I’m the worst player (though hopefully good enough that my playing satisfies the others in the band). That way I’m always learning and pushing limits.

Re: Ask HN: How do you get better at coding?

#66
Lately, by fixing bad code. But otherwise I find a project I am passionate about and go forward. I appreciate the wealth of tutorials available, but I generally find those boring because it doesn't accomplish my goal. I genuinely appreciate those tutorials/blog posts etc because they make for solid reference material.

Re: Ask HN: How do you get better at coding?

#69
I disagree about it being all about practice. That's like saying basketball players get better just by playing basketball. It's about the right kind of practice.

The best kind of practice is the one you dread most.

Last year I kept hitting the semicolon, curly brackets wrong and getting the capitalizations off. I deliberately practiced typing those for dozens of hours. These things really helped me stay in flow instead of stumbling.

I used to dread all the complicated architectures of modern Android. So I did a few app sprints trying to find simpler ways of building one from scratch and seeing which corners I can cut.

I felt that I was too slow in coding things that weren't copy paste. So now I've been doing some 'sprints' by doing Hackerrank or Project Euler as fast as possible and then taking a long break from them.

Re: Ask HN: How do you get better at coding?

#70
Lots of coding, bad, good, better, messy, etc.

Challenge yourself, to try the hard task once in a while (prove to yourself, those "I could do that much better" thoughts), attempt "proof of concepts" (at least) of your wild ideas. You will be surprised how far you can get.

Exchange ideas and accept bitter pills of criticism, yeah sometimes you will have to admit you got something wrong and now you have to rethink how to do something. Once you get over that you will find new opportunities and also have a new story about "back in the day I was so bad at this, I..."

Post reply on HN