4 ms·
I use a technique like this when I am stuck trying to write code and can't figure out how to do it efficiently. I ask myself "what is the worst possible way to
by brucehart 13y ago
I use a technique like this when I am stuck trying to write code and can't figure out how to do it efficiently. I ask myself "what is the worst possible way to implement this function?" and start writing that. Sure enough, that gets my mind going almost immediately and I start thinking of the improvements needed to turn it into good code.
- Xcelerate 13y agoHaha, I know that feeling. "How on earth am I supposed to implement this?" usually turns into: for (int i = 0; i < alpha; ++i) { for (int j = 0; j < beta; ++j) { for (int k = 0; k < gamma; ++k) { ...
- Twisol 13y agoI do this too, except I call it a "rope bridge". Write the simplest thing possible, even if it doesn't do everything you need, and then start iterating. The rope bridge will quickly become much more solid. The danger is that you leave the solution at too early a stage, and other things start relying on your flimsy rope bridge. It gets really difficult to go back and do things better.
- GhotiFish 13y agoThat's test driven development sans the testing. You should try test driven development :)
- mjcohen 13y agoInteresting how TDD is so close to TTD.
- Shish2k 13y ago> Interesting how TDD is so close to TTD For me, "TTD" in the context of a discussion about bridges just means Transport Tycoon Deluxe o_O I assume that's not it?
- TeMPOraL 13y agoOr, maybe that's where the power of TDD comes from, and not from tests ;).
- GhotiFish 13y agoIn my experience the tests work pretty well, as well. and if you're already developing in a style that is amenable to TDD, you should totally try it!
- modarts 13y agoTDD?
- mjcohen 13y agoTest driven development. As opposed to TTD, which is test to destruction. Or DDT, which is development driven testing. Or DMD, which is don't mean diddly.
- arethuza 13y agoMore Extreme Programming: http://c2.com/xp/DoTheSimplestThingThatCouldPossiblyWork.html http://c2.com/xp/DoTheSimplestThingThatCouldPossiblyWork.htm...
- brianpan 13y agoThis is what's really happening with the McDonald's theory- it's a resetting of expectations by asking a different question. We can't ever figure out lunch because we're thinking "What would I really like to eat today?" and too often the answer is nothing. But if the question is, "What is better than McDonalds?" you might have some ideas. Even if you like McDonalds, this question is more concrete and answerable.
- girvo 13y agoUnfortunately, due to doing PHP professionally in a horrible legacy codebase, the answer is usually "Doing it at all". Sigh.
- calinet6 13y agoExcellent concept, and it works great. Often you overcomplicate implementation by thinking about the right way from the start, and while this is a good thing to do in general, sometimes it gets in your way. I like to think of the simplest possible way to write it (not necessarily the "worst" but just the simplest). Then you have something, anything at all, and you can go from there. My ex-coworker always said "Make it work, then make it good, then make it fast." Good rule of thumb that has taken me pretty far in code productivity.