Hacker News new | ask | show | jobs
by smt88 3381 days ago
I don't think about "less code" when I'm writing code. You write something (ideally) once, and you read it many times. It's very inefficient to optimize for code-writing when the most expensive activities are learning, re-learning, and maintaining code. If your code is twice as long but easier to understand, you should just make it twice as long.

As far as more code reuse, the tools I mentioned don't affect that. A good rule of thumb is not to write the same code twice. If you write it a third time, move it into a reusable function. I actually rarely write the same code even twice.

So yes, most of the savings come from 1) not having to debug and 2) not doing maintenance until I want the code's behavior to change. With great static analysis and a type system, you might spend 5x more time writing before you run your code the first time, but it always just works when you do run it the first time. It's amazing.

This is a famous talk by Rich Hickey that will discuss some of these issues much better than I can:

https://www.infoq.com/presentations/Simple-Made-Easy

(Video on the left)

1 comments

Thank you for taking the time to respond and the link.