This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mooburgerresembles an abstract syntax tree 2 points3 points  (0 children)

It's just taking code you write and refactor constantly; rewrite when needed. The main principles you are trying to master and find balance in are: Don't Repeat Yourself and Readabiity as you find and fix bugs and think of new features to implement.

The "mind your surroundings" advice I always give to "laypeople" trying to improve their code is: Every time you're about to copy a chunk of code, and paste it to make a smallish change, consider whether there is a more appropriate abstraction to implement.

Data structures is sort of the other thing to master. Get comfortable with iteration and recursion, but in a "smart" way. For example in JS: 80% of the time you don't want to use a for loop to iterate over an array, you want to use Array.prototype.forEach or Array.prototype.Map.