News for hackers. Stuff that matters.
Re:Write code that is easy to delete, not easy to extend (2016) by ChrisMarshallNY on Wednesday November 04, 2020 @11:18AM (#24990364)
The best code is the code you don't write.

I'll sometimes spend a couple of hours on a method, removing unnecessary code.

It does NOT always end up with more performant code (sometimes, the opposite), but it does reduce the "I don't wanna remove all that code" surface, and it usually* makes the code easier to understand.

* I write Swift. Sometimes, less code is more obscure code, and I often have to go back and put code I removed back in, to make it more understandable.

Re:Write code that is easy to delete, not easy to extend (2016) by austincheney on Wednesday November 04, 2020 @11:30AM (#24990469)
> The best code is the code you don't write.

I envision your comment will be taken out of context to literally justify adding mountains of code written by other people. Invented Here Syndrome

Re:Write code that is easy to delete, not easy to extend (2016) by ChrisMarshallNY on Wednesday November 04, 2020 @12:23PM (#24991021)
:) Never even thought of that.

Not necessarily a bad thing, if you are good at selecting dependencies.

But it can be a very, very bad thing, if you are not so good at selecting dependencies.

Re:Write code that is easy to delete, not easy to extend (2016) by lucideer on Wednesday November 04, 2020 @12:28PM (#24991075)
I've seen both cases (people over-avoiding dependencies to detrimental levels, and people who are VERY bad, and very zealous, at selecting dependencies). While I think it varies per language community; overall, the latter seems more common.

That said, the worst codebases I've worked with were examples of the former. So it's definitely a tricky balance.

Re:Write code that is easy to delete, not easy to extend (2016) by ChrisMarshallNY on Wednesday November 04, 2020 @12:33PM (#24991131)
My codebases can be difficult to maintain (I know, because I'm the one that has to maintain most of them).

It's not because the code is bad. Quite the opposite, really. It's well-structured, and incredibly well-documented.

It's because I tend to do some fairly ambitious things, and write in a modular, layered fashion that can distribute functionality throughout the stack.

I also tend to write in a fairly asynchronous fashion (would you call it "reactive"? I dunno. I've been writing code like that since long before "reactive" was an official buzzword).

Can be hard to grok.

Re:Write code that is easy to delete, not easy to extend (2016) by daitangio on Wednesday November 04, 2020 @11:48AM (#24990659)
I TOTALLY agree. As Solution architect, sometimes my work is

+ simplify it + reduce it + make the code more readable

When not possible, make at least more readable, like choosing the right method & variable names.