Live data from Hacker News

Never use a dependency that you could replace with an afternoon of programming

blog.carlmjohnson.net

331–333 of 333 posts

Re: Never use a dependency that you could replace with an afternoon of programming

#331
post #140

Earlier quoted context omitted.

No, I won't beat them. But if it a limited subset that I can implement with twenty lines straightforward code, that will often be cheaper. I've been on projects where they imported xml-parsers many times bigger than the rest of the whole codebase just to send a well formatted order number.

xml and json are different beasts A json parser can probably be implemented in an afternoon. But a conformant xml parser can take months. There are some weird things in xml, for example, this is correct xml: ]] ]>>?>]> >?> And for external entities, you need an http client in the xml parser, although it is probably better to not support that part of the standard.

And we didn’t need a conformant xml parser, which I know is huge and complex.

Re: Never use a dependency that you could replace with an afternoon of programming

#332
post #201

A year ago I needed a min-heap to build a priority queue at work. So first I grabbed 'heap' from npm (272k weekly downloads) and set it to work. But a few days later I realized my code was executing slower than expected because it sometimes needed to clone the data structure, and the clone instantiation would break the heap invariant in the array internals. It turned out there's been an issue open about this since ea…

Wow. Could not be more glad I’m not in the javascript world.
Post reply on HN