My manager gives me tasks to build a program around. After giving me the task, and making any changes to it, he asks me how long it will take. I realize this is an important question for managers. I'm new at software dev and not sure how to answer this. I've never coded the task before, so I don't really know.
I find the time taken can be broken down into 3 parts 1) understanding the task 2) building the program 3) trouble shooting / fixing bugs (I've heard, and agree with, that most of the time in development is spent trying to get the already existing code to work).