Research before surveying the literature - is it ever a good idea? The dominant narrative on how research "should be" done is to begin with a literature survey and then make your own contribution.

But I get the impression that it often happens the other way around - at least in fields such as CS where the cost of knocking some lines of code together is low (compared to, say, a 3 year medical testing programme).  Creativity knows no rules.


The obvious risk of this approach is that the research is subsequently found to be old hat, or better versions of the same thing exist already, or it commits an error already widely known in the field.
The reward, on the other hand, is that such creation might never have happened if the requirement of surveying the literature first was always met.  (Indeed some grad students have been known to quit before finishing the lit review their supervisor asked for - maybe they'd have done better if allowed to exercise their creative nature first?).


So I would conclude that it's an acceptable strategy when the individual is happy with that risk/reward balance (provided they already know enough about what they're doing to have some inspiration in the first place, that is).

Are there other arguments/perspectives I've missed here?

UPDATE

There are a lot of very good answers here and there is no one right answer.  I'm not quite sure how to handle that.  In my experience this is the kind of thing that tends to lead to questions being closed as "not constructive" on SE sites.  I'm glad nobody has done so yet because I think the full range of opinions expressed below is a very worthwhile thing to read through.  Thanks all for your contributions.
I don't entirely agree with the answer "No". This may be because my field is mathematics, though. Sure, not looking at literature beforehand means you are at risk of re-doing something that was already known and it's never nice to discover after spending lots of time working on something that it was already out there. 

On the other hand, when you come across what seems to be a good question, I don't think it's such a bad idea to start by asking yourself "Can I answer this myself?" and not rush immediately to see what other people have already done in relation to this question. I see a possibility of positive outcome to not being aware of previous results for a significant time (of course not to the point of being on the verge of publishing and discovering the day before submission a very similar paper...).

As ff524 pointed out in a comment, "if you are a researcher, [...] you already have some idea what's been done before". If you find an interesting question and don't know about an answer, it may be because it does not exist, but it may also happen that it does and has been overlooked before. Maybe it came out at a time when it didn't meet the interests of the community, or it came from another community, or the communication on the result was not so good, or it didn't look interesting because the strategy was inappropriate. If you find this result early on, you will likely drop the question, not advertise it and the result (although of interest to the community) will remain unknown. If you start searching the answer without knowing about the previous result, it's likely that you will not follow the exact same path and that can be good.


Maybe your way is more "natural" and makes the result fit nicely in a developing theory that didn't include it before. It's not such a bad idea to provide a new way of looking at something, even if the result per se is not new.
Maybe your way is more fruitful, in the sense that during your quest for the answer to the original question you will come up with new interesting questions which did not stem clearly from the way the result was previously established. 


It's still risky, but in research you constantly invest your time in stuff you don't know the outcome of.