Hacker Newsnew | past | comments | ask | show | jobs | submit | mangodrunk's commentslogin

I agree. Tests relying on mocks rarely uncover or prevent issues. They also typically make it harder to make changes. Very bad idea that should have been left behind years ago.

Why substitute dependencies? Is the isolation worth it?

For the same reason you isolate variables in a scientific experiment; to ensure you're controlling the test that you're running, and not accidentally testing something else.

To easily simulate failure cases, a range of possible inputs, bad data etc.

To make the testing process faster when you have hundreds or thousands of tests, running on multiple builds simultaneously across an organisation.

Off the top of my head :-)


I don’t think it’s worth doing that, and comparing it to scientific experiments doesn’t really apply.

You can do all that without mocks as well.

Making the tests run faster at the expense of better tests seems counterproductive.

Now you should think of reasons why you should not isolate.


> I don’t think it’s worth doing that

OK; it's your choice to do what you think is right.

> and comparing it to scientific experiments doesn’t really apply.

Why not? I think it's a fairly apt comparison; you have a theory ("this piece of code does the following things"), and write tests to prove it.

> You can do all that without mocks as well.

OK, but mocks make it easier and cleaner - so why wouldn't I do that?

> Making the tests run faster at the expense of better tests seems counterproductive.

Smaller, more focused, cleaner tests are better in my opinion; speed is a beneficial side effect.

> Now you should think of reasons why you should not isolate.

Why? That's your argument - it's not on me to prove it for you. If you can give me some good reason why mocking out the interfaces you are not testing is a bad idea, and some better alternative, then we can have a discussion about it.


I don’t want to take too much of a tangent, but in scientific studies, you are trying to understand some phenomena, and isolating variables can help with very complex things. A test is typically not that complex. Another example is the use of animals in testing medicine, it can help but it obviously would be much better to test directly on humans but we don’t for good reason.

Your position is reasonable and I do think isolation can be beneficial, but I still wouldn’t use mocking to do it.

>Smaller, more focused, cleaner tests are better in my opinion.

Cleaner is subjective. I can write “small” and “focused” functional tests that are also quick to run.

I am of the opinion that functional tests provide more value. They are testing more of the actual code than an approximation, which in turn gives a better indicator that it works. Functional tests are less likely to change unless the input/output changes.

Now let’s say you mock something in your function. Let’s say you make a change to that but the input and output are the exact same. Now you have to update your test.


> in scientific studies, you are trying to understand some phenomena, and isolating variables can help with very complex things.

Not to labour the point here, but no, the primary reason you isolate variables in a scientific experiment is that you want to ensure you're only testing the thing you intend to test. A medical study is a good example - you want to be sure that the effect you observed was due to the drug you're testing, and not some unrelated lifestyle factor.

Thanks for sharing your views on the rest; there was just one thing I wanted to expand on:

> Now let’s say you mock something in your function. Let’s say you make a change to that but the input and output are the exact same. Now you have to update your test.

I think the scenario you're describing here is: a function's dependencies have changed, but the inputs and outputs of that function have not; therefore even though the behaviour is the same, the tests still need to be updated. Is that right? In which case I would say: of course you need to update the tests - the dependencies have changed and therefore the behaviour of the function depends on different things and you need to model the behaviour of those new things in order to properly test the original function. To me this objection only holds if you are mainly focussed on code coverage; however, to me, good testing exercises the same code paths in multiple different ways to stress the code and ensure that the results are correct given all possible inputs. The dependencies of a function are also inputs of a kind.


I appreciate your thoughtful comments but we do disagree.

>Is that right? In which case I would say: of course you need to update the tests.

That is right. I think it is bad for you to need to update a test where the input and output are the same. Your mock is there for you to essentially ignore, but now you need to update the test. You now do not know if you introduced a bug.

You are losing out on encapsulation, the test should not know about the internals, generally speaking.

>The dependencies of a function are also inputs of a kind.

Typically that should not be a concern to the caller of the function.


Which is absurd that people use mocks considering the tests are supposed to help with refactoring but because of the mocks they can’t make a change without breaking the test.

I see slowing birth rates as a net positive.

People in these comments are considering to enslave women like The Handmaid's Tale before even asking if it’s a problem.


These are great, thanks for sharing. Are there any resources you recommend for this? I have come across the book Turtle Geometry but haven’t read it.


As someone who loves math, I do think math education would benefit from making the primary focus be probability and statistics for high school. In addition, financial math instead of algebra. I would replace trigonometry and geometry with discrete math as electives. And have calculus as another elective but taught without a focus on calculation.


As someone who went to economics school and had roundabout the math curriculum you suggested, I think it was a terrible idea. It leaves one with the wrong idea that math is mostly about handling money. Only later, when I got to study math for the computer science degree, I realized that financial math is only a small part of this marvelous huge pie of knowledge.


Thanks for sharing your experience. I do think it’s more important for most students to understand money than most of what is currently taught with algebra, geometry, trigonometry, and calculus. My main point though was to focus on probability and statistics. Right now, most students barely understand and remember what is currently taught and also lack knowledge to understand important matters that directly affect them.


When someone gets a name change and they are well known by their old name it’s misleading and confusing to never mention it. Just like Muhammad Ali‘s wikipedia page mentions his previous name.


I don't know if Heineman was well-known under her previous name or not, but it's literally in the second paragraph of the wikipedia article on her. And wikipedia generally does mention former names in the cases you are describing.[1]

y'all are just imagining things to be mad about.

It would be rude to mention the name in these comments on a post posted in honor of her death though, please don't.

[1] "As the guideline on birth names and gender identity note, birth and former names of transgender and non-binary people should only be included in the lead section if they were notable prior to coming out… Instead, this information may be woven into an "Early life" section… In cases where the prior name is known only as the result of being outed, editors may feel it would be giving it undue weight to include it in the article, unless it was subsequently widely reported in reliable sources." https://en.wikipedia.org/wiki/Wikipedia:WikiProject_LGBTQ%2B...


Right, the old name is correctly on the page. I haven’t mentioned the old name, but I don’t think it’s bad to do so to clarify who the person is. I don’t think it’s fair to pretend that someone didn’t have a previous name or that it’s taboo.


And neither does wikipedia. So what are we talking about?


Oops thats my bad! I didnt see it. Apologies! It is there! I was tired and missed it and spent a few minutes google searching. Just wanted to see her previous accomplishments!


I don't understand what is misleading or confusing about Rebecca or Ali. Either you respect someone else's personal preferences or not.


They may not be well known by that name. Ali is certainly well known by that name but many of his fights are under his previous name. I think the Wikipedia policy is fair, mention the old name. Even if someone doesn’t want anything to do with it, it should still be part of the biography.


You claim inclusivity but it comes at the expense of women. Men aren’t women. Men aren’t able to get pregnant. What this type of language is doing is erasing women and excluding them.


I agree with you and unfortunately it looks like many haven’t learned from mistakes that were made or want to even explore the possibility.


If your argument can’t hold up to scrutiny, then I think you may not know the position well enough or you need to adjust it. We can explain and show evidence why driving drunk is dangerous. We can show that vaccines are safe and effective. I don’t like wasting time with bad faith people, but to assume anyone who disagrees is wrong and not worthy of discussion is bad.


I don't agree. I think that shame is an important social technology for things like vaccines and drunk driving, where there's really no rational basis for disagreement. I don't know any vaccine hesitant parents who encountered some clever argument that proved to them they need to vaccinate their kids, but I know multiple who overcame their hesitation because they understood that it was expected of them and they would be judged harshly otherwise.


> really no rational basis for disagreement

If you want to have a good faith version of this conversation, I've seen many people have voiced rational concerns and be shouted down because people simply don't want to hear it.

Primary example - Many parents, including myself, made sure our kids got every single one of their vaccines...but we wanted to avoided giving more than 2 per month so we altered the schedule slightly.

Fully vaccinated, just took a simple precaution that put our minds at ease.

The number of people who will call you "antivax" for that, for simply questioning the dosing schedule and taking a minor precaution is shocking. And that's what really made all of this so much worse.

Nobody that I saw, prior to the Covid vax at least, questioned whether or not vaccines did what they said they do. People just question whether sometimes there can be side effects. The answer to that is obviously yes. There are vaccine courts and people have been awarded lots of money from them. So the next rational question that anyone would ask is..."If there can sometimes be side effects, in what circumstances are they likely? Are there any precautions that can be taken if we can identify what those circumstances may be?"

It's no different than if somebody is lactose intolerant, has a gluten allergy or a peanut allergy. Some people are predisposed not to respond well to conditions that many of us have no issue with.

That's not a rational basis for disagreeing on the efficacy of vaccines themselves. It is a rational basis to ask about the conditions that can create unintended side effects; we already know they are happening. Denying that is irrational on its own...so why not have the conversation?


> but we wanted to avoided giving more than 2 per month so we altered the schedule slightly.

Why do you consider this a rational concern/precaution? What evidence lead you to believe the vaccination schedule, which is generally-accepted in the medical community, should be spread out?

I can give you a reason it's likely not rational: babies are protected by their mother's immunity for approximately 6 months after birth. The current vaccination schedule[1] is largely built with this in mind. Delaying vaccines for no other reason than "it's too many too fast" concerns does nothing but increase the chance your child ultimately gets infected with one of the pathogens vaccinated against.

1. https://www.cdc.gov/vaccines/imz-schedules/child-easyread.ht...


Sure. The number 1 thing to understand is that without a clearly defined cause or even a hint of contributory factors for autism (think everything caused cancer or X may increase your risk of heart disease), there is an information vacuum.

Based on that people are left to speculate as to what influences appear to be probable on their own. One of the simplest correlations to make is of course, the sheer volume of vaccines on the schedule and whether the combined effect is creating any impact.

My wife and I went far beyond that and did speak to a retired OB who shared his own career observations with us. His explanation was that people naturally filter heavy metals, like aluminum, out of their systems but some people do it slower than others. Since aluminum is used in many vaccines, he recommended spreading them out to reduce the stress on the body to filter it out.

He went on to explain that he eventually started testing pregnant mothers and identified that when the high levels were often present in the mother, then many children ended up with the same issue. He started recommending a specific prenatal regiment to the expecting mothers to help correct it. Would even go as far as testing couples who were planning to try to have a baby before they were even pregnant.

Very kind man.


>The number of people who will call you "antivax" for that, for simply questioning the dosing schedule and taking a minor precaution is shocking. And that's what really made all of this so much worse.

Okay, but why does it matter what morons say? A doctor or immunologist would usually say "Eh, whatever" to this request. Did a doctor call you an anti-vaxxer?

>it's no different than if somebody is lactose intolerant, has a gluten allergy or a peanut allergy.

Guess what! A bunch of doctors 15 years ago were scared of peanut allergies and suggested without evidence "a simple precaution", of "don't give young kids peanuts", and now something like 8 million people have peanut allergies that could have been maybe prevented.

That's what this is all about. "Smart" humans don't exist. Tons of times what we expected is not what science finds. That 15 year advice that lead to millions of peanut allergies was overturned not by random people getting uncomfortable about not understanding things, but by doctors studying the actual question and coming to a conclusion that fit the data.

Is there any data any which way on your belief that a delayed vaccination schedule like that is "Safer"? Safer than what? Safer how? What theory is it done under? But your doctor didn't care. Tons of parents do that. Some researcher will pull those stats someday and say clearly "Eh, it doesn't do anything good or bad" or "it's clearly better/worse" and then we can make an educated decision.

Until then, it is unscientific by definition. Does that make you feel bad? It shouldn't, most of what humans do is unscientific. But that won't make it wrong.

There is zero "safe" things you can do to a human body. Giving someone a sandwich is not safe and in rigorous study would result in a "side effect" list a mile long, and maybe even a death. 1.7 out of 100k deaths are from choking.

>Nobody that I saw, prior to the Covid vax at least, questioned whether or not vaccines did what they said they do

There is tons of public information to the contrary. Jenny McCarthy for example was anti-vax two decades ago and shouting it from the rooftops.

>"If there can sometimes be side effects, in what circumstances are they likely? Are there any precautions that can be taken if we can identify what those circumstances may be?"

And we did that with the Covid vaccine and every vaccine ever made before it and it has always been clear that the vaccine is just as safe as any other. Anti-vaxxers are people who don't understand the statistics of that studying.

The conversation was had, anti-vaxxers don't like the outcome of the conversation.


> Okay, but why does it matter what morons say? A doctor or immunologist would usually say "Eh, whatever" to this request. Did a doctor call you an anti-vaxxer?

The doctor did act like it was a hassle and their office now has a sign refusing service to any parents who wish to deviate from the official schedule.

> There is tons of public information to the contrary. Jenny McCarthy for example was anti-vax two decades ago and shouting it from the rooftops.

Did she ever challenge whether or not vaccines worked to prevent what they were supposed to prevent? Pretty sure she was just talking about total volume.


Thanks for explaining your reasoning. I can see shame working for some, but I don’t think that is effective for a large group. It also has the adverse effect of making those who are shaming others look wrong and scared of discussing the subject. Also, there is a point where you can be wrong or need to adjust your perspective. Shaming others is not a good way to go about that. The enlightenment wasn’t built on shame but instead it used reason and open inquiry. It was a rejection of using shame which was a prevalent part of forced rules.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: