Throw The First One Away
You will understand the problem much better after your first attempt.
(corollary: they never let you throw the first one away)
This makes 'Throw The First One Away' less painful and improves testability
Minimize Coupling, Maximize Cohesion
It is better to reduce the amount of dependency between modules to make future changes and adaptations easier. Also, it is better to increase the relatedness of each function within a module.
Don't Be Afraid To Learn Something
And don't be afraid to 'Google' it! Many times people hesitate to move forward productively because they feel that they don't know something - a little hubris isn't always a bad thing, dive in and 'Fail Quickly'.
Make It Work First, Then Make It Fast
Goes with 'Fail Quickly', you won't have wasted that time when you have to backtrack.
Data Design > Code Design
Data Driven Design + Little Languages = greater expressive power
APIs are little languages too, so learn some language design
i = 2; // set i to 2 <<< THIS IS NOT HELPING
i = 2; // first two elements of the array are reserved for...
Save Early, Save Often
Where did my code go? corollary: Learn how to use a source repository
Requirements! Requirements! Requirements!
Avoid spherical cows. Understand what is actually needed early on, don't code yourself into a corner either as Requirement can & will change.
"All problems in computer science can be solved by another level of indirection" -- David Wheeler
"except for the problem of too many layers of indirection" -- Kevlin Henney
Design in Error Handling
Don't leave error handling and reporting to the end, include it in the design and understand the Requirements.