* test your core, make sure your core is strong
* don't test your http api
* don't mock
* don't test writing and reading from the database
* don't complicate your code to make it testable
* ... unless you deem fit
Not the OP but I count integration testing as testing integrations /between/ systems - wherever your code depends on something outside your codebase. You can mock this for unit testing.
Don't mock things that are already in your codebase. Use the actual object.
Common argument against this I've heard is "But then when something goes wrong it is harder to figure out where the problem is" - I have never actually experienced this myself, but I have, very often, experienced being reluctant to do any refactoring because I'd have to rip up all the unit tests because they are testing only implementation details
You definitely have some strong opinions about testing. I'd suggest being more specific so your guidance is more clear. "people who test what they think is appropriate" is really subjective and makes it seem like there's two camps: people who "get" the author's perspective, and those who don't. I've tried the "do" and "don't do" approach, but that's not enough information usually. Teach by examples. Lots of examples. Calling things BS isn't going to change someone's mind. I'd also re-enforce that these practices are for your codebase. Every project is different and has different challenges. There's a reasonable counter-example for each item in your TLDR, and "unless you deem fit" doesn't feel like it gives developers leeway given how strongly you state your opinions.
If you don't do 2 you may as well not test at all. You may do everything else and still fail your end APIs. Your users don't care about your core or mocks. They want end APIs to work
The rest just seem arbitrary. Can you make a change and be confident it works ? The last point sums up everything. "Use your best judgement"
reading those bills makes me feel quite hopeless, considering Gell-Mann Amnesia[1]:
Briefly stated, the Gell-Mann Amnesia effect is as follows. You open
the newspaper to an article on some subject you know well. In Murray’s
case, physics. In mine, show business. You read the article and see
the journalist has absolutely no understanding of either the facts or
the issues. Often, the article is so wrong it actually presents the
story backward—reversing cause and effect. I call these the “wet
streets cause rain” stories. Paper’s full of them.
In any case, you read with exasperation or amusement the multiple
errors in a story, and then turn the page to national or international
affairs, and read as if the rest of the newspaper was somehow more
accurate about Palestine than the baloney you just read. You turn the
page, and forget what you know.
It is horrible to think the same thing probably exists in politics, and I cant even imagine what goes through in fields I don't understand.
The blog has some interesting philosophy about collective "philosophical" inertia - everything is meta-stable, until it isn't. I can't help but think and feel that we are at or nearing a maxima change - we are pushing over the edge of our current local maxima, and many things about modern society will change all at once.
I feel this is common in the west, because people externalize internal conflicts, and they have to project their "righteousness" and "judgement" to justify their existence, as there is nothing left in ourselves besides atoms.
it was huge mistake for us, it was chosen for the wrong reason, to solve a non-problem, complicated everything without adding any value.
* cant find people for it and if you do they come because of the tech not because of the real world problems we are trying to solve.
* the no types thing makes people write tests that test for typos and make refactoring incredibly difficult because you have to fix gazillion pattern matching tests
* the tooling is just horrible, cant jump, because of pattern matching that makes it much more annoying
* phoenix was complete misfit for us as well, so i ended up hating it for no reason
so because of no-tooling and on-refactoring, accidental complexity only grows, and we ended up with much more fragile system with infinite failure domain.
that being said, i am sad that this was my first real world experience with elixir, in a project where it was not a good fit, so now i am totally biased against it. when i tried it briefly for few hobby projects it seemed like a quite cool language.
Maybe not to this extend, but if X (where X is whatever you are thinking about) had similar amount of people using it (especially junior people) this would happen there as well.
Other languages don't publish/import packages that are one line of code. I have never seen an issue like this with any other language that I've worked with.
Any sane developer that needed a one-liner like this would just manually implement it.
Not to mention that these sorts of functions are unnecessary in languages with a good stdlib or statically typed languages like rust, etc.
Know what happens every time people like you say this here on HN? They post the one-liner they would have manually implemented in their code base and it's wrong. The one that comes to mind is the "is-negative-number" package. Yes, the geniuses of Hacker News, after finding out there was an npm package for determining whether something was a negative number, could not correctly implement that function.
You and everyone here are not as clever as you think you are. This is why people prefer known-good implementations. The maintainer here did a bad release, big fucking deal.
As a stretch target: it's a bad idea to create demons out of an assortment of posts you randomly saw on HN. This site gets 3M posts a year. You can find basically anything in there.
What happens is that we each have pre-existing images that bug us (e.g. for example, people who overrate their own genius) and as we move around in the statistical cloud, random bits of whatever we run into stick to the pre-existing image and give it form. Poof, you have a demon—but actually it just became visible. Readers with other images see other demons and arrive at other generalizations. It's not good discussion because it's really about one thing but we make it about another, and comments that are skewed in that way limit their own interestingness. (I definitely don't mean to pick on you personally. We all do this.)
You may be shocked to find that there are very novice developers as well as those with 20+ years of experience who frequent HN. Using a few poorly written comments is a strawman, unless the comments you're referring to are written by the same people you're addressing here.
> Maybe its a failure of the language when it takes a third party package to determine if a number is greater than or less than zero?
It's not a failure of the language. Javascript has comparison operators like every other language, it's entirely possible to determine if a number is greater than or less than zero without importing a third-party package.
What it is is a failure of modern JS development culture, because apparently it's anathema to even write a simple expression on your own rather than import a dependency tree of arbitrary depth and complexity and call a function that does the same thing.
Their code would have been wrong even in strongly typed languages because it considered 0 to be a negative number. What language prevents you from making that mistake?
As opposed to blindly trusting and adding a dependency for a random library with a one liner?
I don't think the "don't roll your own crypto" argument really applies here. Of course we can come up with hypothetical situations where developers are incompetent or don't test their code at all. This includes armchair analysis for a post on HN, by non-javascript developers.
I would argue that it's still better than adding a dependency. Heck, you could even copy/paste the correct code.
I know I'm not a perfect programmer, so important functionality like this gets unit tested as necessary. :-)
A package with over 11 million weekly installs vs. a brand new implementation by a coworker, when I might not necessarily be around for the code review? Absolutely. I would blindly trust the package 100% of the time. Zero hesitation.
This happens because libraries installed by create-react-app depend on many other libraries (1026 transitive dependencies as of today).
As a comparison, Django, a large Python web framework, has only three dependencies (pytz, sqlparse, and asgiref), which don't have dependencies themselves
Perhaps, but I think the JS ecosystem encourages dependency explosion like no other. Looking at a 6 or 7 year old lazily written Rails app, with a lot of functionality written throughout the years, I see about 200 gems. Creating an empty app with create-react-app, it has about 1000 packages.
You can't use the very latest version of any software in Debian at all without adding a custom repository, at which point you have the same issue. So the comparison is not apples to apples.
You can use Debian Unstable, or maybe just use stable and reliable dependencies so that your software is also stable and reliable. That would require putting in some effort, though, and we can't be having that, can we?
The "slow and steady" approach works well for mature or stagnant ecosystems, but only when the packages are small enough that distribution developers can reasonably backport security fixes. That clearly doesn't work with big programs like Chrome and Firefox, so they have to resort to shipping the latest ESR version.
Writing JavaScript on Debian is practically impossible without sidestepping the package manager in some way. In a lot of cases, the hacks you have to do to run up-to-date software on a distro like Debian decrease reliability significantly.
You can do that with NPM if you pin your dependencies to exact versions, which is the same solution that you would use for any other package manager, and basically what Debian and other Linux distros do for you. I don't know why you think this problem is somehow unique to NPM or the JavaScript ecosystem.
And yet, somehow Debian isn't in the new every few months. There's a fundamental difference in culture, for one. But the fundamental difference in approach is there, too. Debian packages are vetted. npm packages are not.
How about a rolling release like openSUSE tumbleweed then? I have been using it for years, I generally update once a week and I have never broken my system due to an update. Never.
All of this is telling users how to avoid breaking Debian, and mistakes that they ought to avoid. This isn't Debian being broken and the users being collateral damage. This isn't a symptom of the very Debian ecosystem itself being fundamentally broken.
I spend considerable amount of time doing that,
but the content creators are so extremely aggressive, they make new channels with new clickbaits with same garbage, just to get the children's clicks. and they are so many!
especially now during covid19 lockdown, the garbage produced is intense. and of course our screen time is higher than ever.
I don't think this is true, the first human right is the right to die, and secondly the right to live.
So you can only live a life that allows you to die.
For example, if my mother is in a hospital dying from corona, and the system forbids me to see her (despite me taking precautions that I deem fit), I must revolt.
This of course sounds like nonsense, and I am also conflicted, but this is my intuition.
I was recently hospitalized for a suicide attempt due to years of chronic pain and depression as a result. I was not allowed to die. I get no help to live after being dumped back out when "stable" medically. I was not allowed any visitors due to the virus and it was very detrimental to my mental health. Now I am here alone trying to piece together a future. Nobody revolted...and I am powerless to. Frustrates me so much there wasn't help to live...but I am told I have to. Trapped in a room with no doors or windows and on fire. I don't see this "help" everyone says there is to get. Just people wanting thousands of dollars from me that I cannot pay for nonsense.
That's tough to hear. I've been close to such a situation, but managed to recover after a move across half the country (and self-medication). I imagine there must be some service you can call, to talk to someone who actually cares. I wish you strength in reaching out and getting through somehow.
TLDR: