Unfortunately after you get past the basic learn a language stage, it more or less dries up. There are a couple of books that are polarizing like Design Patterns, but that is about it. From here on out it is trial and error.
As far as best practices go here is my list:
Automate everything you can.
Keep it coherent.
Rewrite when you find yourself building a house of cards.
When to create a function: anytime something is complicated enough that you think about it abstractly, anytime you use something more than once.
When to create a class: I haven't really nailed down a logical description for how or why I would make a class. Anytime you have a conceptual entity you have a candidate for a class, a player, a socket, a button, a window, a file.
Comments
Unfortunately after you get past the basic learn a language stage, it more or less dries up. There are a couple of books that are polarizing like Design Patterns, but that is about it. From here on out it is trial and error.
As far as best practices go here is my list:
Automate everything you can.
Keep it coherent.
Rewrite when you find yourself building a house of cards.
When to create a function: anytime something is complicated enough that you think about it abstractly, anytime you use something more than once.
When to create a class: I haven't really nailed down a logical description for how or why I would make a class. Anytime you have a conceptual entity you have a candidate for a class, a player, a socket, a button, a window, a file.