Ask HN: What tricks have made you a better programmer?
For me it was:
1. Writing out input output relations for a function with quite a few examples before actually starting to write the function. Basically writing tests. It makes you realise what the function is actually supposed to do. I learnt this from How to Design Programs (htdp) book. It was a game changer.
2. Working on Fermi Problems aka Street Fighting Mathematics. I learnt from the books of Sanjoy Mahajan. They made me much better at estimating how the output to some input may be like.
What about you?
(
11 comments
| 4 points
| on HN
)
0 - https://en.wikipedia.org/wiki/Rubber_duck_debugging
Usually I don't want to leave any obvious stones unturned, so as I tell them I checked this thing and that thing, usually I discover a few more things to verify, and one of them leads me down the correct path.
This works about 80-90% of the time for me. I rarely need to send the email.
I write a function that does what I’m trying to accomplish, like image upload.
It’s a small part that can be reused in some bigger system.
Then make it work with a few constraints: file size, file type.
I also hardcode stuff
Another common approach is prototyping, where you build something that will be disposed for the purpose of learning. So you really won't feel any shame because you have to throw it out anyway.
Which can be reviewed/ saved for later / deleted. Without any pressure.
Also “proof-of-concept” to help learn or figure out how something will work.
Helpful if you want to try something that isn’t directly linked to an open ticket/issue or even just an issue under discussion and not part of the main backlog.
- laying out how I'm going to program before starting
- using TDD for most bug fixes and refactoring efforts
- learning how to steal the best parts of code from other people
- code reading everyday via PRs (my mental VM is pretty close to a real VM)
- learning algorithms and data structures (at least the basics, I'm no competitive programming pro)
- learning how to do code archaeology with git blame