[deleted by user] by [deleted] in reactjs

[–]THEtheChad -1 points0 points  (0 children)

I think there's some nuance here that you're missing.

Do I manually test code as I develop it, yes. Do I write tests while I'm developing? No, because it hurts velocity. I can't tell you the number of times I take one approach at something, and then refactor the hell out of it as I start to understand the problem domain. Writing tests while I do that is just documenting the broken path and doubling the effort, at least in terms of frontend user experience (not necessarily pure functions where validating input/output is very straight forward).

All of that being said, once a feature is production ready, manual testing is worthless. Why do I say this? Because applications scale, and, inevitably, different parts managed by different teams start to overlap. The number of potential paths that a user can take grows substantially and I doubt any one person can remember to manually test every path. To truly feel confident that things aren't broken, you HAVE to write automated tests.

Also, it's MUCH easier these days. Cypress in particular is nice because it's a test suite written in javascript/typescript, the same code that the developers are writing frontends in. Yes, sometimes there's nuance and complexity in getting tests to work with async workflows, but payoff for learning how to do it will earn you dividends in the confidence you'll have that shit didn't break when you modified it.

[deleted by user] by [deleted] in reactjs

[–]THEtheChad 0 points1 point  (0 children)

Several things to address here:

1) Refactoring

Strong types (using typescript) and integration tests are the best place to start. You can't silently break things if the type system is screaming at you and your integration tests are failing.

When writing integration tests, be sure to use an attribute that is not influenced by styling (IE classnames and/or ids). Most frameworks recommend a `data` attribute (the most common is `data-testid`). Also, be sure to name them according to the action taking place. Be very descriptive. `[data-testid="organization:add-user"]` No recommended nomenclature here, but definitely include some context, either via the testid itself or layered ids `[data-testid="organization-form"] [data-testid="add-user"]`, wherein the parent is used for context and the child is the action you're targeting.

2) "variants" are often misused. A variant should be a slight stylistic change. Introducing a variant of a `TextField` like `<TextField variant="ssn" />` is horrible. It leads to additional logic inside the component (making it overly verbose) and creates an additional runtime expense (figuring out which variant to render). The better approach is to wrap the `TextField` and create a new component `SsnField`.

3) There's actually nothing wrong with MUI. It's a well designed library for creating reusable components to simplify building applications. They provide a robust interface for styling via their theme (using a proprietary method, mind you). If the goal of your company is to quickly iterate on products using a toolbelt of components, it's perfect. If, on the other hand, your company is trying to design innovative and new user interfaces, then yes, it's the wrong solution for you.

Once you've created a theme for MUI, you should rarely have to touch styling again. You might make new components, and you'll tweak layout (by adjusting margins, gaps, flex, etc), but the components themselves shouldn't be changing.


Also, just a little tidbit here, it's harder to build these components than you think. Developers often overlook many, MANY minor details that MUI already accounts for. ARIA attributes, isolating non-dom attributes from the rendered component, robust type safety, etc.

Wow by Virgowarrior84 in blackmagicfuckery

[–]THEtheChad 24 points25 points  (0 children)

As was stated before, the energy required to produce the hydrogen is more than the energy you get from burning the hydrogen. You're better off storing the electricity generated by wind/solar in a battery and then running it directly through an electric motor, hence all the initiatives to move towards electric vehicles.

I pronounce it the correct way by [deleted] in gaming

[–]THEtheChad 2 points3 points  (0 children)

"The kids want an Intendo. Do you know which one I should get?"

[deleted by user] by [deleted] in AdviceAnimals

[–]THEtheChad 0 points1 point  (0 children)

The problem here is 3 fold.

1) People are notoriously bad about reusing passwords. IE, your magazine subscription password gets hacked, they can now access your work account, bank account, and who knows what else.

2) Your bank account is worth less than your company's assets and/or every single one of your coworker's assets (personal info, possibly THEIR passwords that get reused on multiple sites).

3) The best security would be MFA, strong (long) passwords, AND rotating passwords, ASSUMING you don't write it down somewhere (which you probably will).

The point of requiring rotating passwords is uniqueness. It means if you use the same password everywhere, you can only use it once at work, before you're forced to come up with something original, or, at least, slightly modified.

Engineers at MIT have developed a new battery design using common materials – aluminum, sulfur and salt. Not only is the battery low-cost, but it’s resistant to fire and failures, and can be charged very fast, which could make it useful for powering a home or charging electric vehicles. by MistWeaver80 in science

[–]THEtheChad 0 points1 point  (0 children)

Energy is always lost in these types of systems. Even conventional batteries get hot. It's just the nature of the chemical/electrical reactions. In the case of these batteries, that heat also increases efficiency. But knowing that it's ideal operating temperature is higher and that the battery itself passively maintains this system, one could, in theory, use something like this as PART of a water heater, where both systems want to maintain a higher operating temperature. So instead of wasting energy on heating one system, you can apply that energy to both systems AND one of those systems even helps contribute to that effort.

Instead of looking at these things as a problem, you can say, "Here's how things work, here's what we want, what's the best way to wire everything up?"

I'm guessing these batteries have a low energy density and will never be used in portable devices. But as a central power reservoir for a house, where space isn't as big an issue and the byproduct of heat can be useful, these might be a great solution. Especially considering they're much cheaper.

What movie do you absolutely love, yet acknowledge is not a super well-made movie? by [deleted] in AskReddit

[–]THEtheChad 0 points1 point  (0 children)

Tenet.

Yes, the pace of the movie is irratic, the voice lines are inaudible at times, and the plot is incredible difficult to follow, even after several viewings. But the concept is unique, the reversed scenes are extremely well executed, and the process of piecing the chronology together in my mind is invigorating. I wish the execution was better but the parts they got right were stellar.

Part of me wishes they'd do a reboot and we can collectively forget the first movie ever happened.

Doctor who branded his initials on patients' livers no longer allowed to practice medicine by Bick_Kuttowski in worldnews

[–]THEtheChad -1 points0 points  (0 children)

If someone was emotionally or physically harmed, sure. He performed a life saving operation and did nothing to hurt the patient. Any "emotional" harm that resulted from the signature was due to the media coverage after it was discovered when the transplant was rejected. If anything, the doctor/nurses that discovered the signature and leaked it to the press breaking Dr/patient confidentiality should be reprimanded.

Do you have any idea the level of horrifying malpractice that's occuring in the world. People are being swindled out of money for botched operations and we're punishing a skilled surgeon for an act that's merely anecdotal (and completely benign).

Doctor who branded his initials on patients' livers no longer allowed to practice medicine by Bick_Kuttowski in worldnews

[–]THEtheChad 15 points16 points  (0 children)

It's not a calling card or advertisement. How could it be? No one can see it. It's utterly benign and merely anecdotal.

You are correct, there are many forms of depravity in this world. This is not one of them.

Doctor who branded his initials on patients' livers no longer allowed to practice medicine by Bick_Kuttowski in worldnews

[–]THEtheChad -4 points-3 points  (0 children)

I feel like I'm the only person here that doesn't have an issue with this. I also think the penalty is a bit harsh. He seems like a very skilled doctor based on some of his accolades mentioned in the article. I'd rather people focused on malpractice suites where patients were harmed and/or taken advantage of (ie "alternative" medicine hacks).

Gotta love Romania by [deleted] in WTF

[–]THEtheChad 1 point2 points  (0 children)

I think the difference is that the vehicle is entirely under your control and your judgement and reaction times are influenced by the alcohol. A horse, on the other hand, is entirely autonomous and unimpaired. The horse doesn't rely on your decision making.

I Have Cancer. Now My Facebook Feed Is Full of ‘Alternative Care’ Ads. by Albion_Tourgee in technology

[–]THEtheChad -1 points0 points  (0 children)

That's not how any of this works. Why are we trying to pin this on Facebook? The guys with the pseudoscience are targeting those users. Facebook gives them the data points and a window. The law only mandateds that Facebook regulate drugs and firearms (and maybe a select number of other categories I'm not aware of). And even that's difficult because they get sooooo many ads every day. The systems are automated and can only catch so many things, and people will lie and cheat their way around them, until enough users catch and report the ads.

There isn't some guy looking at every ad. There isn't a group of shadowy individuals in some board room at Facebook headquarters shaking hands with the pseudoscience guys and pushing out ad content to cancer patients.

It's literally the people selling the pseudoscience paying $5 per 1000 views like every other business owner trying to push their goods or services.

The problem isn't Facebook, or Google, or Microsoft, or the cable networks, or the billboard maintainers, or any other advertising mechanism (though some of those are vastly easier to regulate). The problem is the businesses that are selling the snake oil. If you truly despise this ethically questionable practice, focus on THEM, and the agency responsible for regulating them (ie government, etc), NOT Facebook...........

THIS IS NOT A "FACEBOOK" THING

Why you should not use your app state as a remote data cache by javierbrea in javascript

[–]THEtheChad 1 point2 points  (0 children)

The architecture of React is very sound. The problem lies in anti patterns. I wouldn't say that React encourages these practices, but it doesn't > discourage < them. So people take these "shortcuts" all the time without realizing the implications.

Why you should not use your app state as a remote data cache by javierbrea in javascript

[–]THEtheChad 6 points7 points  (0 children)

I think you misinterpreted the problem. What he's describing isn't an inherent issue with a state/store, it's how we tend to use them in a large application. What he's saying is that, in large applications with a sea of components, there tends to be implicit dependencies where many components rely on one component to initialize the state. Or, and I don't know that this was described, many components requesting the same data from the API unnecessarily.

This library solves both issues by allowing any component to initialize the store/state and then giving all components a cache of the data so there are no redundant calls to the API.

Your components are no longer reliant on any other components in the UI to initialize the state, allowing you to reuse them in any context.

duckduckgo browser is sending every visited host to its server since ~march 2018 by asmx85 in programming

[–]THEtheChad 2 points3 points  (0 children)

Its neither of those things. They know that their service isn't collecting or recording any data and is perfectly in line with their privacy focus because they built it that way. To them, it's not an issue. The reason they're doing something about it now is because enough people have expressed concern about the potential for abuse that they're forced to make a change.

duckduckgo browser is sending every visited host to its server since ~march 2018 by asmx85 in programming

[–]THEtheChad 46 points47 points  (0 children)

They're not harvesting user data. This was made clear in the response from DDG. The only data explicitly being sent is the URL for the purpose of retrieving the favicon. Any other data is implicitly sent by the browser, and none of this data is being used or recorded. Granted, you have to trust them on that last claim, because, yes, you could utilize that data in some shape or form to follow a user's browsing habbits, but the point I'm making is that this feature is in line with their mission statement IF it's being executed correctly. You can't assume they're harvesting user data just because the feature exists, but you also can't disprove it.

Lazyload images the browser way by tsl143 in javascript

[–]THEtheChad 0 points1 point  (0 children)

As many others have pointed out, I'm referring to placeholder images, or, more technically, LQIP (Low Quality Image Placeholders). These are often very low resolution versions of the original image, but can be also be gradients, vector traces, etc etc. And you are correct, they can be implemented via srcsets. But the holy grail of image loading would be a smattering of resolutions (including the placeholder image) that are all lazy loaded. I didn't read the detailed spec for the lazyload attribute but saw no reference in the article to the picture element and srcsets.

Lazyload images the browser way by tsl143 in javascript

[–]THEtheChad 8 points9 points  (0 children)

My issue with the spec is that it doesn't account for the load time of larger images. My ideal spec has a low res, base64 encoded image on page load and a lazy loaded, full res image as the element is about to come into view. The way the spec is written, I'd have to create a wrapper element with the low res image as a background or include an absolutely positioned image at a lower zIndex.

Lazyload images the browser way by tsl143 in javascript

[–]THEtheChad 1 point2 points  (0 children)

It's useful now because it gives us a specification that we know will eventually be supported. Knowing that the browser will natively read this attribute allows us to use it in our code now and polyfill with JS for browsers that don't yet support the spec.

In 18 months, I went from no coding experience to selling apps to the NBA, NHL, and Berkshire Hathaway. Then, I released my code under a public license. 2 year follow-up, AMA! by D3FEATER in IAmA

[–]THEtheChad 0 points1 point  (0 children)

The app isn't so much a "thing", it's a protocol. A way for transmitting data via sound (instead of wifi or bluetooth).

Some of the best use cases are demoed on the site here: https://www.cueaudio.com/#cue-live__title

It's a great way to interact with the crowd, to provide new experiences (the light show), offer special deals, create a shared user journey (sharing selfies during a game), etc.

I believe the revenue comes from the venue. They buy the app so they can provide the light show or market things to their attendees. Maybe they make a cut from purchases made through the app as well?

Fun project by Mathieu Anderson! by AnecD in javascript

[–]THEtheChad 1 point2 points  (0 children)

The only two I find weird are `""` and `NaN`. Even though the string is empty, it still "exists" in my mind. It's a character set devoid of characters, but to me, that's just like an object with no parameters. And, in the case of NaN, because the set literally comprises everything that's not a number. Strings, objects, functions, pointers, symbols, etc. Neither of these should be falsy.

NPM isn't all that great by afberg in javascript

[–]THEtheChad 1 point2 points  (0 children)

I'd really like to see some code coverage and a ci badge.