4 ms·
Is there a good way to learn techniques like this from first principles other than trying to become an employed frontend dev?
by alexchantavy 1y ago
Is there a good way to learn techniques like this from first principles other than trying to become an employed frontend dev?
- brokencode 1y agoUsually you try to build something, realize it’s slow, then do a combination of searching for possible solutions, trying them, and profiling again and again to gain this knowledge. Experience is the best teacher.
- notatoad 1y agonot really. the web is 30+ years of fixes, shortcuts, compatibility hacks, tech industry politics, and other assorted mistakes. the "first principles" to understand it all is the complete set of mailing list archives of the WhatWG, plus the archives of the bug trackers of all the major browsers.
- socalgal2 1y agoI don't think it would be different for any other system. Trying to make a piece of computer software that is completely responsive to big displays, small displays, touch screens, mice, etc is just a ton of work and a ton of small details you can't easily learn until you need to learn them.
- notatoad 1y agoyes. i don't mean to unfairly criticize the web as a platform, i just know it's warts because it's the platform i work on. my criticism is reserved for the concept of "first principles", as if there should be a cohesive and simple set of rules that you can build up all the knowledge you need from. that's just not really how any complicated system works: building a comprehensive understanding of a complicated system takes a lot of work and a lot of time.
- troupo 1y agoIt's not "completely responsive". And literally every other GUI is just as responsive when coded for those screens. Have you never resized a window on a desktop OS?
- RumourRider 1y agoYou need to think about what the browser is actually doing when it displays a web page. You need to think about what happens when you type the URL in and what the browser is doing conceptually. If you have any experience programming 2D graphics with SDL this will help you to understand what is happening as well. There is an old school talk by Nikolas Zakas on JavaScript Performance from 2009 which while some of it is out of date now due to improvements in Browser engines, the fundamental ideas are still the same. https://www.youtube.com/watch?v=mHtdZgou0qU https://www.youtube.com/watch?v=mHtdZgou0qU If you skip to the 35 minute mark he speaks about reflow specifically. Generally I still use many of these techniques when writing vanilla JS (which is unfortunately rare these days). There are other talks where he talks about many other performance specific topics. Obviously none of this is as good as real world experience of dealing with a thorny issue.
- troupo 1y ago> If you have any experience programming 2D graphics with SDL this will help you to understand what is happening as well. No. No it will not. Nothing in 2D graphics will help you understand things like "simple animation required full layout re-calculation and re-painting of the entire page"
- RumourRider 1y agoYes it will. Most of the CSS styling is literally wrappers around draw calls.
- troupo 1y agoWhich draw calls result in "changing border width will cause a full page re-flow in some browsers, and bot others"? Which draw calls are "literally any animation will cause the full re-flow of the document unless you make sure an element is not a part of the document, but then you'll have issues with positioning, weird gaps etc." Which draw calls teach you that "well, this primitive animation consumes 15% of CPU, but will only consume 6% if you go out of your way to make it 'performant'"?
- eviks 1y agoNot sure, but if CSS first principle is parent sets width going down to children, but sets height going up from children, then you could see how children changing its height leads to layout recalc all the way up. So the you need to fix that height /remove resize, then google on which technique to use?
- deleted 1y ago[deleted]
- dsego 1y agoUnderstanding the document's flow layout, block and inline elements and build on top of that.