This is a “top five most-popular” question for programmers. It is best to be asked this kind of question before you begin writing a program. It shows that you (and/or your colleagues) are thinking ahead.
For instance, how long would it take you to make a PB & J sandwich? Off the top of your head, you think “two minutes. Maybe less”. However, has your sandwich-making plan ever gone like this:
- You get out the bread and peanut butter only to find that the bread is moldy. You struggle to decide if you should change your lunch plans. No, you decide that only PB & J will satisfy you today. So you head to the store.
- You get to the store and grab your bread but when you get to the check-out, you realize that you forgot your wallet. You are pretty mad and want to skip it now but you decide that you are committed. You drive home and get your wallet. Then you go back to the store and buy the bread.
- You are now ready to make the sandwich. You open the peanut butter and realize that some thoughtless jerk put an empty peanut butter jar in the cupboard. Perhaps you are experiencing low blood sugar or something because you say some unusually impolite things. There is no way that you want to drive to the store again. Instead, you get a spatula and scrape 2 grams of peanut butter from the sides of the empty jar and decide that it will just have to be good enough this time.
- Oh, you were only thinking about peanut butter and bread. You didn’t think about jelly. Feeling apprehensive, you open the fridge and look. There is no grape jelly. Only strawberry. Oh jeez. ….Fine. Whatever. It is jelly.
- You complete the sandwich
Stop the clock: 75 minutes. A new record for slowness. You are so mad about it too. If somebody even looks at you before you are done eating…. ooh. I can’t even think of something that bad.
Please eat your sandwich and take a moment to cool-off before you continue reading.
So how did everything go so wrong?
- You didn’t think ahead, to see if you had the resources that you needed, before you picked a timeline
- You didn’t double-check your resources, to confirm that they were viable and still a good fit for this task
- As you were performing your tasks, you didn’t think beyond your next task
- You cut corners to complete a project that was already behind schedule (not enough PB and the wrong J)
Now imagine if you were making the sandwich for me and I only eat sugar-free grape jelly and organic no-sugar-added PB and only the chunky kind (never creamy, yuck). If you bring me a sugary PB & J, I won’t eat it. How many times would you have gone to the store? If you plan ahead, and know what questions to ask, then probably only once. In fact, I might already have the ingredients and it would save you a trip to the store.
This is why programs take a week to write, or sometimes a day or sometimes five months, or whatever. You can NOT ever be certain how long it will take to complete a program, until you have all of the information needed to make that estimation. ALL OF IT. You can still write the program without all of that information, but your estimate is really just an educated guess (based on a gut-feeling, etc.)