1,031 karma · joined Jul 24, 2011 (15y ago) · 619 submissions
comment 3y ago · link · parent
But this idea that all styling should be done in HTML is antithetical to the whole reason CSS came to be in the first place, IMO. I can see why people like it to an extent, but I just don't really get the arguments that switching files to write CSS is "context switching" that makes things harder. If you need to see both your HTML and CSS at the same time then get a bigger monitor (mostly kidding).
I just still see that well crafted HTML and CSS work together, make sense, and especially with all the new tools available in CSS, just isn't that hard to get right. Well structured HTML is the biggest pain point I see for those that struggle against CSS. Learn that, the cascade, learn how to encapsulate styles (there are plenty of good patterns) and it will flow just fine.
comment 3y ago · link · parent
Some examples:
- At the API layer, it mocks the network layer and tests that, when triggered, it sends the correct request and given a response, handles it correctly (both for success and fail responses, as well as different expected data).
- business logic layer is some of the most important tests, this layer will test things like how data flows through the app and how it might be transformed along the way for use in the UI. This layer generally sits between the API and UI, so it mocks functions in the API stack and tests various responses, tests streams of data. This layer often is your "traditional unit tests" - testing individual functions to ensure they are idempotent, no (unintended) side effects creep into the code, putting in X gets back Y, etc.
- Higher order UI components - these are components that, while they may have some UI (yah, I know, not purely higher order), they are generally the component that acts as an intermediary between the business logic and more pure UI (display) components. The tests here would mock any calls into the business logic, make sure it properly requests the needed data and then check to see that any local logic is correct. This layer may be handling route params or query params, and adjusting the data request based on that or other data stored in memory or in the app. It may be handling collection of form data and giving it to a business logic function, and handling any errors that may send back, and the tests will check that. It often has functions that are triggered by actions in display components, and rather than try to wire components together in tests (we do have some e2e tests that check at that level), it's better to test those functions in isolation at this layer.
- Display UI components - I don't want to assume, but based on the comments, this is likely what you have thought of when you think of UI testing. At this layer, there should be much less logic in each component. It usually has data inputs, and then renders that into a template. We don't "test the framework" - there's no sense testing that an input prop is "set" correctly. But if the UI component does anything with that prop to prepare it for display, we'll test that. Or if it has UI actions - this is one place we will sometimes tie to the DOM and test things like click events, but most of the time that isn't really necessary (again, we make as assumption that if we properly wire up a click handler, it will fire on click). So many times we will just test the handler themselves, if they do any logic prior to emitting that value back out to a higher order component or to the business logic layer. We try to keep these simple, but there are sometimes tests here that are testing that expected DOM elements are visible based on the state of input data, or that the expect text is visible based on user action (i.e. did a panel display text when the user clicked it open). This is the layer we have to be fairly careful not to write "lazy" tests (did the framework render the text assigned to a variable and interpolated in the template isn't super valuable).
If it matters (and I don't think it should, because the practice of writing good tests, even for client apps, isn't specific to language/framework) our primary apps right now are written in Flutter and Angular. We also use or have used Swift and Kotlin (iOS/Android respectively), Java, React (little bit of React Native but quickly abandoned in favor of Flutter), and Ember (had a pretty big test suite for an Ember app, since shut down though). And, despite all of the above, most of our logic does not actually reside on the client side but rather lives in the API/backend and we are mindful to try to keep as much logic there as possible. And we have good test coverage there as well. Of course, for all our code, the coverage could always be better.
Anyways, I can't really pull code samples as the apps are proprietary (and this is getting long enough as it is), but I hope that answers your question and helps illustrate at least why I believe there can be significant value in client side tests.
comment 3y ago · link · parent
Some are simple (although very few are as simple as your example) and some are complex, depending on the portion of the app being tested. Some are basically integration tests for components/widgets, where it runs it in isolation to test the inputs and outputs. Others are more like traditional unit tests where it's purely testing business logic, API and model interactions (mocked), form validation logic, etc.
Unless you're talking about very simple client apps, there's always stuff that can be tested that will provide significant business value by preventing bugs and broken code from getting to end users
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
I don't buy the "exert control over another person in their home" argument. I'm not sure why laws about information rise to the level of "slavery" in your view. I think even calling digital items simply "information" is a bit of a (likely intentional) misclassification.
I think there are a ton of problems with the way we handle digital materials from a legal standpoint, and I do think vast swaths should be more freely available, and that the length of copyright and other laws are way too long. So I'm sympathetic, to a point. But the argument you make in the above post isn't really convincing, even to me (someone who likely leans closer to your PoV than many here).
comment 3y ago · link · parent
FWIW, I probably lean slightly closer to your side of the spectrum than most, and even I feel this take is extreme.
comment 3y ago · link · parent
I'm not saying you need to enable it, but that is a choice you are making, and you have the skill to turn it on/off as needed, and realize that there may be sites you won't be able to use without it. I don't think it's a reasonable expectation today that JS may not be available, except maybe to display a nice warning page stating that.
comment 3y ago · link · parent
I don't know enough about that specific scientist, but in general, I tend to respect scientists more when they are willing to change their opinion (assuming it's in light of new evidence and not just on a whim) and admit they were wrong previously. That isn't a bad thing, IMO, that is a valuable trait to have, which is why I tend to listen to and respect those who have that trait more than those who dogmatically stick to an opinion regardless of new information.
comment 3y ago · link · parent
As to the value of note taking in general, for devs, I equate it to telling someone to "put that in the ticket, don't verbally instruct what needs to be done". Documenting decisions made, who will do what, etc. can all be valuable and prevent needless discussions later about who's memory is correct about X (i.e. how something is supposed to function). Some people have great memories, but others do not, and even if you think yours is not in need of this kind of assistance, having something to reference back to can be a big help, especially when you can say something like "hmm, that's interesting, in my notes, I wrote down we decided to go with Y, but you are saying Z, when did that change?"
I should note that taking notes is a skill like any other, done poorly it can probably have the opposite effect of causing distraction and missing things that are being discussed.
comment 3y ago · link · parent
comment 3y ago · link · parent
I don't know if it's still true as I heard this state a few years ago, but at one point the growth rate of new web devs meant that at any given year, more than 50% of all web devs had less than 2 years of experience.
comment 3y ago · link · parent
comment 3y ago · link · parent
I also think you are correct to a point, they are really bad at security so it is also possible that some of these things are just coming out also.
comment 3y ago · link · parent
I know looking back I still had symptoms. I can remember days during those 3 years just sitting in the office and realizing I had not gotten a single thing actually done and it was mid-afternoon already. But also had stretches of incredible productivity also.
Thanks for the prompt - been considering going back on keto, one of the reasons I went off is the mixed scientific evidence for its efficacy over other diets (not specifically for weight loss, just diet in the context of "way of eating") and some warnings about the lack of long-term study data because it's so hard for individuals to stay on long term. But this gives me another data point to consider and something to watch if I do try it again.
comment 3y ago · link · parent
And if it thinks it's actually a spam call, I don't even get it ringing, it just quietly "handles" it (but obviously takes a message so I can call back if it was wrong).
comment 3y ago · link · parent
The only issue I really have now is once in a while I can't use my keyboard on the client computer(s), and that is because my server is currently my work Mac, and the terminal will occasionally request secure lock (probably when I use sudo) and as part of that, the keyboard is not allowed to be accessed by programs like Synergy until the lock is released. But Mac gets kinda buggy once in a while and doesn't properly release the lock.
Most of the time it just works though, and I've gotten way more than my $30 worth at this point.
comment 3y ago · link · parent
Doesn't mean there isn't also some nuture involved also, likely not the "over-stimulation" argument you make, but more likely the "if you have it, more likely to recognize it in your children" type of thing.
From the following link
> Decades of research show that genes play an vital role in the etiology of attention deficit hyperactivity disorder (ADHD) and its comorbidity with other disorders. Family, twin, and adoption studies show that ADHD runs in families. ADHD’s high heritability of 74% motivated the search for ADHD susceptibility genes. Genetic linkage studies show that the effects of DNA risk variants on ADHD must, individually, be very small. Genome-wide association studies (GWAS) have implicated several genetic loci at the genome-wide level of statistical significance. These studies also show that about a third of ADHD’s heritability is due to a polygenic component comprising many common variants each having small effects.
> Family, twin, and adoption studies provide a firm foundation for asserting that genes are involved in the etiology of ADHD.
> Adoption studies suggest that the familial factors of ADHD are attributable to genetic factors rather than shared environmental factors
> A similar heritability estimate of around 80% was seen in a study of MZ and DZ twins, full siblings, and maternal and paternal half-siblings
> There can be no doubt that DNA variants in genes or regulatory regions increase the risk for ADHD. In rare cases, a single genetic defect may lead to ADHD in the absence of other DNA variants. We do not know how many of these rare variants exist or if such variants require environmental triggers for ADHD to emerge. It is equally clear that no common DNA variants are necessary and sufficient causes of ADHD.
It doesn't preclude environmental factors either:
> The convincing evidence for genes as risk factors for ADHD does not exclude the environment as a source of etiology. The fact that twin estimates of heritability are less than 100% asserts quite strongly that environmental factors must be involved. ADHD’s heritability is high, and that estimate encompasses gene by environment interaction.
comment 3y ago · link · parent
I think the thing you might overlook with this statement (truncated slightly) is that sometime people are able to mask their symptoms, especially those who are highly intelligent and who may fall into an "inattentive" diagnosis, rather than the "hyperactive" side. I agree there are different levels that the affect can have on folks, however there is a difference between the boredom/procrastination/etc. struggles with someone who has ADHD and someone who doesn't. It's isn't just something that "everyone deals with to some extent or another". And proper diagnosis techniques will also sort for false positives, to eliminate folks who are actually "just bored", for example.
That said, this is something that studies have shown very much needs to be addressed not only from a medication aspect - sometimes it is definitely necessary and in many cases all the behavior techniques in the world won't make up for the chemical imbalances. But it should also be addressed from a behavior standpoint, via CBT or other therapy as well as other wellness techniques you mention, like good nurtition, sleep, exercise. From the studies I've read, the best results come from a combination of the two, not from ignoring or promoting one over the other.
comment 3y ago · link · parent
As one of those persons (tested 98th percentile on SAT in 8th grade, for example, and was in gifted or advanced classes until I just got bored of "extra work"), I think it is important to really consider this and reflect on whether or not something like ADHD could be at play and getting in the way of life goals. The rejection sensitivity dysphoria mentioned in the article, while it is not a diagnosed condition (won't find it in the DSM), does describe one of the states of mind of a lot of people with undiagnosed ADHD because of a lot of negative conditioning for many years, being told they just didn't have enough willpower to do things "right".