This question is very broad.
The main guideline to follow is: split the project in as many parts as possible. (and add 50% time)
You want to create a text editor. Split in parts:
- Designing lay-out (Load/Save buttons, textarea) -> 10 minutes
- Save code -> 5 minutes
- Load code -> 5 minutes
- Code a messagebox that asks for saving on quit -> 5 minutes
Total time: 25 minutes. +50% = 37.50 minutes.
Programming a text editor will take 37.50 minutes to complete.
Ofcourse: This example is extremely simplified and a little stupid. But on a bigger project, it makes more sense.
Also, there is good software to manage these work parts and time: http://blog.capterra.com/free-open-source-project-management-software/