Live data from Hacker News

How I Develop Things and Why

kennethreitz.com

1–10 of 35 posts

Re: How I Develop Things and Why

#2
I've started following this rule for all of my personal projects. However, many of us find it difficult to apply this rule to the software we write on the job. Most of the projects we work on aren't for us. They are for customers with vastly different needs. When you are creating that type of product, I don't think this rule really applies.

Re: How I Develop Things and Why

#3
> 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.

Re: How I Develop Things and Why

#4
post #3

> 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…

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).

Re: How I Develop Things and Why

#5
post #3

> 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…

I did this a while ago, and it's great for and initial version development. Now I find that customer journey mapping (putting yourself in your user shoes thru interactions, interviews) is highly complimentary process to the README outlining.

Re: How I Develop Things and Why

#6
post #3

> 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…

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.

Re: How I Develop Things and Why

#8
post #2

I've started following this rule for all of my personal projects. However, many of us find it difficult to apply this rule to the software we write on the job. Most of the projects we work on aren't for us. They are for customers with vastly different needs. When you are creating that type of product, I don't think this rule really applies.

Writing use cases and thinking about how the user is going to interact with your system is a very large part of creating correct and defect free software. Besides the obvious "will the user get it" it has a huge benefit when it comes time to design of your test suite.

Consider an imperative programming language where you can have null values. A null value most often means that some piece of data is optional or not required for operation. One example of this could be a form field for users to enter their real names. If you're making a social site ala reddit or something else you might want to make real names optional. Hence when someone fetches the real name field or passes it as an argument to another method it could be null.

Designing the use cases will help you because when it comes time to write the implementation and test cases you have a concrete understanding of why the value is null. If your program is sufficiently complex this real name field may end up being passed around to several seemingly unrelated modules. Having the use cases drawn up prior to implementation will help you quickly diagnose those crashes or null pointer exceptions and more generally answering the question "Why is this value null?"

Edit: Ineligibility ++

Re: How I Develop Things and Why

#9
This is basically customer testing, except treating yourself like the customer. This can be a good starting point, but is also dangerous for a multitude of reasons you already know and I won't reiterate. It's a good way to get started thinking about your solution, but does not replace talking to real customers whose problems you're trying to solve.
Post reply on HN