Hey Proggit, what's your workflow when writing programs?
What are the steps you follow from that sweet moment you have an idea for an awesome program to that even sweeter moment you write its last line of code?
I want to see how other people go through this process. I think I'm doing it wrong, because my code often ends up looking messy after adding features upon features that I didn't think of originally.
Posted Dec 18, 2009, 2:23 AM UTC
The first thing I do is identify the hardest parts first. I write small test programs to make sure those problems can be solved. You have to get started on those the earliest and make sure you can pull it off, plus it gets you thinking early about these issues.
Next, if it has an interface, I build a basic, but fully functional one. I will even hard code some data in it or add some light background code so you can see how it feels. This the part end users will see and care about the most, it also helps you identify anything you might have missed and gives a very deep understanding of what it has to do. Next, I model any data. I don't really do it formally unless I have too, I can do it my head fairly quickly from experience. From there it is coding time. This will usually go smooth since by this time I have a very good idea of what I have to do, an interface -- if necessary -- to work with, and all the major problems solved. Since I have a lot of the pieces done, and have had time to lead up to them, I have had the time to think about how to best compose the software in my head, so things fit together real nicely. Next, I make sure to unit test the fuck out of the software, and do lots of final testing.
My best advice to you, don't jump in right away. That is always the biggest mistake. Every time you jump in too quickly into something, and then try and hammer it out quickly, you make stupid mistakes. You always end up not doing your research and writing code that already exists in some library some place, using the wrong API, wrong tools, etc... Problems that would not have happened had you given yourself breathing room, done your research, and talked to the right people.
As for you problem, it's called "feature creep", and again, it's from jumping in and not thinking clearly. Had you given yourself some more breathing room in the early stages, those "features" would not "creep" up on you. You need to focus less on the number of features. Your job as a programmer is too make peoples lives easier with simplicity and automation, not harder with clutter and confusion. You need to focus on your core features, and then build out secondary ones as the market and your customers dictate. Otherwise, you are wasting all of your time on one endeavour endlessly maintaing features no one ever uses.
Thank you for the well thought-out response!
I do tend to jump in too quickly into projects, or skip the boring parts, thinking that all the code I need is already in my head.
I like your approach. It seems like you have some nice people to work with. My boss basically insists that I work on the interface first, before anyone has a clear idea of why or what. She distrusts developers who work on hard problems first because they show little progress.
BTW, too != to :)
Spot on!
Great response, very similar to my approach. Also specifications from the customer change so don't get upset about it, try to accommodate it. Don't do "what if" programming, there is a balance between a design that can do everything and a design that is too narrow.
YES, "what if" programming is very bad. I have done that though in situations where it was highly probable that the thing I was programming for would happen. Though it has worked out I would not do it again and don't recommend it.