Live data from Hacker News

Ask HN: Before I write a single line of code, I

news.ycombinator.com

1–10 of 27 posts

Ask HN: Before I write a single line of code, I

#1
I'm about to start coding a new project, that is a little more sophisticated than my usual tinkering. So, I've been thinking about the primary use case, sequence diagrams of the systems, the data structures and the like, and I still haven't written a line of code.

How do you organize yourself before starting to write code? What works and what doesn't? Why? Or, is it just better to start coding and figure it all out on the fly?

Re: Ask HN: Before I write a single line of code, I

#7
> Why? Or, is it just better to start coding and figure it all out on the fly?

Yes it is. Write code towards the solution and see what it leads you. Then you might get into a "writers block" and can't decide whether data structure A or B is best. So you think about it some, decide which one you like and write more code. Then you might find out that you thought A was best but it turns out B was better. So you refactor your code base, write some more code and so on.

Re: Ask HN: Before I write a single line of code, I

#8
I think there comes a point beyond which planning can be used to avoid having the purity of your ideas corrupted by the inevitable messiness of their implementation. I've recognized it in myself, at least.

The only thing I can suggest is that you put your notes aside, set up a repo, branch and just write some code.

Re: Ask HN: Before I write a single line of code, I

#9
I'm tired of working for years on hobbies that ultimately get big and I think can turn into businesses only to find I have built this huge unmaintainable edifice of untested spaghetti that I have to shelve.

So now, whether it's on the job or on my home project time, I get the git repo and build scripts squared away with some awesome testing framework that constantly watches the file system and rebuilds and running my test suite as I'm working on the code. This way I can do TDD and get higher quality code more consistently.

Post reply on HN