Comment by delichon

Comment by delichon 11 hours ago

34 replies

I was using an angle grinder to strip paint off of a large table top and necessarily had to remove the guard. This is one of the most dangerous tools I have and I'm very aware of it, so I carefully gripped it toward the end of the handle well away from the disk. For the first few minutes I was very conscious about the position of my grip. Then a half hour later I glanced down and saw my top finger about a centimeter away from the spinning disk. I had gradually choked my grip up in order to get better leverage. Another few seconds and it could have become a more memorable incident. I normalized my deviance just by failing to notice it for a few minutes.

I see the same forces working on my software practices. For instance I start with wide and thorough testing coverage and over time reduce it to the places I usually see problems and ignore the rest. Sometimes production can be nearly maimed before I notice and adjust my grip.

123yawaworht456 11 hours ago

> Another few seconds and it could have become a very memorable incident.

it takes a bit of pressure for an angle grinder to cut, even when you're cutting soft material like wood. accidental contact with a spinning disc would give you a nasty flesh wound, but you wouldn't lose your fingers or anything.

the real danger is the disc breaking up at 10K RPM and shrapnel flying in your face. you might easily lose an eye.

  • DavidPeiffer an hour ago

    > the real danger is the disc breaking up at 10K RPM and shrapnel flying in your face. you might easily lose an eye.

    For anyone wondering, OSHA would tell you to use safety glasses and a face shield. Neither is sufficient protection alone.

    You should also do the "ring" test before mounting a disc.

    https://youtu.be/QSQiLxDBpu8

  • klodolph 10 hours ago

    That’s not the only real danger.

    The angle grinder can suddenly shift in practically any direction. It’s very easy to lose control of it.

    • potato3732842 9 hours ago

      The 4.5" angle grinder is like an agressive little dog that's just waiting for a chance to bite you.

      The table saw is like an old pitbull that generally sleeps.

      The 6"/7"/9" grinder is a skunk.

      Everyone who's ever given it the chance has a story about the time the angle grinder nipped at them. The people who pestered the old pitbull until it got sick of their crap have 9 fingers. Nobody has problems with the skunk because it's pretty obvious what'll happen if you disrespect it.

      • ok_dad 4 hours ago

        Yea, if I have to use my table saw, I’m planning cuts so they perform themselves with guides, and my focus is on pushing the wood properly through the guides while primarily keeping my hands at least a foot away from the blade. My grandfather went through life without his right index finger and it wasn’t too bad for him, but I use a keyboard for a living!

      • wiredfool 9 hours ago

        See also: Chainsaws.

        I used to do a decent amount with them, dropping trees and bucking them for firewood/thinning. Then started doing things like cutting chairs out of bigger logs. I caught myself onetime being really sloppy with where my hands were. All from doing it enough, and then doing something a little more complicated that I probably shouldn't have been doing.

    • TeMPOraL 2 hours ago

      > The angle grinder can suddenly shift in practically any direction. It’s very easy to lose control of it.

      Especially when you recoil in pain as it unexpectedly scrapes your finger; it's likely you'll just release your grip entirely, so it'll fly off in a random direction, slicing through anything it hits, possibly bouncing and/or breaking the disk, before it runs out of kinetic energy. $deity help you if the trigger lock is on.

    • convolvatron 9 hours ago

      thats only a problem if it catches your clothes and gets dragged into your body. only turn the switch into the locked position when really necessary. I usually wear leathers. but if it does happen you're looking at a couple months of road rash, not amputation.

  • [removed] 10 hours ago
    [deleted]
PaulHoule 10 hours ago

Software testing practices are still pretty controversial.

I spent about a week redesigning the interfaces of a security-sensitive system to make it testable and developing a test harness, the actual implementation was about a day of work. I felt it was a great use of time.

I have not found an answer for testing React components that seems like a good use of resources. I've tried numerous test libraries from Enzyme to react-testing-library and found them all to be terribly flawed (sorry, if you think "I shouldn't have to modify my code to write tests" and then tell me to "use data-testids" that's the end of the conversation. I have an hour to write a test, I don't have two weeks to diagnose how a third party library I use interacts with the Rube Goldberg machine react-testing-library uses to emulate ARIA support)

Code that is basically "functional" and doesn't interact with a large mysterious system is straightforward to test; a lot of UI code has the issue that it not only calls a mysterious large and complex system but it also gets called by a mysterious large and complex system. I'd really love to have a system that would give me a heads up that some CSS I changed has a spooky effect on a distance on part of the UI because of the complexity of selectors but that's asking a lot

https://understandlegacycode.com/blog/key-points-of-working-...

makes the strong test that tests have to be really fast because you should have hundreds or thousands of them that run any build. Feathers makes the best intellectual case for testing when testing is difficult that I've ever seen, but some of the tests I'm proudest of could never run quickly: I built a "Super Hammer" test that ran a race condition prone system with 1000 threads for about 40 seconds that wouldn't have been effective if it was dramatically shorter. You might do 10 builds a day so you could easily do 2500 builds a year and that adds almost 28 hours of waiting a year -- that's just one test but it costs $2800 a year for a fully loaded FTE who costs $100 an hour and probably costs more than that because the long build sets idle hands in motion doing the devil's work and probably wastes several times more time than that.

  • pixl97 8 hours ago

    Companies: "your testing is costing us thousands of dollars"

    Devs: "So how much does an a few hours of outages cost again?"

    • PaulHoule 6 hours ago

      In at least one case, a test routine activated in production created a terrible loss

      https://www.henricodolfing.com/2019/06/project-failure-case-...

      • hex4def6 5 hours ago

        Wow. Ignoring the proximate cause of leaving that code in there, imagine being the poor schmuck that forgets to deploy a code update to 1 of 8 servers, causing $440 million in damages, basically destroying a company overnight. It's so far outside of comprehension at that scale.

  • yashap 6 hours ago

    > I have not found an answer for testing React components that seems like a good use of resources > … > I'd really love to have a system that would give me a heads up that some CSS I changed has a spooky effect on a distance on part of the UI because of the complexity of selectors but that's asking a lot

    I would’ve agreed until recently. I always found basically all other forms of testing valuable (unit tests of almost everything on the BE, unit tests of FE business logic, BE integration tests, E2E tests), but not testing of the visual elements of the FE.

    But the company I work at, ~6 months ago we gave this product a try, and honestly it’s pretty incredible: https://www.meticulous.ai/

    They basically record sessions of real usage in our staging environment, and then replay them against your branch, like taking all the same interactions, and mocking responses to all network calls. It records tonnes of these sessions and is very smart about which ones it uses for a given change. It flags any visual differences, and you can OK them (or not). There’s a bit of work to initially integrate, but then you don’t write any tests, and you get pretty amazing coverage. It has the odd false positives, but not many, and they’re easy to review/approve in their web UI. They’re also a small startup willing to work super closely with you (we share a Slack chat with them, they’re very open to feedback and iterating quickly on it).

    I swear I’m not a paid shill or affiliated with them in any way, just a user who really loves the product. I was skeptical it’d work well at first, but it’s honestly been great, has caught many potential regressions, I feel we’re getting much better coverage than we would with handwritten UI tests. It’s very worth a look IMO if you’re not satisfied with your visual tests. It’s not an E2E testing tool, because the network requests are recorded/replayed (so it can’t stop BE changes that break the FE), but it’s amazing for testing so many elements of the FE.

  • crdrost 5 hours ago

    Hm. Just thinking out loud. TLDR is that I think the core of the solution to good testing of React components, would look like using it like the Web Component model?

    So one thing that I keep coming back to as kind of a "baseline" is called Functional Core, Imperative Shell. It's a little hard to explain in a short space like this and the presentations available on YouTube and blog articles are a bit confusing, but basically it asks for your application to be broken into three parts: (1) modules in the "functional core" define immutable data structures and purely deterministic transformations between them; (2) modules in imperative libraries each "do one thing and do it well", they might call the SaveUser API or something like that; and (3) these are held together by a thin shell of glue code that needs to have no real logic (that's for the functional core) and needs to not do any real operations directly (that's for the libraries). And the reason to break the app apart like this is that it's test-centric: modules in (1) are unit-tested without mocks, by creating immutable data structures, feeding to the transforms, and checking the output; modules in (2) will init a real connection to a dev server upstream and are integration-tested by sending the real request to the real server; and the shell in (3) is basically so simple that it requires one end-to-end test that just makes sure that everything compiled together all right and can initialize at runtime. So this is what software looks like if you elevate Testing to be the One Core Pillar of the application, and demand "no mocks!" as part of that.

    Q1, how do we apply this to a React app? Well, if you think in terms of UI, you can kind of think of an entire view as being kind of (3) as long as you aggressively oversimplify the behaviors: so you click on some part of some view and it dispatches some ButtonClicked data structure into some view-wide event queue, but it does no logic of its own. Reminds me of Redux, also reminds me a lot of Lit and web components where they just kind of emit CustomEvents but aren't supposed to do anything themselves.

    Q2, how do components fit in. We have to be a little more careful there. You're talking about a modular architecture though, real thick components. Componentizing, takes us a step back from that ideal, right? It says "I don't want this to look like a single unified whole that is all tested at once, I want this to look like a composition of subsystems that are reusable and tested independently."

    A simple example might be a tabbed view or accordion control, I want to coax the viewer through these N different steps, the previous step needs to be complete and then you can go to the next one. And I want the components to be each of these views. (The actual tab view or accordion view is of course another component, but it's a "thin component" in the above sense, it doesn't actually have any imperative library and the logic is relatively trivial, it doesn't generate the sorts of questions you're asking about.)

    So just to roll up a random mental example, one of these tabs is some PermissionsEditor component, once you initialize it, it has everything it needs inside the component to fetch permissions from the API, fetch the current user, see what permissions the current user is allowed to grant to other users (or themselves?)... but the other tabs need to be dynamically responsive, once you add yourself to the group that can edit Flotsam and Jetsam, going to the Flotsam tab the "Edit" button should no longer be grayed out etc.

    Then I think the proper way to view these thicker components, is as being inserted at level (2) into the main application? So the main application just treats them as imperative libraries, "I will give you a div and call your init_permissions_editor function with that div and you render into there. I will give you a channel to communicate events to me on. You will provide me the defs of the immutable data structures you'll send down that channel, I will provide deterministic transformations of those events into other events that I need to do."

    With some caveats, yeah, I'd basically say this is the web-component model. Your external application just integration-tests that init_permissions_editor will render _something_ into a blank <div> given. Your PermissionsEditor component is responsible for integration-testing that it can create permission, add user to group, all of that, and is responsible for testing that it emits certain events when these things happen.

lanstin 11 hours ago

As you learn in biking, the position and velocities of objects changes smoothly, but awareness of the position and velocities of objects can change very discontinuously.

  • digitalsushi 9 hours ago

    you also learn in biking that a helmet gives you a redo, just like the blade guard does

    • LoganDark 8 hours ago

      You learn that on basically anything that you can fall or get knocked off of. For me it was an electric scooter!

hinkley 8 hours ago

If you're not familiar with the shop tool space: A band saw or a table saw can chop off a finger (or three) and surgeons can reattach them. It's very skilled work but you have good odds these days, especially if you've been socialized to put the finger(s) on ice and go to the ER.

A hammer press or a grinder, or a few other tools will just take your finger away.

lostlogin 7 hours ago

I was talking with a friend who runs a building site. One of his crew took the guard off an angle grinder to fit a disc that was designed for a larger tool.

With it tucked under his arm he plugged it in.

It was already switched on, and when plugged in the cut the artery and nerve to his arm. He survived the blood loss and has most function back but it’s taken a year.

scarecrowbob 8 hours ago

In my maker space, guards are required. I have taken several trainings with people who use angle grinders professionally and apparently removing a guard is the normal professional practice for a lot of well-founded reasons.

This is one reason why I do not want to work in a trade like welding or fabrication professionally. At the same time it indicates that with care it's possible to follow the norms of a profession for long periods of time even if they often seem dangerous.

One thing I noticed when I was climbing a lot- the safer and more knowledgeable climbers I went out with used far less redundant equipment (fewer locking or doubled carbiners for instance). At the same time they were far picker about how the equipment was used- one partner would yell at folks to keep hands off the grigri (a belay device that is very common for folks to hold while using).

I get why different equipment calls for various "guard rails". At the same time, safety is in the usage and not the devices- forgetting that fact is dangerous in itself.

  • rightbyte 7 hours ago

    > apparently removing a guard is the normal professional practice for a lot of well-founded reasons.

    Dunno why there are no transparent guard to use when you want to see properly.

    • kps 6 hours ago

      No good material. The usual material for safety glasses (polycarbonate) scratches easily. A grinder guard would be see-through for about three seconds.

    • scarecrowbob 4 hours ago

      They kind-of do, but you wear it on your face.

      FWIW, the reason cited for removing the guards was not vision, but access- it is difficult to get the tool in position when you're working on large objects that can't be re positioned.

      • saintfire 4 hours ago

        Was going to chime in that this is the reason.

        I used a grinder almost daily without a guard for years because what i was grinding was 2"+ steel rods buried underground.

        I couldn't move myself or reposition the work.

        I'm not advocating removing the guards but there are actual reasons why people hate them.

        I see some grinders like Milwaukee have guards that can be quickly rotated around the blade. That's not always enough, though. Ive also seen some Welders cut their guards in half, for clearance and at least a shred more safety.

quickthrowman 10 hours ago

> I was using an angle grinder to strip paint off of a large table top and necessarily had to remove the guard.

You did not have to remove that guard, you chose the wrong tool for the job. Chemical stripper and sanding tools exist, use the right tool for the job or next time you might lose that finger.

  • Jtsummers 10 hours ago

    This is also part of the concept of normalization of deviance, though. Selecting tools because of proximity or accessibility rather than suitability.

    One time you "need" (feeling pressure from somewhere) to get something done and you reach for the tool at hand, it's not the right tool but it's workable. Then later you experience the same thing and think, "Oh yeah, that worked last time I can just do it again." Repeat a few more times and it becomes the tool you reach for instead of your backup when you have nothing else but "need" to get the work done now. Its unsuitability becomes apparent when you injure yourself or cause damage to the items you're working on because it was never the right tool, you were just careful in how you used it the first few times and got too comfortable with it as time went on.

    • bumby 8 hours ago

      I witnessed this quite a bit in software development. People use the frameworks they are comfortable with, even when they know they can't meet requirements. I've at least had some who were upfront about why by stating "because I don't want to learn something new." (She didn't last much longer)

      • Jtsummers 7 hours ago

        > "because I don't want to learn something new."

        I inherited a Visual Fortran program that was written in Visual Fortran because the original developer (who also maintained it for ~15 years) knew Fortran and was not comfortable in other languages. Not because it was a good idea. I was tasked with reimplementing it in C# which was not a bad idea (the target, successful, was to have it as a standalone program or a plugin in another program also written in C#). Almost any language could have been used, but in context C# was a reasonable choice.

        It's a very common and, to me, very curious attitude. Once you learn how to reason about programs and the logic of programs generally, unless you hit the fringes most languages offer very similar semantics. That said, that particular program was decidedly unstructured (goto's everywhere) so perhaps he really didn't feel comfortable in modern languages or modern uses of his favored Fortran.

  • ansgri 7 hours ago

    Angle grinders are just awful in their versatility. It’s almost always a wrong tool for the job, but the right specialized tool often costs more or not readily available.

  • [removed] 8 hours ago
    [deleted]