Hacker News new | ask | show | jobs
by feifan 1343 days ago
> Identify which of the files should be modified first.

I'm curious how many software engineers work this way — i.e. you need to make a big change, and you can determine a sequential order in which to make changes?

My working style is mostly jumping back-and-forth across all the relevant files and tests as I go, realizing new things that I need to change, and iterating until it all works end-to-end.

Am I the outlier, or is Maiao's expected workflow the outlier?

3 comments

What happens is you work somewhere that has stacked diffs and suddenly you learn how to shape your diffs to make them easy to review. Thinking of how folks will review your code in chunks while writing it makes it cleaner. Having small but easy to read diffs makes reviews faster and helps junior devs learn how to review.

Sometimes this doesn’t happen in which case you end up need to split your commit at the end. This is where git utterly fails. You end up needing git split and git absorb to make this productive.

Git split let’s you select which chunks in a commit should belong to it and then splits that into a commit and then you do it again and again until you have lots of commits. You’ll still need to probably test each one but the majority of the work is done

Git absorb takes changes on the top of your stack and magically finds which commit in your stack the each chunk should belong to and amends it to the right commit

You also need git branchless https://github.com/arxanas/git-branchless as it lets you move up and down the stack without needing to remember so much git arcana.

You don't need any of those things.

Git gui, which is part of the vanilla git distribution, already allows you to take a hunk out of an existing commit.

git absorb does sound like a nice convenience though.

I work that way. I generally constrain my changes to a single package, module or layer of the application at a time. The feature won't work end-to-end until after several PRs are merged. Sometimes it can take 15+ PRs, but it's a lot easier for reviewers if the changes are small and limited in scope and functionality.
You’re comfortable trading your time (increased number of diffs) for increased level of sanity checking from reviewers.

In my experience, that means days of increased effort - async reviews, more explanation needed for people who are unfamiliar with the code, an additional coordination layer of explaining where we are and where we’re going, increased probability of bike shedding, and waiting for your turn to get into CI.

Not saying you shouldn’t make that trade-off: if you feel you should, you probably should. But we need to be clear about the trade offs, to better understand when that makes sense.

Everyone at my work works that way. If the order isn't obvious or it's not easy to write in isolation, you just split it into 2 reviews/patches after the fact. if you send a big change for review, the reviewer will tell you to split it. usually very easy to split by directory