Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Before I start writing a single line of code, I write the README and fill it with usage examples. I pretend that the module I want to build is already written and available, and I write some code with it.

I write the same way. It forces you to think of how intuitive and natural your code should be. I've run into so much code that makes me wonder, "did they even consider how someone will want to use this?" Software should resonate with how people expect to use it, coming in with little-to-no understanding of the actual implementation.



This is very important, but he's making a deeper point, that the README ties it to the problem it solves. It's possible to make a beautiful, intuitive, natural solution that nobody needs (not even yourself). From the user to the code, it goes:

  problem -> usability -> code
Although intriguingly, pure mathematicians create solutions for their own sake (without reference to a problem), and it sometimes (often?) turns out to have practical application anyway e.g. http://en.wikipedia.org/wiki/G._H._Hardy#Pure_mathematics

BTW: I just noticed you can resize the reply textarea by dragging the bottom right corner. There doesn't seem to be any JS or CSS in the HN source to do this, so I guess it must be in Firefox 9; google says chromium has it too. Seems about 1.5 years old :(


Pure mathematicians are always motivated by a problem, even if it isn't a "real world" problem.


So might they too fall prey to the same issue, of losing sight of the problem they are solving?

i.e. that the equivalent of a README would also help pure mathematicians? I guess that would be a statement of the problem: a formal definition of assumptions, and the outcome (if possible). Though I think getting to that point would be where most of the work is.


reply your BTW: modern browsers support that feature, it could be altered by css code:

resize: none | both | horizontal | vertical

many browsers use both as default


Commonly called use cases. http://en.wikipedia.org/wiki/Use_case

I don't have a particularly favorite ideology or process myself but the important think is THINKING about the software you are going to write BEFORE you write it. To that end use whatever works.

If you need a formal process involving use cases with a specified and standard format great. If writing the README does it for you then more power to you. The important aspect is the thinking.


I write the tests first which is kind of the same thing except that I can actually execute that API and see if what I wrote actually works.

Writing good tests first also helps me constrain my implementations to be as simple as possible as well. Otherwise my tests get hard to write and that's a sign things are probably going in the wrong direction.

Often though you can't have your cake and eat it too. There are two schools of thought: worse is better and the right way. The former way eschews simple APIs for simple implementations. The latter is pretty much the opposite.

I'm currently working on a project where I'm trying to maintain a simple API across three different, related services. One of those services has such a simplistic interface that maintaining the simple API that the other two have has made the implementation comparatively complex.

Now I have to take extra care to make it as simple as I can... but it's still complicated. Which means my poor future developer who has to maintain this thing will need lots of documentation in order to understand it (fortunately I maintain TODO lists and notes as I go to accompany my stories... forming a sort of journal of my development process for each project; it makes it easy to pull out useable "how and why" documentation).


No, written tests first means you make the code easy to test. That may make it easy to use to, but it is not likely. Easily testable tends to mean that the class knows to little. And as a user that you have to tell it too much.


> Easily testable tends to mean that the class knows to little.

No it doesn't. You've got a pretty big job proving that ALL TDD does that.

Have you ever read python doctests? They are a perfect example of tests that describe both functionality and usage.


I said tends to mean. That does not mean that it is true all the time, but that, a priori, it is the most likely outcome.


The problem is that the worse is better school usually wins over the long run. Jamie Zawinski has a great essay on this [1].

Unix was a "worse is better" MULTICS. DOS was a "worse is better" CP/M. Windows was a "worse is better" MacOS. The advantage of simple implementations is that you can get them in front of users right now, and then iterate your implementation until you have something that's cheap and adequate. Not perfect. Not even great. But adequate. However, as the essay points out, cheap and adequate today beats pricey and perfect tomorrow every time.

[1]: http://www.jwz.org/doc/worse-is-better.html


> Windows was a "worse is better" MacOS

Bad example, MacOS was out years before windows. Microsoft just got a massive market hack. It had nothing to do with solving a problem directly and then iterating...


MacOS (not that it was then branded as such) - 1984. Windows 1.0 - 1985. So not quite years really.


Windows 1.0 was just a fancy dosshell. Windows 3.0 should count as 1.0 in this case I think :)


Frankly I think you could make an argument even Win3 wasn't all that much to write home about....

(I confess to still mild incredulity that MacOS beat AmigaOS so thoroughly in the market, being both more expensive and substantially less powerful in both hardware and software. If Commodore had done their jobs properly, we'd be saying Steve Who?)


january 1984 vs november 1985... you going to get pissy about 3 months?

My point is still valid.


It's by Richard Gabriel.


It kind of reminds me of an interview with Larry Stroman. He was a comic artist that I really liked on X-Factor and someone asked him how he approaches drawing a comic. He stated that he actually starts with the very last page and then goes back to the beginning to work his way there.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: