Comments by "Brent Jacobs" (@br3nto) on "Theo - t3․gg"
channel.
-
40
-
16
-
12
-
9
-
Yeah…. But tests are there for other reasons…. Im currently refactoring a rather old codebase. Quite a lot of deeply nested code, many conditionals, lots of coupling, the multiple responsibility principle was applied to everything. I can’t just inject dependencies or mocks, because the system wasn’t built in a way to do that or for that to be useful. There’s also no unit or integrations tests. There are some limited regression tests. Im trying to refactor that code so I can modernise it and upgrade it. But it’s really really easy to accidentally break functionality… every change has subtle effects. I have to maintain all functionality, even the bugs, because who knows what relies on that bug. I have to build tests to verify the existing functionality first, so that I can then make the changes I need to make, and then use the tests to verify my changes didn’t break anything. Had the tests been there in the first place, the app probably wouldn’t have been written the way it was, and I wouldn’t have to do double the work because some previous develop didn’t take time to write tests. Though back when this was written, unit testing was less common… so that dev get a pass. Write tests! Future devs (possible even future you) will thank you!
4
-
3
-
3
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
2
-
@kangar1797 that’s my point too. CSS, JavaScript, HTML, HTTP, and many more are all individual web standards, that every site relies on. Sites built 20+ years ago and longer can still run. Sure, we get stuck with past decisions, yet somehow, all these standards have managed to improved tremendously over that time. Some of the new HTML elements means we don’t need to roll our own components, improved CSS means we don’t need to use as much JavaScript, or as much superfluous HTML structure for layout. Improved JS APIs and syntax means we have access greater functionality that brings us closer to that native app feel. So, no, I don’t understand that argument against standards. I agree that Web Components are currently largely unusable because they are not easily composable. I’m currently building a framework that makes use of them, so I understand some of the issues at play. The problem isn’t actually the Web Components themselves; they are actually pretty good, in concept. There are a few missing pieces that make them unusable though. Have a think about how you might map an array of JS objects to an HTML element. You can’t add a JS loop in the middle of HTML code like you can in some of the front-end frameworks. But we should be able to. We should be able to do the same thing as what ERB/Razor pages/PHP does but using JS. The other issue is passing custom callbacks to web components. Only the on* attributes (like onclick) can accept JS and execute them. We can’t define our own and send custom events as arguments. I’ve had to do a lot of weird hacks to make an arbitrarily define attribute to accept JS and to have it execute in the correct scope. The last missing piece is reactivity. I know there is a push to get Signals into JS, but that would be a mistake from my perspective because they are not low level enough. The actual requirement is Object.watch() and Object.observe(). They accept a variable containing a value of object and a callback which gets called whenever the value or object changes. The difference from signals is that it doesn’t keep track of dirty state. The call back gets fired the moment the value changes. That’s the functionality I have identified as needed to make Web Components useable. There are a few more subtle missing pieces m, but those are the large ones. Basically we’re missing an HTML/JS templating syntax.
2
-
2
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1
-
1