Live data from Hacker News

Ask HN: What change in your programming technique has been most transformative?

news.ycombinator.com

21–30 of 215 posts

Re: Ask HN: What change in your programming technique has been most transformative?

#21
I stopped doing small commits. In the past as soon as I was "done" with something I would commit, even if one line.

What would end up happening sometimes later in the day I would decide revert or modify the change, so my commit history ends up flooded with bunch of small commits.

I ended up writing a script that checks my current work, and if enough changes or time has past, then a commit is recommended:

https://github.com/stvpn/sunday/blob/master/git-train/git-bo...

Re: Ask HN: What change in your programming technique has been most transformative?

#22
post #7

I would say: Automated testing and a functional programming mindset. Even for legacy projects, starting with adding regression tests for every bug you find is a great way to introduce testing. And when you add new features, you can write tests for that as well. I find that a FP mindset is helpful mostly because it tends to reduce the amount of global or spread-around state. This in turn makes testing and quickly iter…

You had me at automated testing.

+1

Re: Ask HN: What change in your programming technique has been most transformative?

#23
Leaning on the type system for as many guarantees as possible. A few of my teams use Kotlin's sealed classes and extension methods to prevent a lot of goofy invalid state and improve composability (using a Result sum type very similar to what Rust has built-in).

I liked this article I recently came across discussing the topic: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

Re: Ask HN: What change in your programming technique has been most transformative?

#24
Many incremental changes (some already mentioned here) but none comes close to grokking macros in Lisp and lisp-like programming languages such as Common Lisp, Scheme, Racket, Emacs Lisp and Clojure. That was truly, truly transformative.

Re: Ask HN: What change in your programming technique has been most transformative?

#25
post #21

I stopped doing small commits. In the past as soon as I was "done" with something I would commit, even if one line. What would end up happening sometimes later in the day I would decide revert or modify the change, so my commit history ends up flooded with bunch of small commits. I ended up writing a script that checks my current work, and if enough changes or time has past, then a commit is recommended: https://gith…

I have the opposite problem, my commits are way too large and I'm trying to get in the habit of making more frequent commits as you can always squash them.

Re: Ask HN: What change in your programming technique has been most transformative?

#26
post #21

I stopped doing small commits. In the past as soon as I was "done" with something I would commit, even if one line. What would end up happening sometimes later in the day I would decide revert or modify the change, so my commit history ends up flooded with bunch of small commits. I ended up writing a script that checks my current work, and if enough changes or time has past, then a commit is recommended: https://gith…

You can have your cake and eat it too by initially generating a series of small commits and then going back later to reorder them and squash them into a much shorter series of logically coherent commits.

This makes it way easier for someone (possibly you) looking later to understand what was done and why.

(I once almost took a job where the repo was just a series of huge commits taken at more or less regular intervals, but with no logical coherence and no attempt to document what was happening. Noped right out of there.)

Re: Ask HN: What change in your programming technique has been most transformative?

#29
Not mentioned yet

1) Start with consistent naming conventions, notation and structures

2) Rely on autocomplete to simplify typing/readability/programming effort. It’s a tremendous force multiplier.

Ninja’d

3) TDD

4) Functional programming

Re: Ask HN: What change in your programming technique has been most transformative?

#30
I ask myself what's the smallest, dumbest, least-coupled program I could possibly write to get the job done. Turns out that the answer is often "very", and short, simple programs are a lot easier to produce bug-free and work with over time.
Post reply on HN