Live data from Hacker News

Linus Torvalds: 'I Do No Coding Any More'

linux.slashdot.org

171–180 of 246 posts

Re: Linus Torvalds: 'I Do No Coding Any More'

#171

I don't know about Linux Kernel, but in 99% of projects, 99% of commit messages are write-only.

It's self-reinforcing. People won't start reading them unless they know that they may contain usable information. Given that the process of making a clean history can make you understand the project better even if you are alone, saying they are write-only is misleading.

Re: Linus Torvalds: 'I Do No Coding Any More'

#172
post #115
post #109

Earlier quoted context omitted.

I look at commit messages quite often working on a 10+ year old code base. Bisect leads to the commit, the commit message explains why the change was made. I take the explanation from 10+ years ago and determine if the reason still applies today. Or, I bisect and there's a low quality commit from 10 years ago from a person long since departed that simply says "fixup" and I'm dead in the water.

Yup, way too many times I’ve encountered code that’s written in a peculiar way obviously for a reason, most likely to work around some issue, but it’s not clear what the issue is and whether it is otherwise resolved so that the peculiar code can be dropped. I bisect and it says “fix bug”, now I need to carry that crap forever or worry about reintroducing some unknown bug. (In case someone points out a comment is more…

Why is the reason to peculiarity not in the comments in the code itself?

Re: Linus Torvalds: 'I Do No Coding Any More'

#173

Earlier quoted context omitted.

This is the typical trade off of management. You surrender low level control for higher level control and the ability to get more done overall (since you’re coordinating the labor of dozens of people).

But honestly, what Linus is doing strikes me as a much lower level than what we normally think of as the "management tradeoff". I mean, he's reviewing a ton of PRs, actually writing code in is email client as suggestions to patches. I see that as more of a "principal engineer" type role than an "engineering management" role.

He's basically the lead dev in a comically huge yet strangely efficient group. But since it's still one project, it's still a very tightly integrated monolith, there is an advantage to doing this kind of quality/engineering management.

Re: Linus Torvalds: 'I Do No Coding Any More'

#174

> commit messages to me are almost as important as the code change itself This is high on my list of code craftsmanship points. It's very difficult to explain to young programmers who have never worked on an old code base how valuable this is when done well. In fact, often you hear complaints about how a code base "is crap", but more often than not I'd wager this is just a result of the context at the time not being…

Exactly. I always include the ticket or user story it's related to. It's a small effort, and if ever in the future someone finds themselves looking at this change and wondering what it's for, they can easily find the context.

I seem to be the only one in my team doing this, though.

(Obviously I also include a short but meaningful description of the change in the commit message itself. Again, not something everybody always does.)

Re: Linus Torvalds: 'I Do No Coding Any More'

#175

> commit messages to me are almost as important as the code change itself This is high on my list of code craftsmanship points. It's very difficult to explain to young programmers who have never worked on an old code base how valuable this is when done well. In fact, often you hear complaints about how a code base "is crap", but more often than not I'd wager this is just a result of the context at the time not being…

I tell them that if you make two related changes, in two different parts of the codebase, the commit message is the only thing that "binds" them, and should be approached as if it was a comment. I guess I'm saying that commit messages are comments but with more flexible scope.

(Now if I could just get them to squash, rebase and rewrite commit messages before publishing...)

Re: Linus Torvalds: 'I Do No Coding Any More'

#176
post #140

Earlier quoted context omitted.

I like to remind people that pull requests are an abstraction over a set of commits. I show people that they can click on each individual commit in a PR and see the granular delta. Surprisingly often I’ve learned that people really don't know you can do this! If they argue that you cant revert entire features remind them that merge commits are a thing. If they don't like lots of merge commits littering the history su…

> If your team insists on 1 PR == 1 commit Yeah that's the scenario I'm thinking about. The trouble I have with this is two things: - People inherently don't make the PRs as granular as a commit would be, because it puts load on other processes (like CI, review overhead, etc.) and slows things down that way. So you end up with PRs that are hundreds of lines instead of self-contained commits that are dozens of lines l…

It’s less common but there are actually CI setups that verify each commit in a PR rather than the tip of the branch.

Re: Linus Torvalds: 'I Do No Coding Any More'

#177
post #155
post #92

Earlier quoted context omitted.

I write detailed commit messages for every single commit I make(even though commits would be squashed on merges), I write detailed PR descriptions that included before/after screenshots in multiple resolutions whenever relevant. Never once did I have any indication that someone took their time to read descriptions or commit messages. In my previous job, I received some feedback from my manager that some people compla…

All the "code quality" people write shitty systems. You are too zoomed in if you think code quality is really important. It's kind of important, but your system likely has much more important things wrong with it than the "code quality". Things you could actually get fired for, or seriously reprimanded if the winds don't blow in your favor. Almost all "code quality" discussion in PRs is lightweight value judgements w…

Most of the code quality comments I make (and recieve) on PRs are about naming and comments, and they're mostly for future changes and maintenance.

Good example from a couple days ago: someone made a helper method for compressing something, with the signature

    string Compress(string value)
It was actually doing gzip followed by base64. My comment was to rename it to something like Base64Compress as well as change the documentation comment to state it was doing both. I wouldn't want someone else to inadvertently call that in the future if they stumbled across it, not realizing it was returning base64 and either double-base64 encode it, unnecessarily have base64 when not needed, or even end up with a bigger string than input because of the 33% increase. In a future PR, misuse of that Compress() method would be impossible to spot unless you happened to remember what it was actually doing.

Other times it'll be something like a constant 30s timeout hard-coded, and I like that to have comments like:

    // This usually takes 
or

    // 30s is max or (calling code) times out anyway
Why? Because if we need to change that, the comment helps let us know it's arbitrary and safe to modify or not. Without a comment (or good non-squashed commit message) someone in the future (maybr you) is doomed to waste time rediscovering a bug you already know about or researching if it's safe to change.

Re: Linus Torvalds: 'I Do No Coding Any More'

#178
post #176

Earlier quoted context omitted.

> If your team insists on 1 PR == 1 commit Yeah that's the scenario I'm thinking about. The trouble I have with this is two things: - People inherently don't make the PRs as granular as a commit would be, because it puts load on other processes (like CI, review overhead, etc.) and slows things down that way. So you end up with PRs that are hundreds of lines instead of self-contained commits that are dozens of lines l…

It’s less common but there are actually CI setups that verify each commit in a PR rather than the tip of the branch.

That seems immensely more painful for a nontrivial project though. It'll clog the CI for everyone and nobody will go back and rebase to make sure every single commit is a self-contained passing unit.

Re: Linus Torvalds: 'I Do No Coding Any More'

#179
post #155
post #92

Earlier quoted context omitted.

I write detailed commit messages for every single commit I make(even though commits would be squashed on merges), I write detailed PR descriptions that included before/after screenshots in multiple resolutions whenever relevant. Never once did I have any indication that someone took their time to read descriptions or commit messages. In my previous job, I received some feedback from my manager that some people compla…

All the "code quality" people write shitty systems. You are too zoomed in if you think code quality is really important. It's kind of important, but your system likely has much more important things wrong with it than the "code quality". Things you could actually get fired for, or seriously reprimanded if the winds don't blow in your favor. Almost all "code quality" discussion in PRs is lightweight value judgements w…

Code quality is absolutely important, although there seems to be a lot of variation in what people really mean when they talk about code quality. To me it's proper design, readable, maintainable code, that's easy to test and easy to change. To others it means the actual unit testing itself. So some it means the style you tend to enforce through linting rules.

Style is in my opinion very arbitrary. It's good to be consistent, and for that reason I guess it's good to have rules that are enforced, but with the number of times I have to revisit my changes because apparently I'm violating some obscure style rule, and therefore the build server rejects my change (or sometimes it even rejects it because someone else's change violated something, which makes me wonder how that ever got through), it feels like it's a waste of time to be too strict about it. A bit of personal style isn't going to kill anyone.

Re: Linus Torvalds: 'I Do No Coding Any More'

#180
post #109

Earlier quoted context omitted.

I look at commit messages quite often working on a 10+ year old code base. Bisect leads to the commit, the commit message explains why the change was made. I take the explanation from 10+ years ago and determine if the reason still applies today. Or, I bisect and there's a low quality commit from 10 years ago from a person long since departed that simply says "fixup" and I'm dead in the water.

Commit messages are supposed to be short. "Fixed stuff" is totally wrong. I usually write "Added ability to do foo with bar when baz is true." Commit messages aren't mutually exclusive to the inline documentation. I am making the case that inline documentation is far more important than commit messages.

Commit messages and code comments serve different purposes. The commit message should be about what you changed, so they help you find the interesting commit from a list of commit messages, whereas comments in the code should be about why the code is the way it is. Is it because of a bug in a library? Is it arbitrary? A quick fix that still has some debt? Did someone waste a lot of time on this?

Commit messages are about the change, whereas comments are about the state of the code.

Post reply on HN