Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> My objection is to the idea that it's always a good thing

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.



> Code is not art, it's instructions.

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.


Yes, this is fundamentally where I disagree with the person you're responding to and what seems like most programmers (or perhaps mostly web developers). If code is just instructions, it would look barely comprehensible to [most] programmers.

Again, maybe I came off as more extreme than I actually am, because I think that consistent formatting is a very good thing most of the time, but that last 5-10% that programmers in positions of power fetishize is where things can get frustrating and time can get wasted.

The worst is when linter rules are used for things that should be evaluated by a human being in code review. At a previous workplace, someone thought it was a marvelous idea to try and enforce things like functions having no more than 6 lines or some other poppycock. My current workplace is OK, but even then there are some stupid rules like not being allowed to assign `this` to a constant, even though the function in-scope is being re-bound by some stupid middleware making it impossible to use fat arrows or `.bind` (in JavaScript). Sorry, but I'll assign whatever the f*** I want to a constant that isn't escaping the current scope in any way. What's also funny is that I've never worked anywhere that didn't have `eslint-disable` sprinkled everywhere. In many cases, these rules should be warning instead of errors, but because programmers love errors for some reason, virtually every rule violation needs to be an error.


> What's also funny is that I've never worked anywhere that didn't have `eslint-disable` sprinkled everywhere. In many cases, these rules should be warning instead of errors, but because programmers love errors for some reason, virtually every rule violation needs to be an error.

Well I'm quite proud of having owned a certain repo at work which takes exactly this approach. If I have to disable a rule more than once, I take a good look at whether we need it at all, so we have extremely few `eslint-disable` comments in the entire codebase. It's one of the cleanest and most transparent codebases I've worked in -- but that's also an artifact of me spending long stretches working in it alone and having little oversight of how I spend my time. So there's a tradeoff :)


Programmers don't love errors. In fact, we see time and time again that even just seeing the word "error" causes programmers to forget how to program. It's their kryptonite.

But they don't see value in warnings. Either you have a problem that needs to be fixed or you don't.


> I'll slightly disagree here because code needs to be read by a computer and by your human teammates.

I still don't think that makes it art and this is why: art can't be simplified. Code can.

Take that to it's extreme and you see that code can be simplified down to nothing without anything being destroyed. Art can't.

Maybe you could say that the act of programming (or simplifying) is an artform, but that's not what we're talking about here.

We're talking about the product of that process, which is just instructions to accomplish a task.


> Take that to it's extreme and you see that code can be simplified down to nothing without anything being destroyed.

I disagree. The thing being destroyed is readability and common understanding with your fellow programmers.


My point was that removing code (not just reformatting it) without changing behavior is a gain, not a loss. Art is the opposite.

That tells me that the code itself is not important; the task/instructions the code performs is the important part. Therefore code is a utility, not an artform.

Yes I want written instructions to be understandable to humans, so my code conforms to tool-enforced formatting standards 100% of the time, not subject to artistic interpretation.


> Code is not art, it's instructions.

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.


It is a mistaken idea that work programming is or must be boring. I think you might mean "boring" as opposed to unnecessarily "creative" or complicated. But not all work code is boring, boiler-plate code.


I think of "boring" in this context the same way my dentist calls me a nice, boring patient. He means no surprises for either of us, nothing out of the ordinary, just a mouth in good shape with maybe a cavity or two.

That's how I like to see code. I don't want to struggle to figure out what you're trying to do. I want to be able to read your code and understand it easily and get on with what I need to do.

The opposite of this, keeping the medical context, would be the orthopedic surgeon who was so excited about how badly my then 25-year-old wife had smashed her wrist. "I never see this much joint damage in someone so young. It's incredible." Not words you want to hear from a doctor!


This is binary thinking and loses important nuance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: