News for hackers. Stuff that matters.
Re:Never use a dependency that you could replace with an aft... by lordnacho on Tuesday August 11, 2020 @03:51PM (#24125149)
It's a matter of judgement, but here's a few observations:

- With a little experience, you know what gets fiddly and what doesn't. Today for instance, I needed a way to remove tags in an SVG document, which looks a lot like HTML tags. I quickly ended up finding that Regex is not the solution (a well known guy on SO wrote an answer that looks like a huge warning sign). I also couldn't enumerate all the corner cases. So I found a lib that does it, along with an SO answer that turns it into a two-liner.

- Dependencies vary in quality. Some are basically like another standard lib. Boost for instance is very well used. The tough ones are where the lib seems to be "finished", where there seem to be few commits recently, but the project was once lively and functional. IIRC libev comes to mind here. And then there are the totally dead projects, where there's a load of issues open and nobody saying anything.

- Try to lock down versions. If you get a thing working with a certain version, there's no reason you need the newest new as soon as it's pushed. You can probably live with doing a scan for updates now and again.

- Your afternoon of programming needs to have a clear end. That hashmap you wrote will very likely spew out issues over the next few days. CSV parser, maybe. Bessel function, that'll work.

Re:Never use a dependency that you could replace with an aft... by JadeNB on Tuesday August 11, 2020 @03:58PM (#24125252)
> a well known guy on SO wrote an answer that looks like a huge warning sign

For those who are in today's 10000, you might mean this piece of art: https://stackoverflow.com/questions/1732348/regex-match-open...

Re:Never use a dependency that you could replace with an aft... by lordnacho on Tuesday August 11, 2020 @04:02PM (#24125299)
That's exactly it! Luckily I hadn't started coding when I found it.
Re:Never use a dependency that you could replace with an aft... by yoz-y on Tuesday August 11, 2020 @04:25PM (#24125549)
The old classic. I still end up using regexes when I need to clean up HTML because even though it's not the right way, it's the way that is sufficient 95% of the time.
Re:Never use a dependency that you could replace with an aft... by jjkaczor on Tuesday August 11, 2020 @04:08PM (#24125368)
Re:Never use a dependency that you could replace with an aft... by earthboundkid on Tuesday August 11, 2020 @08:02PM (#24127334)
Specifically on the SVG filtering example, which I think is a good illustration of when to use or not use a dependency:

Writing an SVG (or at least XML) parser is a necessary task for writing a filter that doesn’t get stuck due to weirdo issues. That is way more than an afternoon of work! But once you have a parser, dropping tags you don’t want or transforming them somehow is totally an afternoonable task size. So, do use a dependency for SVG parsing, but don’t look for a special “SVG filter all” package. Just do the filtering yourself.

Re:Never use a dependency that you could replace with an aft... by rndmze on Tuesday August 11, 2020 @07:05PM (#24127003)
>Try to lock down versions. If you get a thing working with a certain version, there's no reason you need the newest new as soon as it's pushed. You can probably live with doing a scan for updates now and again.

Agree ! it irks me a lot that I often see update bots tracking new releases.. it is just begging to be exposed to regressions.

We need to find a happy medium though. Otherwise whenever you actually need to update something (e.g. you need add a new dependency which only handles one of your other dependency if it jumps 20 releases ), you have a huge version gap to cover.

Re:Never use a dependency that you could replace with an aft... by AnimalMuppet on Tuesday August 11, 2020 @04:30PM (#24125613)
Your dependency that you could code "in an afternoon" may handle far more corner cases than you suspect. (That may be what you meant by "fiddly".) Sure, you don't care about covering all those corner cases... but you might care about some, even some that you haven't thought about yet. And you might care about some more next month. That can make that "afternoon" take a lot longer than you expect.
Re:Never use a dependency that you could replace with an aft... by sunchiz on Tuesday August 11, 2020 @05:53PM (#24126477)
Depending on Boost is not a good idea unless there is no alternative in the standard library nor easy to implement.