by ravenstine · 2y ago · 0 comments
With woodworking, you can just do the thing. OK, I don't do woodworking myself, but both of my parents do, and I know that they don't spend their time bikeshedding or homogenizing their work. The tools they use are intended to help them accomplish something and aren't there to prevent you from doing anything.
It's possible to do personal software projects however one wants, but one will no doubt be faced with the modern compulsion to want to "do the right thing" and add a bunch of time wasting tooling. If you don't, and you share your code, inevitably someone is going to want to add a bunch of rules and bureaucracy to your software that was already working and free of serious problems in the first place.
I don't think wood working per se gives you more flexibility than building software. It's wood working as an individual, not part of a team, so you can make your own decisions and not answer to anyone. If you were a one man software consultant you would have the same amount of autonomy.
I'd like to mildly disagree. Using whitespace to group functionality together in "paragraphs" and aligning the horizontal indentation in the clearest possible way is not too far away from editing a short story to make it flow better.
Earlier today my linter rearranged multiple "key: value" one-liners into two-liners and the end result is both objectively and subjectively worse.
Like, in Prettier, adding a trailing comma to a short list of items will tell the formatter to put each item on it own line, while removing the trailing comma will keep each item in a single line (if the line length is not too long).
I do not think that word means what you think it means
You get to choose the problem spaces and teams, which is a degree of autonomy. But it is not quite so free as “making your own decisions and not answering to anybody.”
Not that they can’t find at work. It’s actively taken away from them.
Sure - perhaps not plumb to within +/- 0.001 radians, but there’s still an expectation that the wall needs to be vertical within some error tolerance band (even if not specified). Error correction happens real-time - the cabinet guy compensates for the wall error, and so on.
That’s also why I find residential construction so shoddy (the US at least) - electrical junction boxes are always a little off-angle, cover plates aren’t flush, etc.
:deep breaths:
But I think the biggest thing as I move up and spend more time reviewing code than writing it...style preferences make it so much easier to review code. Linters have given back years of my life at this point!
I would not be a fan of commit hook auto-formatting.
Nice. It adds a bit of spice to your git-bisect bug-hunting, to keep you on your toes.. Who doesn't like a good challenge?
And indeed that’s something I’d apply to software: both hobbyists and small companies are tempted to use professional tools (as in, intended for lots of engineers collaborating) for small projects or a low number of collaborators that don’t warrant such stringent rules.
Trying to de-romanticize it means you have absolutely no idea what motivates most of us.
Signed, someone with restored antique Stanley wood planes, Japanese saws and who drools over Lee Valley product reviews.
I spent a lot of time searching for and restoring old tools. I finally realized I was spending way more time on the tools than actually using them.
If you had a Woodcraft in town you’d only go to Rockler for things you can’t find at Woodcraft. Which is largely cabinet-making and air handling equipment.
Lee valley and veritas are mostly making reproductions of golden age Stanley tools before the race to the bottom (what the kids call enshittification) started, with a few omissions or improvements. They aren’t garbage, they’re low volume. That makes them less appropriate for people being paid by the hour or piece.
OP complained about all the strict rules software engineers have to abide by, while woodworkers get to have all the fun with sharp tools, nobody telling them how to use them, and generally freedom at how they do stuff. But that’s precisely the perspective of a highly compensated person doing manual labor for fun, not the one of a professional woodworker. It’s like someone cooking fancy once or twice per week saying chefs have such a great job because they get to dice the onion the way they like. Ask any professional chef how well that works.
Something you do as a hobby will always seem more fulfilling, because it’s a hobby. Anyone doing it professionally very likely also has strict rules to follow, you just don’t know about them - because you’re not a pro.
Ignoring hand tools, which give you precise, tactile control ... I'd still argue with this.
There are tools for specific things and they're meant to reduce error. But a router (woodworking) can be used to do half the stuff you want/need to do. A table saw can make straight cuts, rabbets, joinery.
The tools themselves (outside of specialty ones) are generally multi-purpose and allow for experimentation and creativity.
OP's complaint is about syntactical differences and that's just because his team doesn't agree with him.
And tbh, to me, the fun creative part in programming lies in architecture, not how I space my code. With woodworking, the creative part is how I put it all together but not the actual cutting part.
Isn't this part of the problem? If the purpose of code is to be understandable, the important communications shouldn't also be subtle. Your intention that the extra empty line before a block of code signals "This is the important part" is likely to be entirely lost on a reader of the code (especially in a codebase where the formatting isn't consistent so those spare lines are littered everywhere). Much better to leave a comment saying "there's a subtle but important thing going on here".
Sure, but don't let perfect be the enemy of the good. Well-meaning engineers frequently don't document their code at all. It's why I advocate programmers at least use descriptive variable names and function names; what I call "self-documenting code".
It still falls short of well-documented code but, as I say, gets you "good".
This is a take I don't think I've seen before. Is someone actually mad prettier is changing their single quotes to double quotes? Are they mad some line is breaking at some word?
Certainly I've never been. I use linters / formatters even when I'm working solo because the mere concept of having to think where to break lines is meaningless disruption from the actual goals I have.
If you _really_ want to break a line somewhere, just add a comment in between and your linter will comply.
Before back-tick strings in JS, it was useful to employ both single/double quotes for strings -- you'd use one most of the time, and then if you needed to embed a bunch of that quotation mark in a string literal, you'd switch to the other one.
'my string'
'my other string'
"insert values ('foo', 'bar', 'baaz')"
A formatter with naive "single quotes only" rule would obliterate the last one to: 'insert values (\'foo\', \'bar\', \'baz\')'
unless you remember, before you hit save, to add a directive like: // linter pwease preserve my qwotes
I still use linters and formatters every day, and on balance I think they're good to have, but it's ridiculous to pretend they don't have downsides, or that there isn't room for the occasional dash of human intervention in the automation; hence, the linters which have // linter pwease directives.Linting is a bit of a different beast, because linting includes changes to the code behavior itself, not just syntax. In JS there are so many footguns, that linting can often be pretty involved/strict. I think most of the people who don't like linting in JS either aren't aware of the footguns, or don't do very much code review and haven't worried themselves much with "what sort of bizare and unusual ways can this fail" sort of a thing.
Yes, both of these.
Obviously there are huge benefits to auto-formatting in large teams and popular open source projects, but some people also find benefit in having control of alignment, line breaks, indentation etc.
The only formatting that drives me up the wall is people using K&R braces in C# or Java. It's not 1970 anymore, and we're not all typing on green-screen terminals. It's like people fetishizing vim or emacs over modern IDEs.
AFAIK there is no rule in K&R requiring no braces for single-line blocks. In that situation, braces are optional.
The K&R style was hugely influential on Java and many other languages, it has nothing to do with green-screen terminals (I used those, as well as white and amber), it is just a style. I also moved on from vi, and use IntelliJ and Sublime most of the time.
The only difference between K&R braces and Java braces is that they combine lines on if-else. The Java guys did it because it enabled them to fit more code on to overhead slides. Overhead slide projectors predate green-screen terminals BTW...
I absolutely agree that consistency, in principle, is usually a very good thing.
My objection is to the idea that it's always a good thing, which it's not. Treating code formatting as rules rather than suggestions, in my experience, is a waste of time and unnecessarily tyrannical.
In terms of mere code formatting, I don't buy that there's a meaningful difference between 100% consistency and say 95%.
It's far more important that APIs and other conventions are consistent. When constructs in the code aren't consistent, it can be an absolute nightmare. When code isn't formatted well, it's usually just annoying and can be trivially fixed with automation.
If everyone doesn't follow the standards all the time then there are no standards.
Code is not art, it's instructions.
If you can't write instructions without adding your own avant garde whitespace brush strokes to it then yes coding for a professional company may not be your jam.
I'll slightly disagree here because code needs to be read by a computer and by your human teammates.
There are times when I'm frustrated because prettier is making a necessary but unintuitive choice and causing my code to become harder to read. But those are rare, and I would never trade them for the guarantee of readable code the other >99% of the time.
This is one of the major differences between hobby programming and work programming. When you're writing code as a hobby, it can be anything you want: code can be art, instructions, math, beauty, a means to an end, an experiment... At work, code must ultimately be a tool that creates profit. It has to be manageable, consistent, and boring.
How can it be a waste of time? The whole point is to avoid wasting time talking about formatting on PRs or seeing line noise on PRs because people have slightly different preferences or settings for code formatting.
What I absolutely detest, is any kind of code formatting comment on a PR. If it cannot be enforced automatically, it’s not worth arguing about, and definitely not something to hold a PR up for.
Yes.
> If a rule can be written into a linter, simply have it automatically formatted and never argue about it again.
That is unless one believes to have good reason to violate that rule, in which case suddenly time is being spent having practically the same conversation in this part of the thread that I started.
But my issue with formatting, while great most of the time, is that sometimes I want to violate it, and tooling around automatic formatting and format validation is usually installed with the intention that it is 100% correct all the time. Sorry, but as a senior programmer, sometimes it really should be up to me to decide whether code belongs on a single line, and I don't want to fight against automatic formatting or the CI pipeline throwing a hissy fit when I desire that discretion.
I think you are contradicting yourself a bit with
> Programming should actually allow for creativity, and where you decide to add spaces and newlines can actually add subtle but important communication as to the significance of a particular part of one's code.
The point being that something small might have significance to one person but not the other.
And that consistency is probably important, but there is a difference between consistency of your stuff and consistency between your stuff and stuff of others.
So I think what it boils down to is that crafting hobbies are often more fulfilling not (only) because they have tangible outcomes, but because you can do them on your own and on your terms.
If you were to do woodworking where you craft one piece of a bigger thing (say a part of some larger furniture), you would also have to produce very homogenic and precise output. And it probably would not be very fun and fulfilling.
Yeah, that's totally fair. I think conversations can be had with such cases, and I think that trying to effectively eliminate the conversation is a bad thing, which relates closely to my overall objection. Ironically, it ends up in conversation anyway unless a developer is always a good little goober and never marches out of sync.
Maybe my mindset would be different if I saw great software around me, but I see mostly crappy and user-hostile software these days. I'm not sure whether strict formatting "standards" is of meaningful benefit for the users.
> If you were to do woodworking where you craft one piece of a bigger thing (say a part of some larger furniture), you would also have to produce very homogenic and precise output. And it probably would not be very fun and fulfilling.
Yeah, I guess you've identified where my thought in response to woodworking falls apart. haha If it were one's employment, it could indeed be as confining as being a programmer at BigCo.
Shouldn't all the lines of code uploaded in a pull request be automatically formatted into the coding style preferred by the reviewer anyway? It should be like an automatic translation done by some bot or something.
It could obviously be done, but involves a yak shave that isn’t clear that it brings enough value to be worthwhile.
For linting (e.g. eslint in the JS-space), this is also possible, however, most linting-processes tend to run just long enough to be annoying when run on every commit. In the monorepo I work on we created a command "prep-pr" which specifically addresses this issue - run it before creating a PR, and the CI-pipeline will mostly be green, at least in terms of linting/unit-testing.
Thank you for that: "linters" (but as a person's role, not as a tool).
Pretty sure that contributed to my early retirement from the industry. It didn't used to be that way — perhaps because there were fewer cooks; perhaps because of a more cavalier, cowboy-style approach to coding.
I definitely preferred the days of the open range....
For larger projects however, not having tooling set up that enforces certain consistency is an absolute showstopper for me. I'll either introduce it or I'll quit; I simply do not want to waste my time with developers squabbling over arbitrary formatting-choices or irrelevant coding-style-details that can easily be enforced by some tooling.
Of course, developer-experience is paramount. Meaning, the tooling must be easy-to-use and generally not stand in the way. Otherwise it can indeed create a lot of friction which will annoy everybody. But once this has been set up (properly!), it will make a lot of silly discussions and choices obsolete.
Some consistency in a codebase is good. Naming consistency. Indentation. But people go too way far with it. Who cares if your JavaScript makes consistent use of semicolons? It doesn’t matter. It just doesn’t matter.
Right?
Carpentry isn't my jam, but I've taken up piano. I love it.
Consistency is dramatically overrated. We all read through comment threads on HN where each is written in it's own style and nobody has a problem understanding it. I read through open source repos all the time, which all have their own styles and which are often not self-consistent; my comprehension is not impaired. I have worked with teams that enforce linting with a religious fervor and teams where anything goes. The anything goes team is probably more productive and with a comparable rate of bugs (but I don't have the metrics to prove it). Personally, I don't feel like my comprehension is better or worse in one setting or the other.
The difference I do notice is that when there are no linters, nobody wastes time trying to figure out how to work around it for a few lines. A great example is Eigen matrix initialization through the stream operator overload [1]. You really want to manually format that so each row is on it's own line. If you use clang-format in such code, it will be littered with
MatrixXf mat(2, 2);
// clang-format off
mat << 1, 2,
3, 4;
// clang-format on
which adds a ton of unnecessary noise which does impair reading.[1] https://eigen.tuxfamily.org/dox/group__TutorialAdvancedIniti...
That's not true. Walls of texts get ignored or complained about. Grammar nazis show up if you use the wrong to/too.
If your typing on a phone autocomplete more or less enforces grammar and punctuation.
Also it's helped keep unused garbage out of the codebase also, which people tend to leave in there otherwise.
Also prettier has helped in me no longer reviewing MRs where every single line shows up in a file because their local machine has a different tab indent set or a different way to handle newlines (like with or without carriage returns, IIRC).
Sure it styles some things that aren't my preference, but I don't have to do it myself, it just automatically changes it all, so I can deal with it.
And if something is especially annoying or causes issues, I can usually get an exception added to the configuration, at least on my current team.
Symptom of nothing better to do, I have found ;)
Hard to picture someone who values their time blocking PRs on tiny stylistic nits.
These days they are pretty good at preserving vertical separation if it already exists and adding it if it’s missing.
This is why woodworking is actually a poor analogy for software development. A better analogy is carpentry. And when it comes to carpentry, it is much more important to ensure whatever you're building is extensible or follow certain specs. The cabinets you make, for example, need to fit into a certain space under or over the counter, and need to be homogenous to a large extent.
For hobby or artisanal pursuits, homogeneity isn't the goal. Often the uniqueness is a feature. But for mass production or large coordinated efforts, uniqueness is a bug. You don't want your car to be manufactured by someone who just felt like a 3mm panel gap felt more right than the 4mm gap the specs called for. Standardization makes coordination easier and that's why some products are better when they are homogenous while others are better when they're allowed to be "creative."
They would if their woodworking projects spanned decades and involved thousands of other woodworkers.
If you use a programming language that affords some guarantees like Haskell or even just C#, people seem to be less interested in linters.
It’s not necessarily a weakness of the language.
Languages like Haskell, C#, and Java don’t have the same amount of expressiveness as js, python, or ruby, so they don’t benefit as much from a linter, though I know places that use one for C# to prevent usage of the ‘var’ keyword
And enforcing new lines on else or catch after the brace, completely different to the language guides.
It looks a fucking mess.