News for hackers. Stuff that matters.
Re:Never use a dependency that you could replace with an aft... by VHRanger on Tuesday August 11, 2020 @04:00PM (#24125270)
Found the NPM user.

Dependencies have costs:

- Dependencies break over time. They have a nonzero maintenance cost.

- They impose API boundaries on you that may not fit your existing data structures

- It's harder to change underlying bugs

- They might introduce security issues

Sure, use dependencies. But there's a reasonable position between "never write any code" and "never take on dependencies". Of which NPM is one of the only ecosystems being at one extreme.

Re:Never use a dependency that you could replace with an aft... by BigJono on Wednesday August 12, 2020 @02:46AM (#24129213)
This is pretty much spot on. Except you also missed the main cost, which is the insane amount of time it takes to learn the 85 dependencies on your project to an extent that you actually understand what your code is doing.

Every single project I go into seems to have a smorgasboard of dependencies, then when I take the time to investigate one of them I find out it's being used incorrectly by at least 50% of the team because they don't even understand how they work at the most basic level. Which is pretty understandable because by the time anyone gets through understanding 10 of the 85, they've probably been kicked off the team for not actually building anything.

People love to say rubbish like "write less code!", as if LoC is the only metric that matters (weren't we past that thought process by the 90s?). Which goes a long way to explaining all the fucking terrible codebases I have to work with where it's impossible to accomplish anything without reading documentation for 8 hours, when it would take 20 minutes to just read even a semi-readable piece of code that implements whatever requirements you need from the dependency.

Re:Never use a dependency that you could replace with an aft... by greyhair on Wednesday August 12, 2020 @08:55AM (#24131559)
But then lets talk about internal dependencies.

On a C code project for a large Fortune 100 company a half dozen years ago, I encountered a pesky header include that made no sense. And that header was part of a patch that I really did not want to pick up, so I started digging into it.

Turns out that they had some constant in the code, and the developer just did a grep for that value in the source tree, and that constant already existed in an existing header file, so they just included it.

And that CONSTANT_VALUE_STRING had nothing to do with the technology that the C source was addressing. So some lazy slacker pulled in a random header file that contained the proper constant value for an unrelated technology.

The dependency on that was pure lunacy on so many levels.

And that was an internal dependency, not an external library.

So the lesson here? Not all dangerous dependencies are external.

Re:Never use a dependency that you could replace with an aft... by scarface74 on Tuesday August 11, 2020 @04:42PM (#24125735)
I could say all of the same things about the in house tools that the “architect” wrote three jobs ago - including the bespoke ORM, object mapper, and logging framework.

Or two jobs ago where two developers who had worked at the company for 10 and 15 years respectively were maintaining a bespoke 15 year old EHR written in PowerBuilder and depended on SQL Server 2003 - in 2016.

Every company thinks they are their own special snowflake where cross cutting concerns can’t be handled by a third party.

Re:Never use a dependency that you could replace with an aft... by JackFr on Tuesday August 11, 2020 @04:54PM (#24125864)
I’ve worked with dozens of guys who loved to reinvent config and logging frameworks, because ... I don’t know why.

I suppose because it was easier than working in the actual problem domain, which they knew little about and didn’t care to learn.

Re:Never use a dependency that you could replace with an aft... by nothal on Tuesday August 11, 2020 @06:06PM (#24126577)
Herding devs to work on the boring-useful things instead of the interesting-solved things is slightly easier than herding cats.
Re:Never use a dependency that you could replace with an aft... by karmakaze on Tuesday August 11, 2020 @09:31PM (#24127787)
Funny you should bring up these as examples. I've made (1) and (3) using an existing object mapper. They were made out of limitations with JPA/Hibernate and for higher-level functionality in logging. The ORM was never sent to prod. The logging events were gold. Specific events were 'major' and filtering on a user ID in a narrow timespan could show the expected/unexpected events for the traces as a sequence diagram through all the microservice layers. Clicking on an event then searched Loggly for all logs for trace-id at time. It got to the point that non-techs were answering customer issues with it and we hardly had to check/wait for Loggly to answer.
Re:Never use a dependency that you could replace with an aft... by andrewstuart on Tuesday August 11, 2020 @04:04PM (#24125325)
>> Found the NPM user.

Ya got me ... pypi, crates, NPM, gems, cpan I'll use em all! Shhhh.... if my employer finds out they'll fire me.

:-)

Re:Never use a dependency that you could replace with an aft... by parliament32 on Wednesday August 12, 2020 @02:14PM (#24135006)
Everyone who's used NPM in production for a not-insignificant amount of time has realized just how bad nodejs dependency hell can be. Unfortunately, webdev-du-jour has decided pulling in a hundred npm packages is better than writing a few hundred lines of code.

I keep hoping things like [1] are a joke but I'm starting to suspect they're not.

[1]https://www.npmjs.com/package/is-odd

Re:Never use a dependency that you could replace with an aft... by 5Qn8mNbc2FNCiVV on Wednesday August 12, 2020 @06:42PM (#24137930)
I'm sorry that my framework and bundler are using so many packages. Lemme just quickly install Android Studio and download a few gigabyte to develop and build my application. Ah yikes I'm on a different version, need to redownload now.
Re:Never use a dependency that you could replace with an aft... by parliament32 on Thursday August 13, 2020 @01:05PM (#24145572)
At least Android Studio doesn't break when you try to deploy it a few months down the line (with package lock), with the exact same version, because a dependency of a dependency of a dependency made an unreviewed and untested "security fix" that caused a regression.
Re:Never use a dependency that you could replace with an aft... by misterpurple45 on Thursday August 13, 2020 @05:21AM (#24141423)
And the is-odd package.json requires is-number! Jesus...