Earlier quoted context omitted.
> Micro-libraries are really good actually, they're highly modular, self-contained code Well I think that is the point, they're not self-contained. You are adding mystery stuff and who knows how deep the chain of dependencies go. See the left-pad fiasco that broke so much stuff, because the chain of transitive dependencies ran deep and wide. NPM is a dumpster fire in this regard. I try to avoid it - is there a flag y…
There is a "no downstream dependencies" option; it's called writing/auditing everything yourself. Everything else -- be it libraries, monolithic SaaS platforms, a coworker's PR, etc. -- is a trade off between your time and your trust. Past that, we're all just playing musical chairs with where to place that trust. There's no right answer.
Micro-libraries should never be used
171–179 of 179 posts
Re: Micro-libraries should never be used
#172Re: Micro-libraries should never be used
#173Earlier quoted context omitted.
They are not designed for modern use cases and certainly not well-designed according to modern understanding of this word. In fact they did not stood the test of time as something worthy of preservation, they only survived and mutated, because it is extremely hard to replace them. And of course we should blame the technology: the sole purpose of a standard is to be used by people. If people struggle with it the stand…
> And of course we should blame the technology: the sole purpose of a standard is to be used by people. If people struggle with it the standard is unfit for its purpose. 'People' is equivocal here. While complex, and (as you point out, in so many words) an evolved standard, the HTML/CSS/JS stack is arguably one of humanity's greatest achievements, up there with the invention of paper, or perhaps cuneiform. It's imper…
We deserve to go extinct.
Re: Micro-libraries should never be used
#174Earlier quoted context omitted.
This is just a discourse based on "I need to churn out something, I need that fast and I didn't start in the web game when Backbone and E4X were solid corporate choices". If you are not in a hurry, work in a solid team and have a good attention span, a lot of clickbait idiocy around JS may not happen. It's just that the lone inexperienced guy is one of millions inexperienced guys who are taught the wrong ways everyda…
I don't really see the problem with the CRA docs.
Re: Micro-libraries should never be used
#175Micro-libraries are really good actually, they're highly modular, self-contained code, often making it really easy to understand what's going on. Another advantage is that because they're so minimal and self-contained, they're often "completed", because they achieved what they set out to do. So there's no need to continually patch it for security updates, or at least you need to do it less often, and it's less likely…
> I would argue the problem is how dependencies in general are added to projects But you need the functionality anyway, so there are two dependencies: on your own code, or on someone else's code. But you can't avoid a dependency, and it comes at a cost. If you don't know how to code the functionality, or it will take too much time, a library is an outcome. But if you need leftPad or isNumber as an external dependency…
Could you for laughs explain for which cases these are, why they are needed and why they did it this way?
1) num-num === 0
2) num.trim() !== ''
3) Number.isFinite(+num)
4) isFinite(+num)
5) return false;
6) Why this specific order of testing? Why prefer Number.isFinite over isFinite?
https://www.npmjs.com/package/is-number
module.exports = function(num) {
if (typeof num === 'number') {
return num - num === 0;
}
if (typeof num === 'string' && num.trim() !== '') {
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
}
return false;
};
I would have just.... isNumber = num => isFinite(num+''.trim());
Why is that not precisely the same? (it isn't)how about...
function isNumber(num){
switch(typeof num){
case "number" : return !isNaN(num);
case "string" : return isFinite(num) && !!num.trim();
}
}
Is there a difference?IMHO NPM should have a discussion page for this. There are probably interesting answers for all of those looking to copy and paste.
Re: Micro-libraries should never be used
#176Earlier quoted context omitted.
HTTP, HTML and to some extent CSS are solid technologies that are very well designed and has been standing thr test of time. How people use them is another matter. But don't blame that on the technology.
They are not designed for modern use cases and certainly not well-designed according to modern understanding of this word. In fact they did not stood the test of time as something worthy of preservation, they only survived and mutated, because it is extremely hard to replace them. And of course we should blame the technology: the sole purpose of a standard is to be used by people. If people struggle with it the stand…
That is the state of things.
Re: Micro-libraries should never be used
#177Earlier quoted context omitted.
> I would argue the problem is how dependencies in general are added to projects But you need the functionality anyway, so there are two dependencies: on your own code, or on someone else's code. But you can't avoid a dependency, and it comes at a cost. If you don't know how to code the functionality, or it will take too much time, a library is an outcome. But if you need leftPad or isNumber as an external dependency…
If incompetent it provides a way to be sure? Could you for laughs explain for which cases these are, why they are needed and why they did it this way? 1) num-num === 0 2) num.trim() !== '' 3) Number.isFinite(+num) 4) isFinite(+num) 5) return false; 6) Why this specific order of testing? Why prefer Number.isFinite over isFinite? https://www.npmjs.com/package/is-number module.exports = function(num) { if (typeof num ==…
Only the fact that you can write a bunch of slightly different versions because of Javascript's flaws/features should be a sign that you just can't grab an arbitrary implementation and hope it matches your use case, and especially not if you don't/can't pin the version.
Re: Micro-libraries should never be used
#178Earlier quoted context omitted.
The whole web stack must die and be replaced. JS, CSS, HTML, HTTP are huge cost center for global economy.
Strongly disagree, but for JS. Current web stack is very complicated, HTML and CSS DOM is a rats nest and that's a superficial example. Adding asynchronous rpc pushes that way over the top. Luckily HTTP has been through the production crucible for 30 years. What I see is not a cost center but a reflection of basic truth: - UI and data representation is hard. - Developers use the tools they know about. But about micro…
Re: Micro-libraries should never be used
#179Micro-libraries are really good actually, they're highly modular, self-contained code, often making it really easy to understand what's going on. Another advantage is that because they're so minimal and self-contained, they're often "completed", because they achieved what they set out to do. So there's no need to continually patch it for security updates, or at least you need to do it less often, and it's less likely…
Micro libraries are ok - TFA even says you can use self-contained blocks as direct source . Mirco dependencies are a god damn nuisance, especially with all the transitive micro-dependencies that come along, often with different versions, alternative implementations, etc.