Live data from Hacker News

There's no shame in code that is simply "good enough"

blog.phiz.net

21–30 of 68 posts

Re: There's no shame in code that is simply "good enough"

#21
post #15

one way to think about this is code as a "consumable" instead of as a "durable" good. There is an essential difference between a paper cup and a glass. Say you are throwing two outdoor parties a year, but otherwise will not serve more than 8 people. The best solution, if you start with nothing, is to buy a set of dishware for 8, and then throwaway plastic cups and plastic knives twice a year ad hoc. Code could be see…

> Say you are throwing two outdoor parties a year, but otherwise will not serve more than 8 people. The best solution, if you start with nothing, is to buy a set of dishware for 8, and then throwaway plastic cups and plastic knives twice a year ad hoc. Not really. Only if you've no time to look for good dishware (surprise party?), can't afford it this instant (or fall in the common pit of not doing the math for the l…

Plastic cups and plastic knives don't break like your fine china though. At parties, this is a good thing.

Re: There's no shame in code that is simply "good enough"

#23
post #15

one way to think about this is code as a "consumable" instead of as a "durable" good. There is an essential difference between a paper cup and a glass. Say you are throwing two outdoor parties a year, but otherwise will not serve more than 8 people. The best solution, if you start with nothing, is to buy a set of dishware for 8, and then throwaway plastic cups and plastic knives twice a year ad hoc. Code could be see…

> Say you are throwing two outdoor parties a year, but otherwise will not serve more than 8 people. The best solution, if you start with nothing, is to buy a set of dishware for 8, and then throwaway plastic cups and plastic knives twice a year ad hoc. Not really. Only if you've no time to look for good dishware (surprise party?), can't afford it this instant (or fall in the common pit of not doing the math for the l…

right; very inexact metaphor.

It's only helpful because code doesn't LITERALLY get consumed, in the sense that if you want to run a piece of code 1000 times (ever) you need 1000 copies, and you have one less every time you run it, or every one hundred times you run it a copy disappears or whatever, like a bag of chips that disappears when you eat it, batteries that get used up (after one full discharge with nonrechargeable batteries, after a while with rechargeable ones), or paper cups as in my example. Literally it's (in reality) very durable, it just becomes inappropriate or stop working or being effective because of the context, not the bytes themselves, which don't deteriorate. It doesn't deteriorate or disappear like a consumable good does, you don't need to buy another bag of it when you run out, it seems to be a bag of something that never runs out: so it seems obvious that if you're going to build a bag of something that never runs out, why not make that something absolutely perfect, you know?

It leads to engineers buiding everything like a ship (durable good) and coding nothing (or sys-oping) nothing like something consumable that they cannot see as using forever.

of course the metaphor is inexact:

any line of code you have on a reliable medium is in the same condition (literally the same characters, literally 0 difference) as when it was last written or updated.

Consumable goods get consumed or deteriorate, but code seems to "be forever" i.e. subject only to the license imposed on it and not its physical quality; this quality leads to overengineering, given the mentality that since it will be available forever, you might as well code it "for forever".

What I'm suggesting is that sometimes it's useful to look at code as though it were bags of manure (consumable) instead of a lot of land you or apartment/house you own in perpetuity.

This is just for resource allocation/investment decisions an engineer is making. A typical example is that it is VERY hard for an engineer to say, "I will write this in this one language/framework that I know really well, and is totally inappropriate, in 10 minutes, it will be like a paper cup. Then I'll direct resources elsewhere, and when I need a glass I will throw this cup away."

The tendency is to say "I can't fortify this paper cup, it doesn't scale, so 'why build sand castles'..."

I am saying that a consumable good (sand castle code) is often very appropriate given resource restrictions. It is also often VERY inappopriate, as when people do not own a dishwasher and tableware, but buy a bag of plastic and a bag of paper plates every week and throw it out every week. (People do live this way.)

It's a delicate balance; this is one tool in many in your arsenal for deciding where to allocate your resources. I should also specify that renting a durable good might be more akin to subscribing to a web-based service or whatever. Again, all these are analogies to help you make good time and resource investment decisions, and think of something in terms that are appropriate. It's easy to throw out a paper plate if you bought it once as hosting a very rare party that temporarily overloaded your capacity. It's very hard for engineers to realize that sometimes it's time to write that same paper-plate code and throw it away without ever washing it (investing more coding into it or trying to engineer a scalable architecture into it after the fact). Things to know about what you're doing up-front so you can make informed decisions and stick to them as your "household" evolves.

Re: There's no shame in code that is simply "good enough"

#24
post #20
post #13

"Perfect is the enemy of good enough; good enough is the enemy of all." [1] There's no shame in code that's 'good enough' but I think there's a danger in this article of missing an important point: you can't classify your output if you don't know its context and goals. If you're coding something that definitely won't be used again then make it 'good enough' for this use case, if you need it to be extended by others o…

I was confused about your point until I clicked the first reference. You made a slight misquote that change the whole quote. Good enough is the enemy of at all.

Oh, oops. Thanks for that! I actually miswrote it ages ago when I first read it. When I went to riff off it today I knew that I had liked the quote but I couldn't quite understand why. I told myself, "Ah Seb, this makes sense, you're just too tired to understand it!" ;)

Cheers.

Re: There's no shame in code that is simply "good enough"

#25
post #15

Earlier quoted context omitted.

> Say you are throwing two outdoor parties a year, but otherwise will not serve more than 8 people. The best solution, if you start with nothing, is to buy a set of dishware for 8, and then throwaway plastic cups and plastic knives twice a year ad hoc. Not really. Only if you've no time to look for good dishware (surprise party?), can't afford it this instant (or fall in the common pit of not doing the math for the l…

Plastic cups and plastic knives don't break like your fine china though. At parties, this is a good thing.

right, but forget fine china: some people would prefer to give their guests real plates, and do so when they have 10 guests, but don't have 100 plates, so when 100 guests show up on their lawn they use disposable plates. The reason doesn't matter. See my comment above about why it's hard to think of code as being a consumable good AT ALL (for any reason).

My point wasn't really about tableware, it was about disposable versus durable goods.

Re: There's no shame in code that is simply "good enough"

#26

This actually causes "coder's block" in me when I start a new project. If I have this cool app or site idea, it often never gets off the ground because I spend too much time trying to create some architectural framework that I assume I need. This is REALLY bad for me in Cocoa/Cocoa Touch apps. Objective-C is so verbose and writing classes is so "mechanically cumbersome" (having to write .h and .m files and duplicate…

I find that the limited free time (wife, kids, etc.) I have available for side projects forces me to prioritize. If I gold-plate everything, nothing will ever get done, so I simply don't write code that's not absolutely necessary. I will code very thin "frameworks" if it becomes obvious that it will save time over the long haul, but there is no "this might be useful someday" code. If it doesn't move the project forwa…

I read a helpful change of perspective for gold-plating perfectionists: instead of writing "perfect" code, seek the "perfect" compromise. :)

Re: There's no shame in code that is simply "good enough"

#27

The key I've found is not worrying about how beautiful or clever the code is, but how maintainable it is. If the code is designed properly, the only requirement I have is that I can go back into my code and change it easily to what I now need it to do. It should be malleable like silly putty. If I can do that easily, without requiring massive rewrites, then this means that the code can change as my requirements chang…

This has to be tempered, though, with some consideration of how likely it is that the requirements will change. Of course we might say "requirements always change" but there are definitely situations where to know with a high degree of certainty that you are writing something that will be used once or a few times and never again, or something small enough and well defined enough that the requirements can't change much. If you worry too much about maintainability on code that will never be maintained, you're wasting time.

Re: There's no shame in code that is simply "good enough"

#28

The key I've found is not worrying about how beautiful or clever the code is, but how maintainable it is. If the code is designed properly, the only requirement I have is that I can go back into my code and change it easily to what I now need it to do. It should be malleable like silly putty. If I can do that easily, without requiring massive rewrites, then this means that the code can change as my requirements chang…

I agree completely, this is usually the driving principle when coding, I don't spend a lot of time with premature optimization in terms of making the code run as fast as possible, etc but if I am face with an issue where I realize I haven't thought something through in terms of maintainability or ease in extending the code for similar purposes I know I will need sometime in the near future then I have no problem spending a lot of time thinking through these problems. In my opinion, this is really what pushes one to become a better developer as the time spent thinking about this sort of issue pays off later when a similar issue comes up again and the solution is already second nature.

Re: There's no shame in code that is simply "good enough"

#29
Joel Schindall, an EE at MIT, tells a good story about this:

The ship date for a chip he was managing was just a few weeks away when he got a call from a supplier informing him that a key component would be delayed. Worried, he went to one of the engineers who designed the chip and told him of the problem.

The engineer was not concerned; "I thought they might not deliver that component, so I left extra space around it where we can add these additional parts that do the same thing."

Joel was happy, but surprised, and he took a closer look at the chip. "But you didn't leave extra space for other components on the chip."

"Yeah," the engineer replied, "I just didn't think those would be a problem."

One of the harder jobs in engineering and design is anticipating problems. That engineer took the time to think carefully about the problems that might arise with each of the components on the chip, prioritized the risk, and only spent the time to really carefully architect the parts of the circuit that were most likely to be trouble.

It seems that software is the same way; the best coders will assess the risk of all the code they write, and only spend their time and energy to protect against the problems that are most likely to arise. That leads to code that is better than "good enough" but is not over-architected. Of course, that intuition is really hard to develop and impossible to perfect.

Re: There's no shame in code that is simply "good enough"

#30

Agreed with much of this! However I disagree with "that's the nature of software engineering. You never stop learning and evolving." The reason: burnout. My guess is that at least 10% of developers begin to lose enthusiasm for coding after a few years and then at some point either change jobs, become managers, or just have very little motivation to learn having seen the futility of it all. They may be forced to conti…

I agree with this for the most part, this is one reason I have fallen in love a bit recently with RAD frameworks, personally I have been using Spring Roo, which is somewhat similar to Ruby on Rails, but for Java, from what I understand. Basically, when working on a project, I want to take the shortest route to accomplishing the end need, maybe it won't be immediately scalable to thousands of users or fully optimized but as long as you don't paint yourself into a corner that can come later. I have noticed a lot of other developers are so caught up in the minutia that they can't see the forest for the trees, they care more about endless iterations, writing test cases, etc than just delivering something that works.
Post reply on HN