Throw away your first draft of your code
201–210 of 230 posts
Re: Throw away your first draft of your code
#202The famous comedian John Cleese speaks about this where he loses a script and has to rewrite it from memory before a deadline. Then he finds the old one and finds out his new one is much better despite thinking it was the same. So he started using it as a technique for better script writing. It is referenced here but I can’t find the video https://www.ideaconnection.com/right-brain-workouts/00186-jo...
Re: Throw away your first draft of your code
#203As an ML-focused python dev I have never been able to break the habit of REPL-driven development, but I find it works really well for "building code that works" rather than coming up with a tower of abstractions immediately. A typical python development workflow for me is: * Start with a blank `main` file and proceed linearly down the page, executing as I go. * Gradually pull out visually awkward chunks of code and p…
Agree 99% except this statement: > Embrace duplication - don't unnecessary add loops or abstractions I’ll usually make a function or perhaps tiny class as soon as I start reusing bits of code. Apart from that, agree as stated. At my previous job (Python shop), a lot of the data engineers came from a Java background, and had a tendency to think top-down. Many things were over engineered ‘just because we might need it’…
This isn't a cynical statement; it's just my experience. Use it to your advantage!
Re: Throw away your first draft of your code
#204 ...you will anyway (Brooks)
IMHO Write it once for the problem; again for the solution.TFA stresses: finding out what you're building; finding the "unknown unknowns" (the things you don't even know you don't know, encountering those problems)
TFA doesn't say it this way, but I think the fun of throwaway-prototyping is your thoughts can focus uninterrupted on the problem, undistracted by secondary issues. You can hack-around tedious parts, now knowing they are there; and you can get absorbed in the genuinely tricky parts, unobscured (even if you don't succeed, you also know they are there). You're not expected to get it all right.
It's turning an unexperienced developer (on this problem) into an experienced one.
PS Somewhat disturbingly, Brooks went back on this according to this interview https://www.computerworld.com/article/2550685/the-grill--fre...
"you should plan to throw one away. You will anyway."
That was the first edition of The Mythical Man-Month. In the second edition, I say that was misguided! You ought to plan to continually iterate on it, not just build it, throw it away and start over. Some of the things I said in 1975 were wrong, and in the second edition, I correct them.Re: Throw away your first draft of your code
#205The idea of prototyping to uncover 'unknown unknowns' resonates with me, it's like a reconnaissance mission before the actual project. This could indeed save a lot of time and effort in the long run...
Re: Throw away your first draft of your code
#206Earlier quoted context omitted.
In my experience, this is what actually happens. A developer makes a low-quality, low-effort prototype under the assumption it won’t ship. Someone sees it. It gets shipped. Everyone loses.
Sabotage your prototypes then. Have it reset its state every 5 minutes or deliberately leak memory.
Re: Throw away your first draft of your code
#207Earlier quoted context omitted.
If like to know too. I learned python in jupyter notebooks. It makes experimenting and incremental development much easier (IMO) provided you remember to account for the current state of the notebook, which sometimes has me pulling my hair out.
> provided you remember to account for the current state of the notebook Notebook style development is considered an anti pattern in most situations for this reason. It is too easy to execute out of order. Even the original parent of this thread said they recite the entire notebook every time to ensure they catch these issues. But, it’s not perfect and you can have leftover state this way too if you’re not careful. M…
Re: Throw away your first draft of your code
#208Earlier quoted context omitted.
Loops are an abstraction over conditional branching and, depending on the kind of loop, some other things.
> Loops are an abstraction over conditional branching How?
Loops as deduplication is a very specific subset of looping that is very popular in some languages and almost nonexistent in others. If you don't have destructuring and convenient list literals you might never ever see it in the wild.
But even the Java 7 version (iterating an ImmutableList.of multi-nested Maps.immutableEntry of new FunctionN) can be workable despite its hilarious amount of repeated type annotations, if you have learned to stop worrying and love the tooling. Stuff like typescript makes it a breeze, so much that one might occasionally forget that it's not the regular form of looping.
Re: Throw away your first draft of your code
#209Re: Throw away your first draft of your code
#210Earlier quoted context omitted.
Yeah, this thread is a somewhat strange read. People don't seem to understand what "draft" or "prototype" means. Odd.
Just like management. I can't tell you how many times I've written a "Proof of Concept" that became production code.
Still managers always push against redoing work they can see working for the happy flow.