views:

649

answers:

11

I've never written functional specs, I prefer to jump into the code and design things as I go. So far its worked fine, but for a recent personal project I'm writing out some specs which describe all the features of the product, and how it should 'work' without going into details of how it will be implemented, and I'm finding it very valuable.

What are your thoughts, do you write specs or do you just start coding and plan as you go, and which practice is better?

A: 

It's important not to write them: There's Nothing Functional about a Functional Spec

PEZ
That article is total B.S. Just becasue it's on the internet doesn't make it true. A *bad* spec is a problem, but to condemn all specs and not use them is just plain stupid.
ctacke
Looks more like an attack on Waterfall instead of an attack on writing specs.
Hace
That article is B.S? Getting Real is probably the most important development book written. Specs are generally useless. You should try going without them and you'll see.
PEZ
I have gone without them, both internally and with other dev teams. I've also spent months fixing problems due to lack of one where developers just did what they wanted and you end up with an unmaintaianble, incoherent mess. How can you ever answer "Does this work right" if right is undefined?
ctacke
You went without them but didn't compensate correctly for it. It's not an optimal way to judge a practice. Did you follow the link to Linus Thorwald's post about functional specs? "right" is only defined on the field.
PEZ
Truly awful article, one of the worst I've read in a very long time. Blaming the documentation for weak analysis, project management and implementation, is akin to blaming the automotive engineering for driving accidents.
Shane MacLaughlin
I agree it's more an attack on waterfall... extensive upfront spec writing, than specs in general. Specs can be useful, but working software is the goal.. not a perfect spec.
danswain
+3  A: 

I do it both ways, but I've learned something from Test Driven Development...

If you go into coding with a roadmap you will get to the end of the trip a helluva lot faster than you will if you just start walking down the road without having any idea of how it is going to fork in the middle.

You don't have to write down every detail of what every function is going to do, but define you basics so that way you know what you should get done to make everything work well together.

All that being said, I needed to write a series of exception handlers yesterday and I just dove right in without trying to architect it out at all. Maybe I should reread my own advice ;)

thaBadDawg
+11  A: 

For someone who "jumps into the code" and "design[s] as they go", I would say writing anything including a functional spec is better than your current methods. A great deal of time and effort can be saved if you take the time to think it through and design it before you even start.

  • Requirements help define what you need to make.
  • Design helps define what you are planning on making.
  • User Documentation defines what you did make.

You'll find that most places will have some variation of these three documents. The functional spec can be lumped into the design document.

I'd recommend reading Rapid Development if you're not convinced. You truely can get work done faster if you take more time to plan and design.

Kieveli
+4  A: 

For one-off hacks and small utilities, don't bother.

But if you're writing a serious, large application, and have demanding customers and has to run for a long time, it's a MUST. Read Joel's great articles on the subject - they're a good start.

Eli Bendersky
Well, I guess load new answer fetaure is somewhat working. I'm about to point out the same links when your answer shows up.
Salamander2007
+5  A: 

Jumping "straight to code" for large software projects would almost surely lead to failure (as immediatley starting posing bricks to build a bridge would).

The guys at 37 Signals would say that is better to write a short document on paper than writing a complex spec. I'd say that this could be true for mocking up quickly new websites (where the design and the idea could lead better than a rigid schema), but not always acceptable in other real life situations.

Just think of the (legal, even) importance a spec document signed by your customer can have.

The morale probably is: be flexible, and plan with functional or technical specs as much as you need, according to your project's scenario.

friol
+1  A: 

I would say it totally "depends" on the type of problem. I tend to ask myself am I writing it for the sake of it or for the layers above you. I also had debated this and my personal experience says, you should since it keeps the project on track with the expectations (rather than going off course).

kal
+3  A: 

What a lot of people don't want to admit or realize is that software development is an engineering discipline. A lot can be learned as to how they approach things. Mapping out what your going to do in an application isn't necessarily vital on small projects as it is normally easier to quickly go back and fix your mistakes. You don't see how much time is wasted compared to writing down what the system is going to do first.

In reality in large projects its almost necessary to have road map of how the system works and what it does. Call it a Functional Spec if you will, but normally you have to have something that can show you why step b follows step a. We all think we can think it up on the fly (I am definitely guilty of this too), but in reality it causes us problems. Think back and ask yourself how many times you encountered something and said to yourself "Man I wish I would have thought of that earlier?" Or someone else see's what you've done, and showed you that you could have take 3 steps to accomplish a task where you took 10.

Putting it down on paper really forces you to think about what your going to do. Once it's on paper it's not a nebulous thought anymore and then you can look at it and evaluate if what you were thinking really makes sense. Changing a one page document is easier than changing 5000 lines of code.

Kevin
+2  A: 

If you are working in an XP (or similar) environment, you'll use stories to guide development along with lots of unit and hallway useability testing (I've drunk the Kool-Aid, I guess).

However, there is one area where a spec is absolutely required: when coordinating with an external team. I had a project with a large insurance company where we needed to have an agreement on certain program behaviors, some aspects of database design and a number of file layouts. Without the spec, I was wide open to a creative interpretation of what we had promised. These were good people - I trusted them and liked working with them. But still, without that spec it would have been a death march. With the spec, I could always point out where they had deviated from the agreed-to layout or where they were asking for additional custom work ($$!). If working with a semi-antagonistic relationship, the spec can save you from even worse: a lawsuit.

Oh yes, and I agree with Kieveli: "jumping right to code" is almost never a good idea.

Mark Brittingham
+11  A: 

If you're driving from your home to the nearest grocery store, you probably don't need a map. But...

If you're driving to a place you've never been before in another state, you probably do.

If you're driving around at random for the fun of driving, you probably don't need a map. But...

If you're trying to get somewhere in the most effective fashion (minimize distance, minimize time, make three specific stops along the way, etc.) you probably do.

If you're driving by yourself and can take as long as you like, stopping any time you see something interesting or to reconsider your destination or route, you may not need a map. But...

If you're driving as part of a convoy, and all need to make food and overnight lodging stops together, and need to arrive together, you probably do.

If you think I'm not talking about programming, you probably don't need a functional spec, story cards, narrative, CRCs, etc. But...

If you think I am, you might want to consider at least one of the above.

;-)

joel.neely
A: 

I rarely feel the need for a functional spec. OTOH I always have the user responsible for the feature a phone call away, so I can always query them for functional requirements as I go.

To me a functional spec is more of a political tool than technical. I guess once you have a spec you can always blame the spec if you later discover problems with the implementation. But who to blame is really of no interest to me, the problem will still be there even if you find a scapegoat, better then to revisit the implementation and try to do it right.

It's virtually impossible to write a good spec, because you really don't know enough of either the problem or the tools or future changes in the environment to do it right.

Thus I think it's much more important to adapt an agile approach to development and dedicate enough resources and time to revisit and refactor as you go.

John Nilsson
You may be right about scapegoating, but in your situation the blame lies with the user. Users can (and do) make mistakes and give you contradictory requirements. When this causes problem, telling them "it's your fault" with no documentation makes you look bad, even if you are completely correct.
Adam Bellaire
I didn't mean to imply that users should do specs. I really meant that I don't believe that anyone can write a spec that will survive the implementation phase.Either you implement the spec as it is and miss a lot of oppertunities to discover better implementaions. Or you just ignore the spec.
John Nilsson
A: 

I like to decompose any non trivial problems loosely on paper first, rather than jumping in to code, for a number of reasons;

  • The stuff i write on paper doesn't have to compile or make any sense to a computer
  • I can work at arbitrary levels of abstraction on paper
  • I can add pictures and diagrams really easily
  • I can think through and debug a concept very quickly

If the problem I'm dealing with is likely to involve either a significant amount of time, or a number of other people, I'll write it up as an outline functional spec. If I'm being paid by someone else to develop the software, and there is any potential for ambiguity, I will add enough extra detail to remove this ambiguity. I also like to use this documentation as a starting point for developing automated test cases, once the software has been written.

Put another way, I write enough of a functional specification to properly understand the software I am writing myself, and to resolve any possibile ambiguities for anyone else involved.

Shane MacLaughlin