Smashing Podcast Episode 48 With Stephanie Eckles: Is Sass Still Relevant?

In this episode, we ask if Sass is still relevant in 2022 and if it adds any value modern CSS workflows. Vitaly talks to expert Stephanie Eckles to find out.

Show Notes

Weekly Update

Transcript

Vitaly Friedman: She’s a software engineer focused on front-end and she creates front-end learning and development resources with an emphasis on CSS, accessibility, and 11ty. She’s a writer, teacher, and consultant. And she also hosts the podcast Word Wrap, where she and Claire Lipskey talk about a bunch of stuff related to what it even means to be a developer in 21st century. She’s also an advocate for accessibility, scalable CSS and Jamstack. And offline, she’s a mom to two girls and a Cava-corgi, and she enjoys baking. So we know she’s an expert in CSS and accessibility, but did you know that she absolutely loves hip-hop and dancing, occasionally, of course. My Smashing friends, please welcome Stephanie Eckles. Hello, Stephanie, how are you today?

Stephanie: I am smashing.

Vitaly: Oh, that’s wonderful to hear. It’s wonderful to see you as well because you’re writing so many articles. You’re writing so many tutorials and courses and tools. Everything is out there. Just really incredible to actually have an opportunity to just talk to you every now and again, this is wonderful. But I always have to ask, I’m just really, really curious at this point. Stephanie, you create so many tools for people out there to use. And I always think about HTML Recipes and Button Buddy and 11ty Rocks, and so many articles in CSS and trainings and workshops, and you have your own podcast and you’re also a mom. Where do you find time for it? Are you super organized? How does it work?

Stephanie: So I’m not super organized, but if anything about becoming a mom, becoming a parent, or any sort of caregiver, is the time that you do have is more precious and also you are sort of forced to be more efficient. So, when you have different goals, it’s just something that’s important to me to include in my day or make time for.

Vitaly: Yeah, that makes sense. It’s actually quite interesting because the less time you have, the better you get around to your time, the more you optimize your time and all. So, that’s incredible to hear that.

Vitaly: Well, Stephanie, today’s an important day. It’s a very important day, isn’t it? Well, do you know what I’m hinting at, by any chance?

Stephanie: I believe there’s a certain milestone for web developers that we’ve been excited about.

Vitaly: Yes. Isn’t it very exciting? Dear listeners, as we’re recording this interview today, it’s June 15th and this is going to be going in the history for calendars designed and created for web developers for, I don’t know, centuries, maybe? Do you think we’ll still be developing websites in a century? Stephanie?

Stephanie: I do believe that actually.

Vitaly: Okay. So then we will probably be celebrating this day because it’s a day when Microsoft officially ends support for the Internet Explorer desktop application. Are we feeling a little bit nostalgic today, Stephanie? Do you remember any quirks and bugs from IE?

Stephanie: Yes. You know, over my all 15 plus year career history, definitely it’s something I’ve had fondness and other feelings about throughout that history. So yeah, it’s a big day. It’s one we’ve, like you said, marked on the calendars, but yeah, I remember particularly staying up late at an advertising agency I worked at. At the time we were on IE 7 and I could not get a border to show up, of all things. I will always remember that day.

Vitaly: Yes, of course. It’s interesting actually thinking back about, let’s say 15 years, you said, maybe you could just share a bit of light. How did you actually fall in love with the web? I hope you didn’t fall in love with Internet Explorer because then it would be very sad day today. But how did you actually even get to the web? Tell us a little bit of your backstory, if you can.

Stephanie: Absolutely. So I started with Flash, Macromedia Flash, not Adobe Flash. Got that at a summer camp that I had gone to as a teenager. And it was sort of my gateway. I wanted to put my "art", as it were, on the web, very big quotes around art. So I fell in love with the keyframe animation at that time. And that led to figuring out how to get it on the web, that led to learning a little, tiny, tiny bit about HTML. I remember visiting a forum to get all of my HTML and Flash questions answered. And then I found WordPress and WordPress was just getting out the gate. It was a couple years old when I learned about it as a tool. And spent a decade of my career with WordPress, actually. My degree is in advertising, so, huge part of my career was working as a developer in marketing and advertising. And, that’s kind of the base evolution of how I got into it and throughout that time, front-end development has always been my specialty.

Vitaly: Right, right. That’s exciting. That’s incredible. I’m also thinking about all this times back when I was really playing with all this quirks around Internet Explorer and just in general. And it’s one thing that really excites me, I think, about all of this or excited me back then is that you could actually just go ahead and present something to the entire world and the entire world would come and see it. This is how I ended up creating my own football club website for a club that didn’t exist, which was kind of fun, I guess. And I had maybe 44 visitors over a year. That was very exciting for me at the time.

Vitaly: And I think about this now and I feel like sometimes it’s becoming just incredibly difficult for people to be able to do that. And it feels like you need to learn so much to even be able to publish "hello world" on a page. Do you think this is just how things turned out, we just have become more mature? Or do you think it actually has become a bit more easy, maybe, over the last years because we have browser inconsistencies gone. Tooling has never been better. What’s your take on this?

Stephanie: Yeah. So, in my early days, and I’m sure you experienced this plenty of times as well, you did have to worry about the server. You did have to worry about FTP, which might be a lost acronym for some folks these days. Very early, we didn’t have version control or at least it wasn’t something I certainly knew about not having grown up in a highly technological area. And I think that’s an important point here is it really depends how you’re introduced to the web. If you come in straight from a bootcamp, you’re going to have a very different lens and a very different idea of how to get things on the web than maybe if you’re casually looking around having an interest, trying to find whatever resources.

Stephanie: And I think even then it depends what your goals are. So I think it can be very easy and approachable, but it can also seem extremely complicated and definitely more complicated in a lot of ways because of the tooling. The tooling can either help or hinder that process, for sure. That’s kind of why I’m fond of Jamstack. I think that is a lower level, easier way to get introduced and get your first things on the web, if that’s the goal.

Vitaly: Right. And that’s also wonderful because you’ve been publishing so many tutorials around Jamstack and 11ty, and maybe you could tell us where do you see 11ty, for example, being extremely useful? What kind of projects would it be a default, let’s say, where you would say, "Yeah, that’s probably going to be working best with Jamstack and 11ty." And where would be its boundaries.

Stephanie: Yeah. Great question. So 11ty is a static site generator and the difference about it versus some other ones is there’s no client-side JavaScript required. You can build from truly flat files, HTML as well as several templating languages, the common ones being Markdown or Nunjucks or Liquid, as well as JavaScript as a templating language. And so it’s very approachable again for different mindsets, so that makes it a great tool, I think, to introduce to teams with different backgrounds, different interests in building a website.

Stephanie: But to your question about when would you choose it or where are the boundaries? So it is great for any time that you, as a starting point, when you don’t have any need for dynamic content. Which isn’t to say that you can’t bring it in, you absolutely can. And in fact, that is something they’re actively working on, is stepping into the idea of Islands architecture and things of that nature.

Stephanie: There’s other tools that are built on top of it, where you can easily bring in a framework that you’re comfortable with like Vue. So there are absolutely ways to expand it. That’s actually why I love it is because you can start at a real simple baseline and just build up as you go. I haven’t found a lot of boundaries. In fact, I’m even doing a project that I am sort of working on secretly dealing with user authentication, and that doesn’t sound like something you could do with static. But with the combination of edge functions and serverless functions, which are super easy to incorporate in, I think that the boundaries are being pushed farther and farther out at this point.

Vitaly: Yeah. That’s very exciting to hear just because when were moving from WordPress to Jamstack back in the day, it feels like it was a century ago now, although it was just five years ago, I believe. It was kind of a, "Wow, how do we do this?" Because we have the shop, the membership and well authentication then of course then as well. And so many other moving parts and the comments, all search and so on. And yeah, in fact, I think that, in many ways, Jamstack has been this really good compromise. I remember vividly this excitement that everybody had with fully client-side rendered applications. And that was the time when it felt at least like a revolution, really. And then it was pushed back. Would you say that Jamstack is kind of that push back somewhere to the server? Not too far away from the client. How do you feel about Jamstack? Is it the golden center for the universe of web development?

Stephanie: Yeah. You know, I’m definitely biased at this point. I’ve been working with it for a little over two years now, and so I’ve seen some of that evolution happening. And, again, having that history with WordPress, it’s one of the reasons I really enjoyed 11ty in particular, having that templating ability, but having that static rendered, you don’t have to worry about SSR, it’s just simply static. Your homepage likely is always static. Your marketing website, largely is static.

Stephanie: But, being that center, I really do think it is because you also have... You’re not prevented from incorporating a CMS, for example. You can bring that in. You can still of course add whatever other, as I mentioned, flavor of JavaScript that you need. It doesn’t have to be truly 100% static, but that’s your baseline. And we all know that’s where we put an emphasis on semantics, accessibility, progressive enhancement. And I think that’s another thing you’ll find in the community if you haven’t quite yet gotten into Jamstack and 11ty, in particular, is a focus on returning to that way of building. And I think that’s the part I see a quote unquote "return" to, is caring about those things.

Vitaly: Absolutely. Absolutely. It all fits in nicely then, somehow, with like you mentioned accessibility, of course, and CSS is just something that we both have in common. That we just have an incredible admiration and love and passion for. And every time I read an article that you’re writing, I feel like, "oh, you can do that with CSS now. That’s wonderful to see."

Vitaly: So maybe you could shed some light on how do you work with CSS? Do you have a particular methodology that you tend to rely on now? Or the way of structuring things? The way of naming things? Of course naming is the hardest part of it all. What seems to be working best for you, for your work, for your projects in terms of building things, in terms of, maybe just to simplify, how do you even start working on a project when it comes to CSS? The folders, the naming, the methodology and stuff like that?

Stephanie: Yeah, absolutely. So I still use Sass. I will continue to use Sass strictly because it allows that organization and I think that’s really critical. I think that’s where a lot of folks begin to have a less than pleasant relationship with CSS, is trying to figure out how to organize. And so Sass for me is that bridge, it’s very critical in my tool belt.

Stephanie: Alongside that, I do tend to use BEM. I’m not always completely strict on it. I don’t always completely rely on even having classes. I think it’s very powerful to focus on the semantics. And I also, I think it’s important to know where I’m coming from. So part of my history involves working on design systems. And so, through that, I’ve become a big proponent of creating components, whether that’s a formal design system or just the way that you’re approaching and organizing and architecting your styles.

Stephanie: I find that to be helpful for me to think of my system as components and to think of my system as having, some folks might know as design tokens, but having like a series of colors and these other, primitive variables, would be another common term, where those are leading into the system. I’m definitely using custom properties. That’s been a huge game changer in how I approach writing styles, both from... Folks might be used to opening up a site, looking at the HTML element and seeing just a whole laundry list of custom properties. I keep mine a little more focused, like I said, colors and really high up global tokens. But an important way that I write my styles and my components is really leaning on custom properties to allow very easy variations of those, very scalable variations of those.

Stephanie: And so, you mentioned my workshop earlier, that’s something we really go into because when you are starting to incorporate those things, you start to... I think it was kind of a light bulb moment for me, learning about these things where my styles became so much more simple, so much more efficient, so much less repetitive, being able to use things like custom properties. So Sass, custom properties, a little sprinkle of BEM, and also, in some cases, relying on particular element selectors that directly hook into accessibility features. So it’s kind of a combination of those things, but it all starts for me at the HTML level. And then I go to my CSS. So, that’s also an important part of my process.

Vitaly: Sure. Of course. Yeah. I also remember vividly that moment when we actually ended up getting custom properties in all the browsers, and I was like, "Wow, you can now do custom kind of variables?" CSS variables, dynamic variables now in the browser. That was incredible.

Vitaly: That also brings me to this notion of... This is a conversation that I keep having with some folks, just thinking about what is the role of Sass today and how is it going to evolve? Just to bring it a little bit more in the context, we now have custom properties for years now. But we also have these proposals for scoping and for nesting, which might be coming up soon. But then on top of that... I’m really excited about that, by the way, just because right now, every time you’re using Sass, we have to produce this humongous chain of classes, if you do nesting, nesting, nesting, nesting.

Vitaly: But if it is actually just written in CSS and just clean and beautiful on how it should be. Plus on top of that, of course, cascade layers, which are already well supported. So I’m wondering at this point, of course, not to mention... I mean, so many things coming up, it’s incredible in CSS, the color mix, color contrast, lighten, darken, all those things that are also coming to native CSS. So I’m wondering just about your take, where do you see now, Sass moving? Is it going to be more for literally processing for things like Mixins, functions, those kind of things? And where would you say this should be in CSS?, and that should be probably staying Sass?

Stephanie: Yeah. So all of those are super valid comparisons to how features and tools such as Sass has informed or helped inform the evolution of CSS as a language. And for sure, I’m excited for those things to come and be native. As I mentioned, organizations is still a huge reason I’ll continue to use Sass to compile my style sheets and still have that separation, like I said, of my components or whatever other parts that are coming together.

Stephanie: Also in a design systems context, or other contexts where you are creating a reusable system and you want to have a little bit better management of your, again, whether you call them tokens or whatever you call those sort of baseline configuration, of how the different customizations enter that style sheet is, I believe still where Sass is going to shine.

Stephanie: And like you said, functions, Mixins. I’m finding myself using less Mixins these days, because, like I said, custom properties gap fills what I was using Mixins for, in some cases. But I still use Sass for functions. Absolutely. So, whether that’s looping through my tokens to spit out automatically different utility styles. To me, that’s still plenty useful enough that I’ll continue to use Sass and that’s functionality that we don’t see in the horizon for CSS.

Stephanie: But yeah, I definitely have changed some of the ways I’ve used Sass. Using :is() and :where(), sometimes those help simplify my selectors in a way that maybe was using Sass for before. So yeah, I’m absolutely a fan of switching over the functionality that should belong in the browser to the browser, but still finding the organization and functions, in particular, to be useful in Sass for me.

Vitaly: Yeah, absolutely. It’s interesting because you mentioned BEM previously and I just recently had a conversation with a few JavaScript developers and the conversation went in a very unusual way for me, because usually I would be comfortable using BEM. I mean, just like you, not the dogmatic traditional the big BEM, but the small BEM. And I do like my hyphens and I do like my underscores, so don’t judge me on that.

Vitaly: But I heard this notion of, BEM, is it still a thing?Isn’t it like from 2017 or ’18 something? Why would you use BEM today, if you have Tailwind and you have CSS and JS if needed? Why do you work so hard to have the naming and have this relationship, which could be potentially just, create user using atomic classes or just writing some CSS and JS.

Vitaly: And I had my arguments about why I would still prefer BEM, but I see that many people feel like, isn’t BEM outdated? And, isn’t Tailwind the thing now? So what are your thoughts on that? And maybe specifically on Tailwind that would be probably quite relevant.

Stephanie: So for me, it’s not the right tool and that has to do with the way that I work, but also the team conventions that I have. And that’s usually what I tell folks, is it depends what kind of project you’re working on. It depends on the makeup of your team, your skillset, your project architecture, just like anytime you choose a tool, all of these things play a part.

Stephanie: As I mentioned, I’m a proponent of components. And so an important thing to remember is that not everybody is using a JavaScript framework. In fact, if we look at global stats, that’s actually a pretty minor part of the web. I know it feels like everybody is using React or whatever other tool, but it’s actually not true in practice. And especially if you’re coming into an established team that is not the latest. A new startup or something. You may not find Tailwind.

Stephanie: And so that’s fine. But the point is that some of these methodologies aren’t as transferable across projects either. So if you’re solely producing one type of project, one application, one product, it’s easier to make a decision towards something like Tailwind, rather than if you’re working on a project that’s intended to be used across multiple outcomes. Maybe I’m using it on my 11ty static site where I’m writing in Nunjucks. But I also need to share it to a back-end application that’s built in React. So my style sheet is going to be a lot more portable if doesn’t rely on CSS and JS, or if it’s not completely wrapped up already in React components. And, teams have found ways to overcome that. And again, your experience is going to heavily weigh into what choice you make here.

Stephanie: Another big one that comes up for folks is the issue of documentation and I absolutely respect that. Where it’s easier sometimes to pick up a tool that has ready-made documentation. So, that’s absolutely consideration in making that decision. I wouldn’t say that BEM is outdated. It’s just a naming convention where I think, as I said, it lends to being a little more portable. The intent of it is to be able to identify what set of styles go together. So we can apply that in multiple locations and have a good idea. I think perhaps in some instances it might be a little more memorable if you don’t have a system where you are able to create and template out components, because again, that’s not every environment that folks are practically working in.

Vitaly: Absolutely. Yeah, of course. It’s also fun to be just talking, thinking about all the things you could do with CSS and moving back to what we talked about briefly before, so many powerful things coming up, it seems like. Just a recent announcement of all the features coming to Safari 16. This is just unbelievable. It’s like Christmas coming in before Christmas. And then of course we have all the wonderful things coming up in Chrome 103 and it’s just all wonderful. Incredible. What are you most excited about of all of those things? Is there anything where you say, "okay, this is life changing for me, this is changing everything that I’m doing with CSS."

Stephanie: For me, it’s the one, two punch of container queries and :has(). I am excited for both of those to be stable. And again, coming from the design system context in particular, I just think we’re going to be able to create the most robust and scalable components we literally haven’t been able to achieve before. So I’m very excited about that as my top two picks coming up here.

Vitaly: Okay, well maybe we should be expecting some articles from you on them, although maybe you have written them already, who knows? I think you might have. Do you find yourself writing as much as you used to be or do you have a lot of writing coming up in the months to come?

Stephanie: Yeah. So writing’s taken a tiny bit of a backseat just because I’ve been working on a project a little more longer term, that’s a build out of a new side project here. So yeah, it makes it tough because I have a backlog definitely of writing ideas, so, hope to get back to that soon.

Vitaly: I hope we’ll get there as well. Well maybe, quickly a few questions to also slowly wrap up. Do you think you have a dream feature that you would love to CSS to have? Frankly, I don’t know, to be honest, if I had to answer that question, I’d be probably out of ideas because I always wanted the parent selector, well, :has() is much more than that, but we have that. And I always wanted container queries. Well, we have that and I always wanted subgroup, well, we kind of have it coming. What else should I wish for? I don’t know. Do you have any dream features that CSS desperately needs?

Stephanie: I think I’m similar as you, at this point, it’s waiting for certain things to land. A year or two ago. I probably would’ve said color contrast in the browser, but that’s even coming. So yeah, the list is definitely shortening of what, we still are waiting for. Another one for me, would’ve been a more native way to do fluid typography and we are also getting that once container queries hits because of container units, we’ll be able to do that.

Stephanie: So yeah, I think the last thing for me is, we have media queries related to Viewport. We’re going to get the container ones. The last thing for me would be expanding that a bit to a few more contexts, like a user browser zoom context would be useful to me. And I’m sure there’s some other device features, and things in that area might be the remaining area to grow a little bit. Sometimes there’s privacy concerns, hardware limitations, these things that prevent those particular features. But yeah, that’s what I kind of have my eye on.

Vitaly: Excellent. Sounds good. Sounds exciting. I’m just really excited to see what is coming up next. It just always keeps me busy. Sometimes I would find myself just going to something like Chromestatus.com just to see, is there anything new on the horizon? Just because I’m curious. Usually it takes a little bit longer than just a couple of days to see something new showing up though. But yeah, this is how excited I am.

Vitaly: Well, so we’ve been learning a little bit about CSS in this episode today. So what have you been learning about lately, Stephanie? Maybe any podcasts that you can recommend? Any books, any, I don’t know, TV shows, anything that’s really got your interest or attracted your interest over the last few months or so?

Stephanie: Yeah, so an area I unexpectedly found myself enjoying is watching developers on Twitch. So I’ve been learning all kinds of stuff from some fabulous streamers. Folks might already know, but White Panther whose Salma Alam-Naylor is excellent. And also I’ve really enjoyed Alex Trost who runs the Frontend Horse community. So if you’re looking to learn maybe some unexpected things in a little different format, that’s what I encourage folks to do. Kind of shake up where you’re getting your inspiration.

Vitaly: Excellent. Well, if you’d like to learn a bit more from Stephanie, we have an upcoming Smashing workshop, which is going to look into all kind of things CSS. probably also Sass, probably also BEM, and probably also 11ty, if I’m not mistaken. This is taking place on July 11-25th. And of course there are a few tickets left, so please do take a look and join in. And if you, dear listener, would like to hear more from Stephanie altogether in general, you can also find her on Twitter where she’s @5tp3h or Steph and on her website at https, of course, thingdobecreate.com.

Vitaly: Well, thanks for joining us today, Stephanie. Do you have any parting words with the wonderful community? Things that will remain in somebody’s memories centuries after they hear it here today?

Stephanie: Big responsibility. Experiment, play and share what you know.

Smashing Podcast Episode 47 With Sara Soueidan: Why Does Accessibility Matter?

In this episode of the Smashing Podcast, we ask why accessibility really matters and why it is so important to get it right. Smashing’s Vitaly Friedman talks in-depth to Sara Soueidan to find out.

Show Notes

Weekly Update

Transcript

Vitaly: She’s an independent web user interface and design systems engineer, author, speaker, and trainer based in Lebanon. She worked with companies and agencies all around the world from Netflix, and Telus, and the Royal Schiphol Group at Amsterdam airport, just to name a few, where she built digital products with focus on accessibility performance and of course cutting edge tech.

Vitaly: Now, she also writes beautiful and very comprehensive, very, very comprehensive articles all around front-end SVG accessibility on her wonderful blog. And she’s also working, which might be a rumor; we’ll find out on her very own video course on web accessibility. So, in all, she’s an expert in creating accessible and beautiful interfaces.

Vitaly: But did you know that she loves tea, drawings, and birds and has raised more than a dozen of them throughout her life? So, I shouldn’t be surprised to hear the birds chirping when we have a call just now. My smashing friends, please welcome Sara Soueidan. Hello, Sara, how are you?

Sara: I am smashing. How are you?

Vitaly: That’s wonderful. I don’t know. I feel like coffee today. I had already three, and I feel like I should get forth, but you’re not big on coffee, are you?

Sara: No. I have my matcha sitting right next to me right now.

Vitaly: Okay. That would be a very surprising start to the conversation. But what is your favorite tea, if I may ask?

Sara: My favorite tea, if we’re not counting matcha as tea, even though it is actually tea, but if... okay. So, I’d say it’s either a matcha or ginger tea. I love ginger.

Vitaly: Okay. Now, dear friends, if you ever want to ship any gifts to Sara, you know what to ship. Now, staying on the topic of food and drinks, and beverages, it’s interesting, Sara, because I know we’ve known each other for, I don’t know how many years now. And we even shared pizzas on very different occasions in various parts of the world, that surely counts for something.

Vitaly: And one thing that really astonishes me when I think about our conversations and I think about you as a personality and just the incredible work that you put on the web, it’s just incredibly difficult for me to find many people who are more passionate about accessibility as you are.

Vitaly: So, maybe you could give us a bit of a background of where this genuine empathy and excitement about accessibility comes from. Where did it all start, Sara? Where?

Sara: Do you want the long version answer or the short version answer?

Vitaly: The very long answer, if I can.

Sara: Are you sure?

Vitaly: No.

Sara: Yes.

Vitaly: Okay. But make a choice, whatever works for you works for me.

Sara: Okay. So, if you want some background, I’ve always been the kind of person who loves helping people, even if they don’t directly ask for it. So, I’m just going to give you a quick example. Back when I was in college, I think it was my second year in college or in university, and it was the start of the year, and everyone was in the university, and we were registering and doing all the necessary paperwork that we needed to do to start going to class.

Sara: And there were a lot of people, basically. And there was this one old man, he was standing in the middle of the crowd, and he was carrying a few papers in his hand and a pen. And he looked absolutely clueless. I could tell from his facial expressions that he was lost. He had no idea what he was supposed to do.

Sara: So, I approached him and I asked him... I always do this, by the way. I’m not sure if this is a good thing or a bad thing, but I tend to do this with strangers a lot. So, I said, “Is there anything I can help you with?” He looked at me, and he said, “I have no idea basically how to fill the paperwork in.”

Sara: He was there to register his son, who couldn’t be there. So, he was registering him instead, and he didn’t know how to do it. And I know how difficult it can be the first time. Because my first time, when I went to college for the first time, in the first year, it took me four days to register because there was no one there to help you.

Sara: You can either find your way on your own, or you would just have to ask people. And if you don’t ask anyone, you’re just kind of stand there like that old man did. So, I asked him if I could help him, and he welcomed my help. I took the paperwork. I took the pen. I started asking him questions and filling in the paperwork for him.

Sara: And then, when I finished, I told him exactly where to go next, exactly what to do. And I basically just helped him as much as I could. I do this with a lot of people. I don’t know; I think it’s just part of who I am. Helping people makes me feel amazing.

Sara: Even the smallest acts of anything that you do in your daily life makes them meaningful and gives them purpose. So, to know that I have contributed a positive thing, no matter how small, into someone else’s life is wonderful. And I want my work to have a purpose, as well.

Sara: So, when I started my career as a developer, I think it was in 2013, and this is something that I’m sharing for the first time, I went through a few years where I felt like what I was doing wasn’t very meaningful, to be honest. So, I was just doing what I was doing just to make some money, make a living, and that was it.

Sara: But I would get designs someone made and turn them into something that worked, which is nice because I love doing that. But as always, I kept asking myself for years like, “What good is this contributing to the world?” I wanted to feel like the code that I’m writing can make a difference. And it took some time for me to finally get there.

Sara: So, I started changing my path, so to speak, by choosing the clients that I wanted to work with. I started choosing clients that did meaningful things in the world. That way, if I help them create a website to expand the reach, it meant that I was contributing to something good in this world, as well.

Sara: And I even expressed that on my Hire Me page, where I’m explicitly clear that I’m looking to do something meaningful in the world. So, there is that. And on the other hand, I’ve always been fascinated with design, in general. I’ve never taken a design class in my life, not in university, not outside of university, but I’ve always been interested in design because of how it directly impacted people’s lives.

Sara: You can maybe start to see connection here. So, I’m going to give an example from the adjacent design field. Many people who have been following me for years know that I’m fascinated and very passionate towards interior design. And the best thing I’ve ever read about interior design is that interiors should be designed around how we live.

Sara: So, how do you decide what you put in the kitchen, for example? How do you decide how much space you give a certain feature or piece of furniture in the house? The answer is based on how often it is needed by the people who will live in this house.

Sara: A great interior designer will sit down with their client and ask them questions like, “How do you start your day? What does your typical day look like? What do you do when you wake up in the morning? Do you work from home? Do you like having people over? Do you like entertaining? What are your hobbies?”

Sara: And the answers to all these questions they asked creates the framework and guides the interior design decisions of the house that the client will live in. The house is designed and built around the client’s lives, not the other way around.

Sara: And I love that because if design isn’t about people, then it is selfish, right? Then, you’re not really designing for people anymore. And accessibility and inclusive design in general, but accessibility is not the same as inclusive design. Accessibility design is all about people.

Sara: There is no room for selfishness, in my opinion. So, what you design and build either works for the user or it doesn’t. And if it doesn’t, then it needs to change because what good is anything that you built for people if they can’t use it?

Sara: So, connecting these two things, I love design, and I love designing for people, and I love helping people. So, when I first learned about accessibility, and I found out that some of the work that I was building prior to that was possibly creating barriers to access for people.

Sara: I felt horrible. And I started feeling more responsibility, and I started digging more into accessibility and learning more about it. And what I love the most about it is it makes me feel more like a designer. Why? Because, well, I do believe that all of us, we are designers, one way or another.

Sara: And the work that we do and the decisions that I make as a design engineer when I write code, these decisions have a direct impact on the user experience, and that makes me a designer. So, every decision that I make has a direct impact on the experience and the inclusivity and accessibility of the interfaces I built.

Sara: A decision such as, for example, what HDML element I choose to use, how do I apply the styles because CSS affects semantics, which affect accessibility, which development strategy I follow, which is a progressive enhancement or something else. Whether I use platform features or a third-party library, which library do I choose?

Sara: How does it perform? All of these things, they impact your work, and eventually, the user experience. And design should be about people. Accessibility is about people, which means that it gives code purpose. It gives the work that I do purpose, which brings me back... the first thing that I mentioned, I want to feel like what I’m doing has a purpose and is actually beneficial for people.

Sara: And this is why I love accessibility, in general, because it is a concrete, practical type of design, something either works or it doesn’t. And there is no room for bad decisions because it’s about the user, not about you. So yeah, I’m passionate about accessibility because-

Vitaly: I could tell. Yeah, that’s incredible to hear. And actually, a few things that have really connected the dots for me, as well, because when I think about the work that I’m doing, as well, I feel like... we don’t even notice that sometimes, but all these minor decisions about the labeling of navigation and the way we design navigation, and the way we make buttons to look like buttons.

Vitaly: All those things can have tremendous impact. We might feel like, “Okay, we’re just moving pixels around.” And we’re just making things a little bit more nice, right? But I think that the right significant decisions that we end up, that we use to really help somebody in different situations, complete the task, to find information that they need, and so on.

Vitaly: And one thing that really comes up in my mind every time we have this conversation is that you often identify yourself with a design engineering role. And I see that some teams are moving towards that role now. Where in the past, it was just a developer, and then it was just a designer, and then it was a front-end developer and backend developer.

Vitaly: And if you have an interface designer, you have to use the experience designer. So, maybe you could share a little bit of light on how you see design engineering as a role. And maybe many of our listeners now actually are design engineers without even knowing that. So, how would you define it? And do you think that companies actually understand what it means?

Sara: I have actually an essay, not just an article, an essay that is all about just defining the role of a design engineer. And from my point of view, I even have a domain name that I purchased just to put that on it. If I try to describe it with just a few words because I already gave a super long answer to the previous question-

Vitaly: That was a wonderful answer. It wasn’t long at all.

Sara: Thank you. Okay. So, as design engineers, we specialize in implementing designs. That is the general description, right? We specialize in implementing designs, but then, of course, there is how you implement it. So, I like to label myself as an inclusive design engineer, which is something that I’m doing on my new website, which is not public yet.

Sara: So, an inclusive design engineer is someone who, in my opinion, uses accessibility and progressive enhancement as a framework to build inclusive interfaces. But, as a design engineer, in general, is someone who works directly with designers, hopefully, because this is what I think the role should be.

Sara: We should be working directly with designers, helping them make decisions and informing design decisions with our accessibility and code knowledge, basically, because they complement each other. We write HDML. We write CSS. We write presentational JavaScript, mostly.

Sara: And with a strong focus on accessibility, hopefully, because that should be part of every design engineer’s job. And then, of course, the strategy that you choose and the frameworks that you use, and I’m not talking about CSS frameworks or JavaScript frameworks here, but like I said, this... let me just call it the strategy.

Sara: Strategies that you use and what exactly you focus on, and how you do your job as a design engineer probably differs between people because like I said, I’m a progressive enhancement advocate, others are maybe not. So, we would differ in these small details.

Sara: But a design engineer is someone who works with designers, helps inform design decisions and makes sure that designs are implemented in a way that hopefully works for as many users as possible.

Vitaly: Right. So then, as a design engineer, at this point, how would you then actually work? So, what would your process be like? So, when you think about implementing a particular design, do you break it down into components? Do you think about navigation landmarks first?

Vitaly: How do you actually start building things? What is your maybe mindset in that framework of getting accessible results? Maybe you could describe it a little bit.

Sara: Okay. So, when you say that you divide the... you not divide, basically looked at the design and then start thinking in components, that very much depends on the process that you work with the designer. So, if I’m working with someone who has handed over a design, like an entire page, the process is different from when I’m working with the designer, like I did with Yan Persy.

Sara: I’ve mentioned him multiple times on Smashing Hour, by the way, because working with him was one of my favorite ways of working with the designers because he didn’t have like a full finished design for me to implement. We worked in tandem. We worked together. And he changed some of the things in the design.

Sara: So, for example, he wasn’t using a responsive type scale like we do in front-end development now using CSS variables and viewport units, et cetera. So, we had this discussion, and then he shifted the way the design process went. It was different.

Sara: So, we both started building the site in terms of components, and then assembling those components into what we called slices back then, and then assembling the slices into the entire website. So, how I start from whether it’s components or not, depends on the process that I work with the designer.

Sara: But then, if I get a little bit more technical, like if I have a component that I want to build, how do I go about doing that in layers, I would say? Again, progressive enhancement, the first thing that I think about is how does this work? How does this look like?

Sara: How does someone perceive this if JavaScript is disabled? And what happens if there is no style? So, I just start with the bare minimum, HTML, because HTML defines the semantics. The semantics give meaning to the content that I’m creating.

Sara: So, which HTML elements do I need to tell the user what this thing is to give semantics? If HDML already contains an element that represents this component or this element that I’m building, I use that. If not, then I start to thinking about ARIA attributes; which ARIA attributes do I need?

Sara: How much ARIA do I need? ARIA is... it’s not an enhancement; it’s necessary for a lot of dynamic and interactive components. But I always try to think of it as a last resort, not a first one, so always semantic HTML first. How much can I get done with just semantic HTML?

Sara: How accessible is it? Do I need something? Do I need to polyfill some semantics using ARIA? If I do, then I start thinking about that. And then applying CSS, and how does CSS affect these semantics? Does it? Does it not?

Sara: Do I have to do something extra to make sure that something remains accessible after I style it? Like, for example, if you stripped away the default list styles on list elements, which is something you probably... and many people probably already know by now, if you set list style to none, for example, on an unordered list, then Safari or WebKit, WebKit, in general, is going to remove the semantics of the list.

Sara: And VoiceOver is not going to announce that anymore. So, what do I do in that case? Do I need those semantics? Do I go into the HTML and add them again using a role attribute or not? So, I think about this stuff in layers. Start with HTML semantics. Do I need ARIA? How do I style this? And then, interactivity is always the last layer that I think about and that I build into components.

Vitaly: Right. Makes sense. It’s interesting what you’re saying that it’s a process. It doesn’t seem like a simple process, especially when you think about like literally implementing quite a complex interface, which may also have all kinds of different views and maybe single page application in the back and so on.

Vitaly: And one thing that I’m struggling with when I’m doing work with clients and trying to make things more inclusive and interfaces maybe a bit more usable is that very often web accessibility is still seen as this little thing. Like, “Okay, that’s just semantics.” “Okay, so we’re going to use buttons for buttons.”

Vitaly: But it’s actually much, much, much more than that. And I’m wondering, what do you think... like, where do we actually stand in terms of accessibility today? It’s very hard for me, personally, for example, to imagine a new project being released without even considering accessibility.

Vitaly: I think that might have been possible maybe a decade ago. I think today, it would be very difficult to imagine a brand new project that’s going to be advertised everywhere on posters that is not accessible at all, some parts accessible, but maybe not everything.

Vitaly: So, what do you think, has accessibility not become just the natural part of every design implementation process, or are we way, way, way, far away from this yet?

Sara: I think we are not too far, but we’re still far. So, there is definitely a lot more awareness on accessibility. I hope so, at least, because I only follow like less than 250 people on Twitter. And most of the people in my circle are people who either work with accessibility or care about accessibility.

Sara: So, if I were to judge the current situation based on my little circle, I would say that accessibility is doing great, and people care about it a lot. And they work to make their content more accessible. But I can’t speak for everyone because I know that this isn’t the case for everyone.

Sara: I know that there are still many developers who just simply don’t care. Because with accessibility, you either care or you don’t care; this is it. If you don’t care, then you are basically not doing any accessibility work at all.

Sara: And then, on the other hand, those that do care about accessibility and try to implement it in their work, some of them are finding difficulty because they get lost in all of the resources out there, and where should they go? Where do they start? This is why I’m creating the accessibility course now, to hopefully help with that a little bit.

Sara: So, we are definitely doing much better than we did like five years ago, let me say, five. But I don’t think we’re just exactly there yet. No. I think it’s going to take more time.

Vitaly: Yeah. But then, I also hear developers telling me all the time, “Well, hold on. But the platform is evolving so beautifully at this point. We have not only the wonderful CSS feature coming along, but also we have these incredible things that common UI components, like input type date for a date picker, the dialogue for models, details, and summary for accordions.”

Vitaly: And very often, what I find is that they just use those things, and they think that, “Okay, well, since these are native components available on the platform, they surely are accessible.” And then, come eye along, and then there is trouble. I’m wondering, at this point, what would you say in this position?

Vitaly: Like, those things, would you recommend to use them ever? Or where are there? Ideally, it would be a very nice idea and situation where we ended up with all those native components just available out of the box, beautiful, accessible, inclusive, and all of that. Are we there yet?

Sara: No.

Vitaly: Are we again, far away from it?

Sara: No. No. We’re definitely not there yet. I know that the dialogue element, for example, has been pretty... I don’t want to say completely inaccessible, but it has had a lot of accessibility issues for years now. And I think it only started getting better this year. And then, input type equal date, I rarely ever used it because, to be honest, I don’t think that it offers the best usability anyway, even if it is accessible, which I think it’s... I don’t know.

Sara: I haven’t used it in a very long time, so I can’t even tell if it’s fully accessible or not. But I think the last I heard was that it wasn’t and that it was a usability nightmare. So, even if something is technically accessible, that doesn’t mean that it’s going to be usable. Definitely a lot of tests.

Sara: And I like this quote by my friend, Scott O’Hara, that he said in one of his talks. He said, “Technology and user expectations change rapidly. And we should always test to ensure not only emerging patterns work correctly but try untrue patterns continue to work as we expect.”

Sara: This is me, now, continuing. Sometimes even something that you know works may stop working as you expect. Browsers may create new heuristics, for example. And the way they... not interpret, the way they present something because the user may change on any day.

Sara: Also, a note about details and summary, which is something that I had a discussion about today, details and summary are not the best choice for an accordion. They can be used for an accordion, but even they... like, when you choose any component, the first thing you have to think about is the semantics.

Sara: What are the semantics that are going to be conveyed? Because the semantics determine the non-visual interface for a non-sighted user, for a screen reader, for a user, for example, assuming they’re a non-sighted screen reader, the user.

Sara: Details in summary, they have their own quirks when it comes to semantics. So, the summary has a button roll, which means that it is conveyed as a button to assistive technologies. And buttons eat up the semantics of the elements inside of them.

Sara: So, if you have a heading, which is what you would normally have in an accordion, and if you put that inside of a summary, then the heading is not going to be conveyed as a heading anymore. Of course, there are exceptions because sometimes browsers try to quote, fix our misuse of ARIA or our misuse of semantics.

Sara: And they try to help stream users by conveying things that we may have broken as developers, but it doesn’t mean that all browsers do that. So, definitely, always, you need to test. And if details in summary, for example, if you use that, and if the headings are not exposed as headings, and then the user cannot use those headings to navigate, for example, anymore.

Sara: So, even if something is technically accessible, yes, they can access the contents of summary. Yes, they can access the contents of the details. But you have to think about what semantics you are conveying and how they affect the usability of the interface and sometimes maybe navigation, so there are a lot of things to keep in mind.

Vitaly: Yeah. So, it’s interesting that you brought up the testing for accessibility at this point. Because when we run our workshops, and every now and then, we... in my workshop, I tend to just explain to people how security works. And I always ask the same question. And for the last, I don’t know, two, three, four years, maybe now, I’ve been asking the same question.

Vitaly: So, who is hearing this VoiceOver for the very first time? And these are usually designers or developers coming to those workshops. And very often, you would see a vast majority of people hearing things for the very first time. So, maybe you could also share a bit of light in how do you actually test accessibility?

Vitaly: Do you always have screen reader or VoiceOver on or maybe any other tools? Could you also, maybe, run us through the process of testing your components for accessibility?

Sara: Okay. So, there are quite a few things that I like to use, and I’m going to mention them in no particular order; definitely browser DevTools to inspect the accessibility tree because you can get a lot of insight on the accessibility of the elements and components that you’re building from the accessibility tree.

Sara: Because basically, the accessibility tree is the accessibility... contains the accessibility information that the browser has created for assistive technologies to announce. So, when you look at the accessibility tree, you can get an idea of how an element is going to be announced by a screen reader that accesses and gets that information from the browser via the accessibility API, of course.

Sara: So, the dev tools for accessibility tree. There are a lot of extensions that I like to use, for example, to see the document outline on a page or to see the landmarks on a page. If I’m doing an accessibility audit, I would definitely use an automated testing tool such as asking DevTools, for example.

Sara: As far as screen reader go, definitely like... you cannot just test on one screen reader. And I have been guilty of this. I mean, I’m not like preaching something that I don’t practice now, but I know that I didn’t practice this before. I don’t have access to a windows machine.

Sara: So, I recently... not recently, like a few months ago, I started using Nvidia A on my windows virtual machine. And I also recently got a license for JAWS because JAWS is not free, but Nvidia is free. So, I used VoiceOver with Safari on iOS. Sometimes I test on other browsers, as well, just because sometimes, maybe a VoiceOver using may be using another browser.

Sara: But generally speaking, VoiceOver and Safari are the best combination, and users typically know that. And on windows, I test Nvidia A with Firefox, Nvidia A with Chrome. And the narrator is also built into Windows, so I use that for testing as well.

Sara: And JAWS is the most popular screen meter according to the WebAIM screen reader, user survey. So yes, you have to test using multiple screen readers and browser combinations because just like you cannot test your website only on one browser.

Sara: Like say, you’ve built a website, and you want to test, if everything is working as expected, all your CSS and stuff, you don’t just test it on one browser, right? You test it on most modern browsers and possibly even on IE if you still have to support that. Just like you test on multiple browsers, you also have to test on multiple screen readers, if you can. So, this is what I do, in general.

Vitaly: Yeah. So, you also mentioned in one of the Smashing Hours that tool.

Sara: Assistive labs.

Vitaly: Assistive labs, which is like browsers tech for screen readers, which is really need to see, as well. And I think, for me, it’s really this really interesting world of other browsers, I would say because we tend to focus a lot on what are some of the fancy new features we get in Firefox and in Chrome, and in Safari.

Vitaly: Just in general, would you say that the development of screen readers is... the frequency of updates, is it similar or is it something like maybe there is a new version coming up every six months or only just once a year, because we have this comparability, right, stuff happening across browsers.

Vitaly: So, as much as it used to where you’re using Firefox or Chrome, or Safari, or Edge, at this point, do you see that it’s also moving in the world of screen readers towards this comparability mode... not mode, compatibility across different screens readers? Or is it... maybe you could share just a bit of light about that world and that universe of screen readers?

Sara: To be honest, I’ve never dug that deep into it. So, I haven’t been monitoring, for example, screen reader updates, like how often Nvidia is updated and how often JAWS is updated. But I do know that even if JAWS or Nvidia is updated, not all screen reader users are going to update their software because they’re aware of... a lot of things may break for them.

Sara: And if they already have an environment that works, nobody wants to break something that works for them. So, I know that many screen reader users do not update their software as often as we may think that they do.

Vitaly: Right. Well, of course, talking about browsers, at this point, I do have to bring out the wonderful notion of wonderful CSS. And obviously, I do have some questions about CSS, as well. And one thing that I definitely have to ask, and I know what your answer is going to be, but I still like hearing it every single time.

Vitaly: So, I am going to bring this up. I have a feeling... well, I know that you have or maybe don’t have strong feelings about CSS methodologies or frameworks, or JavaScript frameworks for that matter. Do you have any favorites, or do you not? Do you always just work with what the project requires?

Vitaly: How do you pick your battles? Would you ever use any framework or CSS framework library Tailwind, CSS and JS; I don’t know. I mean, a short, no would suffice.

Sara: I can’t just say no, because it depends on the project. If I’m working with a team and everyone on the team is using Tailwind, then I will definitely be using Tailwind with them. But I’ve never had to do that yet. And I’ve been super lucky with... actually, I would even say privileged with the projects that I’ve worked on so far.

Sara: So, no, I don’t use any CSS frameworks. I prefer not to use them because they come with a lot of... and I’m not, not talking specifically about any particular framework here. Most of them come with a lot of overhead. And for me personally, I feel that trying to remove all the unnecessary CSS or learn something or learn it from... it’s just so much faster for me to build something from scratch, literary.

Sara: Like, I have some CSS that I’ve created over the years that I moved from one project to the other, and of course, I constantly update that, and I used that. It’s like a mini, tiny framework that I used. Like, there are some utility classes that I used in there.

Sara: Some settings, I called them these settings files for setting up the type scale and the tokens for theming and all that stuff. But I would definitely rather not use a CSS framework. I don’t have super strong feelings about them. I personally used a combination of BEM ITCSS and utility classes in my work.

Sara: And I only add as much CSS as I need. So, if I need a utility class, I add it to the utility class list that I have. If not, I don’t just add it just in case I’m going to need it. I’m super minimal when it comes to writing CSS.

Vitaly: Right. Sorry, can you hear the voices of the wonderful people on the remote corners of the internet asking for that little framework that you have created to be open source, maybe?

Sara: I will. I do plan on doing that. Yes. The course has taken up most of my time. My website has been neglected. My blog has literally been abandoned for months, and I’m going to do... like, even the website that I’m using, I built the course website from scratch using 11T.

Sara: I’m even considering sharing that as a framework, if anyone wants to use it someday. So, a lot of stuff that I have on my to-do list, but I’m postponing all of it until after the course is released because I need to get this done.

Vitaly: Right. So, maybe let’s just jump into the course. I think that we’ve been speaking about it a couple of times already, but I could not be more excited to actually get this course finally released. Well, do you think you could actually share a bit of insight about what’s going to be about, when it’s going to be released, and where wonderful people listening to this show can subscribe to updates to actually get it when it does get released?

Sara: Okay. Updates, subscription, e-mail, newsletter on practical-accessibility.today, that is the website for where the course is going to be hosted currently. It just includes an overview of what the course is about and a link to subscribe to the newsletter.

Sara: But hopefully next month, when the backend is finally ready... because we’re doing everything from scratch, and I hired a friend of mine to build the backend and all the payment stuff into it. Once that is finished, the website is going to be updated with more details about the course. So, I’m going to introduce the course in a short video.

Sara: There’s going to be a more detailed table of contents. I haven’t shared a table of contents yet because it keeps changing a lot. Like, even yesterday I added a new section or a new chapter in between two other chapters. So, if I had shared the table of contents before, it wouldn’t have been super accurate.

Sara: So hopefully, in a month... I think during the next Smashing Hour, I’m going to be making an important update on the course.

Vitaly: Oh, that’s cool. That’s nice. That’s nice. Can I ask you just on that point? I find it so difficult to record videos. I always see like, “Oh, no, no, no. I shouldn’t have said that.” I should brief rewind back, and then I should re-edit and then I should change.

Vitaly: And then, I keep going all the time, and it takes me, I don’t know, hours to just record 10 or 15 minutes of stuff. Is it the same for you? Or do you just go?

Sara: I’m already worried about this because I haven’t recorded anything final yet. I’ve only done a few, so like some testing and editing stuff. I’m starting with a course in reverse, actually. I’m not recording first. I’m going to give more details about the process and everything later, once it’s finished.

Sara: But I’ve decided to do things in a different way so that when it’s time to do the recordings and the editings, I hope will hopefully have eased things for myself, so that they don’t take as much time. And something that I need to keep reminding myself of is because I’m a perfectionist, and that sometimes is a bad thing.

Sara: I’m just going to assume that I’m on stage in a conference and just like, I can’t edit every single word I say on stage. I’m going to try to just ignore some things in the videos. That’s going to be super difficult, especially because I know that I can edit them, but it’s definitely going to take some self-discipline to do that.

Vitaly: Yeah. So, it’s impossible for me. I always say like, “Oh, no, no, no, of course, I can go back,” and surely I can come back. So, in the end, it just takes hours. But I think that we all cannot wait for the video course to be finally released and get our hands on the videos.

Vitaly: This is very, very exciting. Maybe talking about excitement, I know that there are so many wonderful new features coming to the web. I don’t know when it’s coming. Is it like Chrome 103 something, where we should be expecting the :has() pseudo-class coming in, container queries coming in? It’s like Christmas is coming early.

Sara: The year of CSS.

Vitaly: Yeah, the year of CSS. So, maybe you could just share a bit of light about what are you excited about at this point? What is the thing that keeps you awake at night where you think, “Oh, if it only was available today, I would use it all over in my projects.” What would that be? Or what are you most excited about these days in CSS?

Sara: Well, CSS doesn’t keep me up at night, but I do look forward to things like definitely subgrid. I know that I was one of the people who started requesting container queries years ago, and then we finally got them. But then, at this point, we were already doing a lot of intrinsic responsive design already and using flexbox and CSS grid to create responsive components that don’t require container queries anymore.

Sara: Although, I mean, they are still important, and I will definitely still be using them. But probably what I’m personally more excited about is cascade layers and subgrid because almost every single project that I’ve used, especially since I worked on the Prismic Slices Project in 2019, that project changed the way I started building websites, at least for me.

Sara: It influenced the work that we did on the ?? website with Yan. And it also influences now, my own work on my website, for example. Instead of thinking of either pages or small components, there is this middle ground, which is slices.

Sara: And layout within slices always... like I’ve always wanted the ability to inherit the grit on the parent container of the parent container into the child. And so, subgrid is going to be one of the things that I will probably need even more than container queries in my work.

Sara: Cascade layers, I wouldn’t say that I need it, but the way it allows me to organize my CSS, the same way the CSS is organized inside of my head, so to speak, that is one of the reasons why I’m excited about it as well.

Vitaly: Okay. And then, maybe just a few final questions to finally wrap up, just because I’m very, very curious, so I’m sure you have a couple of books lying around at this point; how do you organize your books? Are they organized by topic? Are they organized by color? I met some people doing that. How do you organize them?

Sara: By color, but not like the rainbow style color that other people do.

Vitaly: Okay. How many pencils or pens do you have on your table most of the time?

Sara: Probably two, like one or two.

Vitaly: And how many screens?

Sara: You mean for work?

Vitaly: Yes.

Sara: Right now, just two, the laptop and an external display, 32-inch.

Vitaly: Okay. Because for me, moving to a secondary display was really a deal-breaker, so it’s just incredible. And then finally, one thing that I do want to ask, and it’s totally unrelated, is, do you happen to have a printer?

Sara: No, I haven’t had one in more than two decades, I think.

Vitaly: Yeah. Now, I feel just lonely because every time I bring this up, because I just got a printer, like what, two months ago. And I’m very proud of this because this is like me having a printer like the first time in two decades, seems like I’m the only person who’s buying printers at this point. That makes me very, very sad.

Sara: I mean, you’ve lived in Germany, right, and you still do a lot of printed paperwork there, so you need it.

Vitaly: Yes, indeed. You’re absolutely right. Well, okay, now we know that. All right. So, we’ve been learning a little bit about what it means to design and create more accessible interfaces today; what have you been learning about lately, Sara? Maybe one interesting insight or one unusual thing that you’ve learned recently, which really changed your views, maybe it’s just something that somebody said to you, which has influenced your work or just the way you’re thinking about design or about development, anything in that department?

Sara: Nothing that big, but a lot of small detail.

Vitaly: Like what?

Sara: There is super technical thing.

Vitaly: Okay. So, when it comes to implementation of accessible components, and things like that.

Sara: Yeah. There are a lot of things that I learned from digging really deep into specifications. And I love that because my go-to resource to learn about almost anything starting with CSS and other things, is to go to the specifications first. And there’s so much I’ve learned from that recently.

Vitaly: All right. Excellent. Well, so, if you, dear listener, would like to hear more from Sara, you can follow her on Twitter, which is @SaraSoueidan. And also, find all her work on her website at sarasoueidan.com/.

Vitaly: And also, don’t forget to subscribe to practical-accessibility.today, which as we’ve heard today will be released soon. So, this is something I’m very, very much looking forward to.

Sara: In the summer, hopefully. That’s what I’m aiming for.

Vitaly: Well, that’s fantastic news one way or the other. Well, thanks so much for joining us today, Sara. Do we have any parts in words?

Sara: Thank you for having me. Today is Global Accessibility Awareness Day. So, if there is something or one thing that you can do today, I would say go either learn something new about accessibility. Or, if you already have the knowledge, fix something on your own website or on somebody else’s website, like open a PR, or fix an issue that exists somewhere out there. Spread the word on accessibility, and subscribe to my newsletter.

Smashing Podcast Episode 46 With Vitaly Friedman: Who Is Elliot Jay Stocks?

In this episode, we ask how one man can go from designing websites for local bands to heading up Google Fonts Knowledge. Smashing’s Vitaly Friedman talks to Elliot Jay Stocks to find out.

Show Notes

Weekly Update

Transcript

Vitaly Friedman: He loves typography from the bottom of his heart. And in recent years, he’s led creative direction for several products and services, including the print magazines 8 Faces and Lagom. He worked as a creative director of Adobe Typekit now called Adobe Fonts, and these days he’s running things at Google Fonts Knowledge.

Vitaly: Outside of the realm of design, he also does electronic music as other form, and has also released music on several independent labels. Well, we know that he’s an expert in typography and electronic music, but did you know that he’s an avid fan of underground Icelandic techno music from the late ’90s and usually dreams about pixels, font sizes, and REM units.

Vitaly: My Smashing friends, please welcome Elliot Jay Stocks. Elliot, hello and how are you doing today?

Elliot Jay Stocks: I am smashing, thank you.

Vitaly: Oh, well you look smashing as well if I may so. You haven’t changed a bit.

Elliot: That’s very kind of you to say. I was going to already say that I feel smashing even before I was directed to do so.

Vitaly: Oh, I don’t know who directed you to do that at all. Don’t you reveal the secrets that we have here.

Vitaly: Elliot, when we actually look back now, I don’t know, we saw each other when like the last time, was it like 15 years ago?

Elliot: I was going to say, "That’s crazy. No way," but actually, I mean maybe, yeah.

Vitaly: 15? No, not 15.

Elliot: When we saw each other, oh, sorry. I thought you meant when we first met. When we first met, maybe it was 15 years ago.

Vitaly: Yes. And when did we see each other last time?

Elliot: Oh, wow. It’s been a long time since I’ve seen anybody.

Vitaly: Yeah. Well you do see a lot of electronic music though.

Elliot: Yes. That’s true.

Vitaly: So that counts for something.

Elliot: Oh, boy. I think it was in, I don’t know, Jonathan Snook was there. Where were we? It was you, me and Jonathan Snook. I don’t know. Was it during a talk, maybe?

Vitaly: I have a feeling it was maybe, probably a room with people and the stage and you probably were speaking. Right?

Elliot: Maybe.

Vitaly: That’s probably... But before we actually dive into the specifics, I know that many of our listeners will have heard about your work and your blog post and also your music and all the wonderful things that you’re doing. But I’m always interested in people, like really coming back to the roots, there must be something that started all of this, right?

Vitaly: And so I really want to hear a little bit about your backstory. So how does a boy with curly hair born in the suburbs of London gets his life through kind of thoroughly defined by web topography and design and electronic music. How does that happen? Tell us.

Elliot: Well, thank you for the question. I think a lot of it is all just accidents, happy accidents, and just trying stuff out and seeing where that goes and not being too worried about the future plans, I suppose. I suppose I think that’s kind of probably the thing that’s defined my career path as it were.

Elliot: So when I was a kid, I did a lot of drawing. I remember like my dad teaching me things about perspective and stuff when I was young and I used to do things like a lot of illustrations for the school, they’d have like a play on and I’d do the little pamphlet illustration for the program of the play and all sorts of things like that.

Elliot: So I was always kind of doing drawing for fun and then asked by people to do with the school, to do like other stuff around that. It was always kind of art based. And I didn’t really dabble with design properly until I suppose I graduated from high school. And before I went to uni, I took a year out and I worked in a music shop in Virgin Megastores, when they still existed.

Elliot: And I was doing a little bit of music at the time with some other people who worked there and we released a CD, which sounds very quaint now doesn’t it?

Vitaly: Yeah. Oh a little bit. How old were you then?

Elliot: Well, so I would’ve been 18, I guess.

Vitaly: Yeah. Okay. So, that’s what cool people do then in nowadays.

Elliot: Yeah.

Vitaly: They just sing on CDs.

Elliot: That’s right. Well maybe, and the managers of the store allowed us to put the CD on sale in the store. And so it fell to me to design the cover and I’d started dabbling with... I don’t know what it was.

Elliot: It was like some sort of version of Photoshop, like a free version of Photoshop or something like that. And I was doing kind of stuff with terrible Photoshop filters and things like that. And-

Vitaly: So that’s where it’s all started. I can see that, now.

Elliot: Yeah. It was all this kind of thing. And I did the POS and the website for it. And it was the first website I’d kind of done. Well, yeah, it was my first experience. And the web was relatively new at this time. And I used an editor called Homestead, which was like a sort of WYSIWYG editor. And that whole thing was just kind of my first experience of design, I suppose.

Elliot: Web design and print design. And that kind of, I guess, ignited that interest in that. And then for a few years at university, I did a lot of stuff on the side for music, for bands’ websites and stuff like that.

Elliot: And then when I graduated from university, I got a job working for the record label, EMI working on a bunch of music sites. So, that was kind of how that all came about, really. I was working a lot of web stuff. It was all very music related and it sort of just happened, I guess, a little bit by accident and gradually over the years, I kind of... I don’t think I’m a web designer anymore.

Elliot: I kind of realized recently that’s in the past that I’ve sort of gone on to do other things. But everything kind of came from there and there’s been a really strong, I suppose, musical current throughout the whole thing and lots of side projects.

Elliot: And this is also what I’m going to be talking about at Smashing Conf as well, in fact. This whole thing and how it’s all interrelated and how a lot of side projects have led to, as I said, these kind of happy accidents, doing stuff that’s really fun just by sort of trying it out and not having too much of a plan.

Vitaly: No, it’s interesting because every time I think about my childhood and how things used to be when I was growing up, I always think about these important people who kind of defined my career, my view on things. I don’t know, but I always, I mean especially over the last couple of weeks now, I’ve been for some reason thinking about the blog post by Mark Bolton and the blog that you were writing.

Vitaly: And this was a very exciting time for me. I mean, you have no idea just how I just really felt that this is it, this is really changing my life. I kind of had this feeling in my head when I was kind of working through this and in my heart as well. So maybe just kind of throwing this question at you, maybe you could talk about people who really defined your way of thinking about design?

Vitaly: Like what really made the most significant impact. Was it maybe a talk somewhere? Maybe it’s an article that you read, a book? I don’t know, just a random coincidence where you just met somebody and they said something? What was that really kind of defined your work in many ways?

Elliot: Yeah, oh, wow. I remember those years as well. That felt really fun and everything on the web was new and we were all sort of just figuring it out and it was kind of the wild west of the web design days. I loved it.

Elliot: But yeah, I guess from my own perspective, I’ve definitely been, in the early days, I was really influenced by a lot of those people doing some really cutting edge Flash websites. So this is probably around 2001, 2002, 2003, I guess, to advanced PreyStation, tokyoplastic, My Pet Skeleton.

Vitaly: Oh, those were the times.

Elliot: Yeah. The real heady days of Flash-based web design. And they were very influential on me, not just for the web, but they just, like you said, something you felt in your heart, it’s just this exciting, "Wow, this is this just amazing stuff going on. It’s not just the web, but about design in general and creativity in general." And that really, really was just a very exciting time, and that kind of influenced me a lot in those early years.

Elliot: I think that whole kind of grungy style and that very kind of David Carson influence thing. I don’t think I realized until later that it was a lot of David Carson influence on that lot. You know, people like JUXT Interactive who I loved at the time and kind of looking back now, it’s a very David Carson kind of thing. But that was very influential on me.

Elliot: And then I got into, when I was working in the music industry and I was working at EMI, we started to move away from Flash and web standards was becoming a thing. And obviously like Zeldman’s writing and Eric Meyer and Dave Shay was doing the CSS Zen Garden. And then that again was like this really exciting, like, "Oh, wow, what is this whole new way of exploring the web and building on the web and designing on the web and working within these new constraints?"

Elliot: And I think aesthetically, I went away from that kind of outlandish grungy stuff. Well, I mean, eventually I did, to more kind of like clean and eventually my focus on typography and things like that. And I think it was probably, I mean, Erik Spiekermann obviously is a hugely influential person anyway. And his kind of... I think sort of knowing Erik and getting to know him through projects like 8 Faces and things like that, his influence on the real minutiae of typographic design, the real specific geeky details, that kind of led me down that path into less focused on, I guess, some of the big, "How do you design something from scratch?" But more into like, how do we really tweak and refine this very small part of a design to be the best it can possibly be?

Elliot: And I think almost like Erik is kind of at the opposite end to the David Carson side of design. But I think in sort of recent years, I’ve gone a bit more in that direction. And as you get older, I think your interest change. And for a long time, I was very, I don’t know, I guess really distrustful of people who were kind of involved in design, but didn’t want to do the whole thing.

Elliot: And I was really distrustful of people who were kind of like directors, but they weren’t necessarily at the coalface doing the design work. Whereas now I’ve sort of come round to being okay with just focusing on one part of it and letting other people kind of get concerned with design systems, and developing things.

Elliot: And I don’t know, web design is such a different beast these days anyway, I think.

Vitaly: Yeah, I don’t know. Is it just me, Elliot? But I feel like every time somebody brings up a notion of web designs, isn’t it like a term from 2000 somehow? Or 2010 or something, web design? Like we’re just UX designs. We are UX engineers. We are... I don’t know. There are so many old kind of different roles. What role do you see yourself now? Who are you today? Like if you had to define your role, like something that really, I don’t know, a term that really defines and captures your essence, what would that be?

Vitaly: I don’t know, if it’s a good answer, question to answer.

Elliot: It’s a great question to answer. And one, I’m constantly asking myself. Yeah, I don’t know. At the moment I am sort of describing, well, I’m not really actively describing myself, but I suppose the work that I’ve done recently and I’m doing at the moment is more of, I guess I’m sort of a ... Oh boy, I don’t know. I guess it’s like a typographic consultant, I suppose, in that I’m doing a lot of work that is very... I mean, all design is and should be typography focused in many ways, but it is very focused on typography with... I’m doing very little in terms of like hands-on design these days, but it’s more kind of helping steer something from a typographic perspective, and advising people on that.

Elliot: And the work that I’ve been doing with Google is all about sort of education around typography in general.

Elliot: But prior to this, I was doing a lot of creative director roles. So I sort of stopped being a designer in the more traditional sense and was more just a creative director. Sort of from my time when I was a Typekit. And then the roles that I then had after that, they were all kind of creative director roles.

Elliot: But and again, fairly recently when the pandemic kind of hit and I lost the job that I was currently working in at the time as creative director for an agency in London called Maido, Everyone kind of, that sort of had to disband, and I found myself doing some... Sort of going back to, well 2020 was a really weird year and everyone had to kind of go and do these different, sort of take on different kind of work to make ends meet and everything.

Elliot: And then after that, I think I realized that I didn’t really want to go back into that design leadership thing for a while. I think I’d got a little bit jaded by just sort of... It’s not that I wanted to be at the coalface, designing everything and building everything again, but I also wanted to do something that was a little bit more, I guess, kind of insular and kind of self-contained. And not involving big teams and stuff like that.

Elliot: And yeah, that’s kind of led me even further away from web design in a way, which has been nice. For a while, I was having this real existential crisis of trying to answer that question of who am I, what am I doing? And I think-

Vitaly: But I think we have pretty good understanding now, do we?

Elliot: Yeah. I think now I’m comfortable with where I am at for now. Ask me tomorrow, I’ll change my mind.

Vitaly: Okay. I will definitely ask tomorrow as well. But now actually and it interesting looking back with, because you had all the different roles and you worked with all the different people and we just briefly talked about some influential people and who changed your view on things. And in my life it was you. You don’t even remember, I’m sure. I think you don’t even remember.

Elliot: That’s very kind of you.

Vitaly: I remember us. Yeah, I will explain in a moment why. Because when we were working on some project, who knows what project that was over the last, I don’t know, 11, 12 years now, 15, maybe. I remember you saying one thing. I think it was a navigation design that we changed in Smashing of 2013, ’14 something.

Vitaly: And you said, "Well, if something is different, you need to make it look very different. It can’t be just close enough or a little bit different. It has to be bold and decisive and different enough, so people can notice that this is a decision and not a mistake."

Vitaly: Right. And I remember this, we were there. I mean, this has stuck with me for quite some time and actually many things that you’re mentioning about paying attention to details and being very careful and all those things, they kind of define my kind of way of working as well.

Vitaly: But I didn’t spend a lot of time working with different agents in all the different roles. Basically I have for last, what 12 years, I’ve been in the same, more or less the same position. But looking at you now, because you’ve been working with all the different teams and all the different people, is there something that you would recommend to yourself when you’re working with them?

Vitaly: Maybe do some... A little bit more of that. Do a little bit less of this in your career, as you kind of keep the ball and keep rolling. Is there something that you wish you would have done differently?

Elliot: Mm yeah. Well, first of all, thank you for saying that’s, that’s really awesome to know that that was influential and helpful. And yeah, I don’t quite remember that, but that is awesome. And that must have been when we were doing the Smashing redesign, which was-

Vitaly: Yeah, I think so.

Elliot: Yeah. A while ago now.

Vitaly: Like six, seven, eight years ago now.

Elliot: Yeah. Wow. Yeah. In terms of the sort of career advice, things I wish I’d known when I was younger, stuff like that, I think learning to trust your gut is super important. And there were definitely times when I look back on projects that I said yes to that maybe I’d already got that gut feeling that they might not be great and perhaps I shouldn’t have taken them on. And I did anyway.

Elliot: And I think listening to your gut, if you’ve got a feeling that says, "I shouldn’t be doing this," for whatever reason, then there’s probably a valid reason for why you’re feeling that way. I’ve got a print that Erik did that I bought from his print shop P98A and it says, "Don’t work with assholes, don’t work for assholes." Or maybe the other way round. But the meaning is the same.

Elliot: And that again is like I think sometimes you can tell quite early on how someone is going to be, and it’s useful to not persevere with projects that are perhaps run by or with assholes. So I wish that I had had that framed on my wall earlier on in my career. It’s on my wall now, but it perhaps should have been a mantra that was adopted sooner.

Elliot: But I think one of the things that I’m very grateful for is, that I’ve been in the position where I’ve been able to pursue things that I really care about. And although passion is this thing that’s kind of, this term that everyone says, it’s bandied about the whole time.

Elliot: I think it’s really important. And I’ve always thought it’s important, to really care about what you’re doing. And the reality is that we are at work for most of the day, most of the hours that we are awake in the day. And so we should be spending those hours doing something we love.

Elliot: Now, that’s all well and good. You know, that’s not necessarily helpful advice to give to somebody who may be stuck in a job that they absolutely need to stay in to pay the bills.

Elliot: But I think it’s not necessarily about just going, "Right. I’m going to quit my job and going pursue my dreams." It’s about sort of finding meaning in what you’re doing. And if there isn’t a direct way to do that in your day job, then I think side projects have always been a great outlet for that.

Elliot: And for me personally, being able to, I guess, seek creative fulfillment through side projects has led me to pursue those passions almost, as I said before, by accident. It’s the side projects and just sort of going for them and not worrying too much about the consequences that have, later on, led to the really good work.

Elliot: So even if you can’t leave your current job now that you might hate because you want to pursue your passions, I think finding a way to work your passions into it somehow, or to express yourself through a side project will help you eventually get involved with projects that you do really care about. And I’ve certainly been fortunate enough that that’s been the case.

Elliot: And some of the jobs I’ve had have been direct results of the work that I’ve done on side projects. And then those jobs in themselves have led to further things. And there’s always been kind of that snowball effect. And so I mean, it’s hard to, I think when you’re younger and you’re starting out, it’s hard to necessarily... There’s on the one hand, that you can be sort of like full of this youthful naivety and kind of go, "Yeah, let’s go for it and do whatever," but that can also lead to some not great situations.

Elliot: But definitely looking back, being slightly older and having done this for a while now, I can definitely say that the times where things really worked or where I was really happy were because I sort of just followed what I was interested in, rather than what was the kind of sensible perceived route that I should take.

Vitaly: Yeah. I think it’s, for me personally, it’s really a matter of being strategic and there are so many things I wish I had known earlier and not solely related to design or UX or web or topography or anything. But it’s just, sometimes you might even think about just very routine, basic life stuff. Right?

Vitaly: I mean, you know me, but I’ve been exploring the world of cutting cucumbers and watermelons for, I don’t know how many months and years now, and I still haven’t found the right way. And I’m always disappointed with my outcome. The same goes for coffee and for so many other things, which could be just small things that would be really, really enjoyable. Right?

Vitaly: And so, for example, one thing that I really wish I would know a bit more about is just how to do basic simple accounting. How to estimate better, how to deliver on time, how to get a bit more disciplined and things. Because these are all the things that I had to learn over time.

Vitaly: But, oh, my. I’ve been overestimating, underestimating, going wild and just literally guess working all the way. Do you have sort of a structure, system? How do you work? Are you one of those people who are very like, Paul Maduro and 45 minutes and then this. The alarm goes on and off I go making a break. Or how do you work?

Elliot: Yeah, no, I’m definitely not one of those people. I really struggle, to be honest, I have.

Vitaly: Oh, by the way, not to say that we have anything against these people. They’re very kind, they very productive. Don’t mean to be kind of disapproving in any way, just looking about different ways of how we all work today.

Elliot: Yeah. I have, so somewhat, I guess, it’s a little bit of a contradiction, but I try and set up a relatively focused schedule because I’m very easily distracted. So someone might look at my calendar or my approach to productivity and perhaps think that I’m quite well organized. And I think it’s, I’m not. This is why I’m using these things to try and and focus myself.

Elliot: So a few years ago, Jessica Hische posted a thing about her calendar, that she’d blocked out part parts of the day to kind of be productive. And it was really interesting. And I think I wrote a blog post, where I sort of had my own take on it. Although, I’ve since kind of changed that.

Elliot: But still the idea is basically blocking out time on your calendar to say, "This is productivity time. This is client work time. This is freelance project time, or this is family time, whatever." That sort of helps. That part of that structure’s been forced on me in a good way by having a family.

Elliot: So I have two young kids now and I always stop at five o’clock to go and have dinner with them. And I usually pick up some work stuff later on in the evening, even if it’s just kind of messages and stuff like that. But I have a pretty rigid stop time, which is, which is really nice because it means that I get some time with my family.

Elliot: And it also just forces a bit of a structure on my day. Plus I have things like school pickups and clubs that the kids do. And lunch and very specific things that aren’t that movable these days, which is good, which is really good.

Elliot: But I’ve also recently, I think to try and combat the fact that I’m quite easily distracted and just go down different rabbit holes, I’ve started moving to a paper based to-do list. So I still use things which I love as an app for that. And I use Notion for all kinds of general to-dos. But for my every single day, I write down on a little card, all of my tasks.

Elliot: So I was influenced by Jeff Sheldon and his project, I think it’s called Analog, where he did a nice kickstart with these beautifully designed a little cards. And he had a little system going for the priorities in his card and a nice little case for it, and all this kind of thing. I wanted to sort of take that, but make a much more low-fi version.

Elliot: So I made this system called Today And Soon, although I’ve since kind of changed it to just be focused on Today’s, which is basically I made a little template, a Moo card template that you can just download for free and get it printed. And it’s a series of tick boxes and there’s something about writing it down.

Elliot: You know, I’ve got my where you can’t see this. I can show you, but you won’t be able to hear this. And this is written down. And it’s some basic stuff that I want to do every day. You know, I want to Duolingo every day, and I’ve got to call this person today and I’ve got to finish this particular bit of work and all this kind of stuff.

Elliot: But just having it written down and like literally sat there next to my iMac, like balancing against my monitor there. And I get to do a big check mark with a big Sharpie every time I finish something, big or small, has really helped recently. Really helped with just keeping me focused. And I have stuff on there that’s like a big work task or it’s buy new flea medication for the dog or something.

Elliot: But the sense of being productive by checking those things off the list is really nice. And so that coupled with a fairly rigid calendar and time kind of blocked off, has really helped my productivity. And I think that’s kind of, I suppose that’s kind of how I work.

Elliot: But it’s still, my work day-to-day is a lot of like flitting between different things. It’s like some time in Figma working on some illustrations for Google Fonts Knowledge. And it’s time in Google Docs writing or editing, and it’s time in Notion doing some planning and it’s time on social media stuff, doing bits for my music project.

Elliot: And it’s a little bit, and time in chat talking to colleagues and planning stuff and meetings and whatnot. And it’s quite varied. And I think that variation can easily lead to distraction, but also I do quite like having things varied. I’ve realized over time that I’m not very good at just staying and doing one thing. I can’t sort of sit down there at nine o’clock and design all day and then finish at five.

Elliot: Like that’s never really been me and I’ve certainly failed when I’ve tried to do that.

Vitaly: Yeah. So I think it’s interesting because for me, sometimes I feel like we are maybe twins from different universes or something like that, I don’t even know. Because I mean, I have moved my calendar quite a bit and I actually, I think my partner in late December, just planning ahead for the next year. We were sitting down, we just really thinking about what was the year like, and what’s the next year it’s going to be like? And of course it’s a very common thing, and some people would say, "Well, everybody’s doing that or whatever," but it was really critical because I really had to kind of question everything.

Vitaly: That’s really been on my agenda for the last couple of months now. I just, it’s impossible for me to read a book. I’m questioning every single sentence in the book, now. It’s just really, really hard and it really changed because then I totally revamped my calendar.

Vitaly: And so I block out Fridays altogether, and there are dedicated times for meetings. And that’s it. And this kind of structure thing again, is probably something that gives you sort of, I don’t know, comfortable framework to work within?

Elliot: Yeah.

Vitaly: Right. So you just know that, okay, you’re going to do this and you have limitations in terms of the amount of time you will spend on this, because this is going to be a cutoff at five o’clock or six o’clock.

Vitaly: So I can totally see how kind of how it all comes together, how it’s all working for you as well.

Vitaly: Are there any things that you just let go? This was actually quite important for me as well, because I’ve been working with a couple of projects and we had to think about not the design strategy, but the deleting strategy or archiving strategy-

Elliot: Oh yeah. Interesting.

Vitaly: ... for very old and outdated content. So what are some things that you just recently let go or just stopped doing and that helped you as well?

Elliot: Yeah, that’s a really good question because I think it is so important to say no. And I remember doing talks a few years ago when I was kind of talking about freelance life and stuff like that, and talking a lot about being confident in saying no to clients and turning away work that you didn’t agree with and stuff like that. In terms recently, I guess it’s been sort of juggling stuff.

Elliot: I’ve, for a long time, had the opportunity to do maybe like a little bit of freelance work on the side and stuff like that. And I’ve recently with Google Fonts Knowledge and stuff, just settled into doing kind of one fixed kind of solid thing all day. Just working on Google Fonts Knowledge pretty much. And that’s been really nice to do.

Elliot: That said, I mean, I still have my music projects and a lot of admin around running the label and stuff like that. So that still happens in the evenings and things like that. And as I said, there’s bit of like social media posts and stuff like that. So my mind is still bouncing around these different things, but I’ve definitely turned down a lot of freelance projects that have come my way, just because it’s... I know that it’d be so easy to fill the hours doing that stuff.

Elliot: And I’m personally not very good at sitting there and just relaxing. Like I have this often detrimental need to be creating or making something. And I don’t really, I’m not great at playing video games and stuff because I feel like, "Oh, I should be making some music or taking a thing on or doing more work or whatever."

Elliot: Like I said, having kids has definitely helped in that my time with them is my time with them. And that’s really nice because nothing really eats into that, apart from the very occasional meeting or something like that. But on the whole, it’s dedicated.

Elliot: But yeah, I think there’s nothing recently apart from just saying no to some other freelance projects coming in. But I should do more sitting down and relaxing and just being okay with not doing much.

Vitaly: I think everybody’s saying that. And then nobody really does. I think personally I find it so difficult to just sit and do nothing. It’s just so, I mean, maybe I’m just impatient and I always have these questions raising up. These question marks coming up in my head. It’s sometimes it’s just difficult to fall asleep because I think, "Oh, I have this idea for that thing and I should be following this and I should be writing it down and I should not be writing this down, but then maybe I want to write it down." Kind of this ongoing story.

Elliot: Yeah, yeah.

Vitaly: But I mean, you’re adventurous, you’re just exploring and it’s just... I know that we’ll be kind of wrapping up shortly, but I do want to just find out how do you end up becoming or getting, kind of embarking on this journey from music on a new level? Because I know that for a while you have not been on that journey, you’ve been doing a lot of design and maybe I’m wrong. Please, correct me if I’m wrong.

Vitaly: But it’s only recently that we had this conversation, a few potentially on DJing at Smashing Conferences as well. And that’s something I wouldn’t imagine, like I say, 10 years ago when I saw you speaking on stage.

Vitaly: So you really fell deeply in love with electronic music again and now having your own label and all. And can you tell us just briefly that story? It’s like, why and how, and just how it happened and also where it goes?

Elliot: Yeah, sure. I mean, so I have actually been doing music for many, many years, in a very non-serious way. So I sort of started releasing some of my own music when I was in that year off that I mentioned before university. So I was like 18, and I released self-released a couple of EPs after that, but I was never really serious about it.

Elliot: And it wasn’t until, I think it was like 2015, something like that, 2014, 2015, where there were a couple of catalysts. One is that I’d kind of always liked some electronic music, but I was more into kind of rock and metal and stuff like that. And it wasn’t until then that I discovered some techno that for me, I thought, "Wow, this is really interesting music. This is people doing something that I haven’t really heard."

Elliot: And although it was kind of dance music, it’s not just about dancing. There’s just way more to it than that. And it was really interesting to me. There were a few different artists doing some cool stuff around this time, Monique and Shifted and KiloWatt and Manny D and some people that I just come across. And I found their music genuinely really interesting as a listener.

Elliot: But it spurred me on to kind of say, "Oh, maybe I could do some stuff like this." And then at exactly the same time I bought some hardware synths from... You can see them, they’re in the background there, these Volcas from, from Korg. And they’re really cheap. They’re analog synths, but they a really, really cheap, really dirty, and they’re just really fun to play with.

Elliot: And as soon as I was playing with them and like tweaking, turning knobs and moving sliders and just playing with the hardware and all those kind of happy accidents, again, that come with playing around with stuff like that. And coupled with the influence of these new artists, I thought, "Wow, this is really interesting. Maybe I could make this kind of thing."

Elliot: And it just sort of, I suppose, made me start taking it a little bit more seriously. And there was one other catalyst. So in 2015, we had our first daughter and sort of from then, my time to be productive musically, but in general has definitely been very limited.

Elliot: And ironically that’s the time when I spent the most kind of going, "Right, I have to do this thing, I have to be serious about music now." But I really do think that having that limited time to do this in, whereas before where the world is your oyster, you can spend all the time in the world, having a tiny window in which to be productive has actually helped me focus.

Elliot: Again, that was sort of happened to me rather than anything that... I didn’t kind of like plan for that level of productivity, but that really did help.

Elliot: And so I released my first EP as other form in 2017 and since, and even then I did it and then I kind of went quiet for a bit, but around 2019, things started to pick up again. Started to be making a lot more music, put something else out on a different label. And then I played a gig in Berlin at the end of 2019 and was like, "Hey, this is the start of playing live in like some clubs around the world and stuff."

Elliot: And then of course, we all know how 2020 went, but during that time, during the pandemic and everything, I really kind of doubled down on getting music out and growing the label and releasing other people’s music not just my own stuff. And it’s been just a whole other adventure, as you say. Just kind of working out that side of things and I love it.

Elliot: It’s very different to design. I don’t think there are many parallels, really. There are certain organizational things that have helped. I mean, I kind of run my design life and my music life on Notion, for instance. But in terms of like their creativity and the kind of label admin stuff, I think it’s very different to my kind of day jobby stuff, and also takes up quite a lot of time. But it’s all fun.

Elliot: As soon as it stops being fun, I’m going to stop doing it.

Vitaly: Yeah. Well, I think that it’s incredible to see this energy in your eyes when I can see it now.

Elliot: Thank you.

Vitaly: And it’s wonderful to see you really kind of shining through, and maybe who knows maybe in a couple of months or so, we’ll see you all over the world. And I know that you will be in some parts of the world, that will be San Francisco.

Elliot: That’s right.

Vitaly: For the smashing conference. So that might be the time when we should be expecting your live performance, as well. What is a snippet of it, right?

Elliot: Maybe, maybe.

Vitaly: Well, maybe we’ll see about that. Well, if you, dear listener would like to hear more from Elliott. You can find him on Twitter where he’s well, what a big surprise, Elliot @elliotjaystocks, and also on his website, which is also a big surprise, elliotjaystocks.com. So you can always follow along and see what Elliot has to say, and also what he’s working on.

Vitaly: Well, thank you so much today for joining us, Elliot. Do you have any parting words of wisdom with the wonderful peoples listening to us today?

Elliot: No, I don’t have any parting words of wisdom. I hope you didn’t come here expecting wisdom.

Vitaly: Well, that counts for something, right? Well, thank you so much, Elliot and I’m very much looking forward to seeing you in San Francisco.

Elliot: You too. Thank you for having me, Vitaly.

Smashing Podcast Episode 44 With Chris Ferdinandi: Is The Web Dead?

In this episode, we’re asking if changes to best practises over the last year have negatively impacted the web. Is it all downhill from here? Drew McLellan talks to expert Chris Ferdinandi to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s the author of the Vanilla JavaScript Pocket Guide series, creator of the Vanilla JavaScript Academy Training Program and host of the Vanilla JavaScript Podcast. We last talked to him in July 2020, where we asked if modern best practices about for the web. So we know he’s still an expert in Vanilla JS, but did you know he’s solely responsible for New Zealand being missing from 50% of world maps? My smashing friends, please welcome back, Chris Ferdinandi. Hi Chris, how are you?

Chris Ferdinandi: Oh, I’m smashing. Thanks for having me Drew. Interesting thing. I actually make sure New Zealand is not on maps because it’s probably my favorite country in the whole world and I don’t want too many people to know about it.

Drew: You want it to remain unspoiled.

Chris: Indeed.

Drew: So welcome back to the podcast. Last time we talked, we posed this question of if modern best practices, the use of reactive frameworks and these sorts of things were actually bad for the progress of the web. And I don’t know whether it was a controversial episode or it just struck a chord with a lot of listeners, but that conversation has been one of the most shared and listened to episodes that we’ve put out that smashing.

Chris: Oh, that’s awesome.

Drew: It’s actually been more than a year now, 15 months since we recorded that, which at the pace the web moves is like literally forever. So I wanted to ask, has anything changed? Is the web still in a terminal decline? Has the needle shifted at all?

Chris: Yeah, quite a bit has changed quite a bit has not. So I think, it’s so weird. The web technology changes so fast, but the web itself tends to move a little bit slower just in terms of developer trends and habits. And so you see these slightly longer arcs where you’ll have a bunch of technology pile up around one approach and then it’ll slowly start to swing the other way and then change all at once. And so last time we talked, I think one of the big kind of... Well, I had two big points related to the modern web. The first was, we’re using a lot of tools that give developers convenience, but we’re using those tools at the expense of the user. So we’re throwing a ton of client-side JS at people, and that introduces a ton of agility and performance issues.

Chris: The other big point that I was really hammering on was that these tools don’t necessarily improve the developer experience as much as I think people think they do. They do for some people. And I think for another segment of the front end professionals it actually can make things a little bit worse. But what I’m starting to see happen now, and one of the things I’d love to dig into a little bit more is I think we’re seeing a new, it’s almost like a second generation of tools that take a lot of the developer benefits that these client-side frameworks bring and strip away the punishing effects that we put on our users as a result. So it’s taking those same concepts and tools and packaging them a little bit differently in a way that’s actually better for the front end.

Chris: So one of the things I’ve been talking about with people lately is this idea that modern development has broken the web, but it’s also starting to fix it. And so we can definitely dig into that in a bunch of different angles, depending on where you want to take this conversation.

Drew: Sure. What sort of things have you seen in the last year that really stand out from that point of view?

Chris: Yeah, so the two biggest trends I’ve noticed are the rise of microframeworks. So where we saw a lot of really big all encompassing libraries for a while React, Vue before that angular, which is just a massive beast at this point, we’ve started to see smaller libraries that do the same thing come into their own. So for example, I think the king of this hill is probably Preact, which is a three kilobyte alternative to React that uses the same API, ships way less code and actually runs orders of magnitude faster on safe updates than React does too. So you’ve got things like that.

Chris: For a while you had... Well, it’s still out there, but Alpine JS, which was inspired by VJS and then actually inspired Evan You who built Vue to release Petite Vue, which is a 5.5 kilobyte subset of Vue that’s optimized around progressive enhancement. So these are still client-side libraries, but the intent behind them is that they ship less code, include fewer abstractions and ultimately work faster and put less of that cost on the front end user. So that’s been one angle.

Chris: And then the second trend I’ve seen that I think is personally more compelling is a shift from libraries to compilers. And so the one that kicked this whole trend off was felt by Rich Harris, which takes the idea of state based reactivity. But instead of having this be a thing that runs in real time in the client, you author your code with the same general pattern that you might with React or Vue, and then you run a build tool that compiles all that into plain old HTML and vanilla JavaScript, and that’s what gets shipped to the browser. And so you’ve stripped out almost all of the abstractions in the client and you deliver something that’s way closer to what you might hand write with old school DOM manipulation, but with the developer convenience of state based EI. So that was really interesting.

Chris: More recently there’s a new tool called ASTRO that builds on what Rich did with Svelt, and also allows you to pull in components from your favorite libraries so you can mix and match Vue, React, FELT, Vanilla, JavaScript, all in one package, compile it all out into Vanilla JavaScript and ship orders of magnitude, less code without the abstractions. And so it would run way faster in the browser as well. And those are, I think for me, really the two big things that are like standing on the shoulders of giants and producing a front end that will hopefully start to be a little bit faster. The compilers in particular are interesting because they take us away from rendering HTML in the browser as much as possible. You still render your HTML or you still author it with JavaScript if you want, but the outputted result is more static HTML and less JavaScript, which is always a good thing.

Drew: Do you think this is the ecosystem’s response to this quiet developer dissatisfaction about the weight of modern frameworks? Is it just a natural heave and ho?

Chris: Yeah, it is. Although to be honest, I’m not entirely sure how much of this was driven by... Well, there’s some definitely some performance minded developers out there who have been very vocal about how these tools are bad for the user. I don’t know that that’s necessarily representative of the general population though. I mean, certainly a subset of it given how the last time we talked that episode did, but I think one of the things that none of these tools for me get at is... Or the thing that I’m most bothered by by the modern web that I don’t think these tools address is that I personally feel like just the development process in general is over complicated.

Chris: This is where I get into the whole like, I don’t think the developer experience is actually better with these tools, but I think for a lot of developers in maybe a team environment, it can be. For me as a largely solo developer, I find these tools more trouble than they’re worth, but I know a lot of folks disagree with me there, so I don’t want to dismiss that as invalid. If you find these tools useful great, but yeah, I think this is maybe a natural pendulum swing back in the other direction.

Chris: The third thing that I didn’t talk about that your question actually makes me think about though is, there is almost a natural cycle in the web where you start to throw a lot of JavaScript at solving problems as the web and the capabilities of it grow. And eventually those JavaScript libraries get absorbed by the platform itself, but it’s a much slower process than creating a new JavaScript library is, because it’s standard processes and how important those are. So we saw the same thing happen with jQuery, right, where the amount of JavaScript being used on the web swelled with jQuery and jQuery plugins.

Chris: And then eventually the web platform realized that these ways of doing things are really smart and we started to get native ways to do it. And then there was this really long, slow petering off of the shift away from jQuery. So I think these libraries, as much as they’ve done a lot of... That’ll be a little controversial here and say, they’ve done a lot of damage to the web. They’ve also served an important function in paving cow path for what native APIs could look like it could do. So I don’t want to completely dismiss them as terrible.

Drew: It’s interesting that you mentioned ASTRO just a little bit earlier. I’ve actually recorded an interview with Matthew Phillips. I’m not sure if it goes out before or after this one. He’s one of the core developers on ASTRO. And it certainly is a very creative and an interesting approach to the problem. I do wonder as you saying how much this is. We’ve created a set of problems for ourselves and so now we’ve created a new solution, which patches over those problems and gives us something even better. But are we just stacking the bricks on top of each other and still ending up with a very wobbly tower because of it? Are we just going down the wrong path?

Chris: It depends. So I, as the hair on my head has started to disappear and my beard has gotten whiter, I’ve started to talk in fewer absolutes than I did. And so five years ago, I would’ve said, "Absolutely yes." I don’t want to diminish the value of these tools in a team environment. And the other thing, I honestly think a lot of libraries really have the potential to at least patch fix in the interim is accessibility problems with the web around complex UI components. So in short, if I were to give this just a one sentence, yes, I do think in many ways we’re creating a really delicate house of cards that collapses very easily. And I think one of the nicest things about using mostly or almost entirely platform native to build for the web, so just authoring an HTML, CSS and JavaScript is, you cannot touch that code for five years and come back to it and you don’t have any dependencies to update. You don’t have any build tools to run, to start working with it again. It just works. And that’s really great.

Chris: But I think the thing I see with libraries is a lot of them come into creation to fill gaps in what the platform can do. And what I’ve noticed happens is after the platform catches up, the libraries stick around for a really long time. And so the thing I always try to do is be a little bit deliberate about what I add to the things I build, because it’s really easy to add stuff and really hard to take it away once it’s there. And just, I think to ground these heady abstract concepts, I’m talking about for a sec, every year, web aim, Web Accessibility consultancy firm does a survey of the top million sites on the web. And they run an audit, just automated audits. They’re not doing a detailed inspection of all these sites. So just stuff that, simple like robot tasks and pickup. And historically, one of the things they’ve always found is that sites that use UI rendering libraries have more accessibility issues than sites that don’t.

Chris: This year they found the same trend with one exception. Sites that use React actually have fewer accessibility issues than sites that don’t. And that is a notable trend or noticeable departure, rather from the year before when React sites had more accessibility issues.

Chris: I noticed a lot of focus on accessibility in the React community over the last year, building more accessible components, accessible routing, things of that nature. And for complex components, things like tabs and disclosure widgets, and sliders and things like that, it is really hard to do those accessibly with just HTML and Vanilla JavaScript. Trying to keep track of which ARIA attributes you need to add on, which elements and how to change them based on different behaviors and how to shift focus and announce different things is really complex. And I think these libraries as much as they can be a very delicate house of cards, I see a huge potential there to fill these gaps. Where I’d ultimately love to end up though, is in a place where the platform, the web, browsers offer native components that do those things so that you don’t need the libraries. And I think the details and summary elements provide a really nice model for what that could look like.

Chris: So if you’re listening to this and you don’t know what those are, the details element is an HTML element that you wrap around some content, and then inside it you nest a summary element with like a little description of what’s in that content. And by default, this element will be a collapsed bit of content. And when you click on the stuff in the summary, it expands and then when you click it again, it collapses and it shows a little arrow when it’s open or closed to indicate what’s happening here. It’s accessible out of the box. If the browser doesn’t support it, it shows all the content by default. So it’s just automatically progressively enhanced. You don’t need to do anything special there.

Chris: It can be styled with CSS. You can even change what the icons that display when it’s expanded and collapsed are, just with CSS. You don’t need to write any JS for it, but if you wanted to extend the behavior in some way you can, because it also exposes a JavaScript event that fires whenever it’s toggled open or closed. And I would love to see more stuff like that for tabs, for image sliders or carousels or photo galleries, which just... We have so many different interactive components now on the web that may or may not always be appropriate, but they’re in the designs and people are building them and having a way to do those things where you didn’t have to fumble through how to make them accessible or lean on a 30 kilobyte library would be awesome.

Chris: And so for me, that’s, I think, the next evolution of the web. That’s where I really want to see things start to go. And I think that’s the big need that these libraries address today in addition to some other stuff like changing the UI based on state changes and interesting use cases like that.

Drew: Yeah. Modern browsers are just so capable now and they automatically update themselves and they include many of the features natively that we’ve previously relied on, on big frameworks and build tools for. Is the requirement of a build process to deploy a project a red flag in 2021? Should HTML and CSS and JS just be deployable as it is?

Chris: So technically they are. I don’t think for most build processes that’s real or for most apps or sites or companies that’s necessarily realistic today. I don’t know that I’d call it a red flag as much as a resigned I wish it wasn’t like this, but I understand why it is, for me. Even for myself, my site has several thousand pages on it now. I think I’m up to three or four thousand pages and there’s no way I am just hand coding all those. I use a static site generator and I think tools like that can be really great.

Chris: I think there’s some challenge there in that they become things that have to be kept updated and maintained. And so I like to keep mine as lean as possible, but I think build tools that put more of the run time on you, the developer, and thus allow you to ship less to the browser are a good thing, especially as the things we build become more complex. So I don’t know that I would necessarily say it’s just by default a red flag. I think a lot of it depends on how you’re using it. If you need to run a build to ship a one or two page marketing site or brochure site, yeah, that’s a red flag. But if you’re building some complex applications and these allow you to author in a way that’s more sensical for you and then ship less stuff to the browser, that’s not a bad thing. And that’s why I find tools like ASTRO really, really interesting because there is still a build step there, but it’s a build step in the service of providing a better end user experience.

Drew: Yes. It’s shifting all that computation onto the server to build time or pre deferred time and not on page request time.

Chris: Yeah. And so for me, I almost break build steps into... Like for me, the gold standard is if I can ship it without any build step at all, that’s awesome. But even for myself, the vanilla jazz guy, that’s not how I do things a hundred percent today. And so I think the next step up is compilers that reduce your code to as much HTML and plain old JavaScript as possible, versus those that create even more JavaScript, like the ones that take a bunch of little files and make an even bigger file. So more of the former, less of the latter if possible is always a good thing, but not always possible.

Drew: I think getting off the dependency treadmill, as it were, it’s got to be a big draw to a Vanilla JavaScript approach, not having a million dependencies to be updating all the time, but I guess one of the advantages to some of these bigger frameworks is that they sometimes dictate and sometimes facilitate a uniform way of working, which is really important with larger teams. Is there a danger of a project going a bit off the rails without those standards and procedures in place that a framework imposes?

Chris: Yes. Yeah. I think that’s fair. I used to downplay, I think, the significance of this for a while. And I think that is valid. That is a fair benefit of these tools. I think that maybe the small counter argument here is if you Google, "How to do X with React," you’re going to get half a dozen different approaches to doing that thing. So there are conventions, but there’s not necessarily hard and fast, like if you don’t do it this way, everything breaks kind of rules. One of the appeals of these tools is that they have a lot of flexibility. Certainly they do enforce more standard approaches though than just green fields, browser native things do. And so I think there’s maybe a bit of a balance, even if you don’t have a strong team lead who’s driving internal code standards.

Chris: I have seen even framework based projects go off the rails with hodgepodge approaches before. So it’s not like these tools automatically give you that, but they definitely give you some guidelines, maybe some rails that nudge you in the right direction. And I know some people need that. If that is something you need, this is where I really like that we’re seeing more of these smaller libraries that use the same conventions, like Petite Vue or Preact and compilers that also... Like FELT has some very rigid rails around it, certainly more so than you would see with ASTRO and so if you really need that, I think you have some options that don’t punish users for that need as much as what we had been doing a few years ago.

Drew: In the work that I do, we use Vue and the Vue single file components are a really compelling case for this in that we have engineers writing front-end code, who aren’t necessarily front-end specialists who say here’s a way to create a skeleton single file component. Your template goes here, your Java script goes here, your CSS goes here. And just naturally as a result of that, we end up with a very consistent code base, even though it’s been created by a very diverse set of people. And so the conventions like that can really have a big benefit to teams who aren’t necessarily all headed in the same direction because the engineering department’s so massive or whatever.

Chris: Yeah, for sure. Where I think you sometimes get into trouble with that... And I agree. I absolutely like the ability to make a code base look consistent with a bunch of different people working on it is really, really important because the people writing the code today are not necessarily going to be the ones maintaining it later. And that can get messy fast. The flip side is, if you are someone who is not comfortable or really well versed in JavaScript, a lot of the modern tool set is really geared towards JavaScript. And there are a lot of people on teams who specialize primarily in HTML or CSS or accessibility. And for them, JavaScript is not a core competency nor do I think it’s fair to expect it to be. And just like you don’t expect all your JavaScript developers to be experts in CSS.

Chris: And so it can make their job a lot harder. And this is for me, always that like that give and take with these tools is they can do some really awesome things, but they can also gate keep a lot of people out of the process. And I feel like that balance is different from team to team, but for me, one of the big arguments for leaning more on browser native stuff, or ditching as many of those dependencies as possible is that you open up your development process to a lot of people who are not as JavaScript heavy.

Drew: There’s always this undercurrent within the industry that suggests there’s the current way of doing things, the latest and there’s the outdated way. And if you’re not up to date with whatever the latest is, you’re somehow not as good an engineer or whatever.

Drew: In your estimation does taking a Vanilla JavaScript approach enable you to swim free of all that is Vanilla JS like an evergreen approach that stands apart from those techniques.

Chris: Yeah. Yeah. There’s a few threads in what you just mentioned, Drew. So one of them is, if you understand the fundamentals of the web, I have found that it’s a lot easier to like a bee, just bounce from different technology to different technology and understand it enough to like... Even if you don’t use it, look at it and be like, "Okay, I can see some benefits to this or not, and evaluate whether it’s the right choice." If you need to dive into a new technology based on client needs or shifting direction in the company, you can. I think it’s a lot harder to do that if you only know a library and you’ve only learned the web in the context of that library.

Chris: Now the caveat here is, I learned JavaScript in the context of jQuery and then backed my way into Vanilla JavaScript, and then moved on to a bunch of other things too. The more I think about how that process went for me though, I think I was able to do that as easily as I did in large part because by the time I made that jump, ES5 had come out and had taken a bunch of its conventions from jQuery. And so there was a lot of these real one for one map. Mental map things I could do. I don’t know if we’re quite there yet with some of the state based UI libraries, but we’re definitely headed in that direction and I think that’s great. But the other thing here, there is this real pressure, as you mentioned in the industry to always keep up to date with all these new technologies, in large part because people who develop these technologies and people who work at the big companies are the ones who get invited to speak at conferences and talk about all the cool things they’ve built.

Chris: But the reality is that a lot of our web, like I’d say a majority of our web, runs on boring old technology that hasn’t been updated in a while, or has been updated, but in just a patch fix process. A lot of really important applications run on Python or PHP, or as a backend with just some sprinkling of lightweight HTML, CSS, and JavaScript on top. jQuery is still used on a lot of important stuff to the exclusion of other libraries. And it doesn’t always feel like it because I feel like most job descriptions that you see talk about wanting experience in React or Vue or something these days. But my experience from working in bigger technology companies or older product companies, is that there are a lot of jobs to be found working on old stable technology. And a lot of times it’s not always the most exciting work, but a lot of times they’re jobs that pay well and have really great hours and a lot of work life balance in a way that you won’t get in a really exciting tech company working on the latest stuff.

Chris: And so there’s these trade offs there. It’s not always a bad thing. Yeah, I think it’s one of those, like the new, new, new thing is potentially a very vocal minority of the web that’s not representative of as the web as a whole.

Drew: And there seems to be along with this idea that you should be adopting everything new and immediately casting away everything that you’ve been using for the last 12 months. There’s also this idea that you should be engineering things that are enterprise grade of engineering, but you ought to be doing every small project the way that an enormous company with 400 engineers is building things. And those two ideas actually aren’t compatible at all. It’s the big companies with all these hundreds of engineers who are using the old crusty technology, because it’s reliable and they’ve got far too much momentum. They hate to be dropping it and picking up something new. So those two ideas are indirect conflict, I think.

Chris: Yeah. It’s funny. You always see the whole like, "Well, will it scale, will it scale," kind of thing all the time. And does it need to? Are you building things for a Facebook sized audience? I’m sure you’ll get there at... Well, you’ll get there, but it would be wonderful if you got there at some point, but like, if you’re not there today, maybe that’s not necessarily how you need to start out. Like those aren’t your needs today. You’re pre-engineering for a problem that you don’t have to the detriment of some problems that you do.

Chris: I think the other thing here is there’s this presumption that because Facebook or Google or Twitter do things, it’s a good idea, or it’s a good idea for everybody. And that’s not necessarily the case. Those companies do a lot of things right. But they also do a lot of things poorly and they do them that way because of engineering trade offs they’ve had to make because of how their teams are structured or very specific internal problems they had at the time that they made this decision or because some executive somewhere felt really strongly about something and made the internal team do it, even though it wasn’t necessarily best at the time. And then these things stick around. And so, yeah, I think one of the biggest things I see happen in our industry to our own detriment is looking at those few really big visible technology companies and thinking, "If they do it this way, I have to too," or "That’s the right call for everybody."

Chris: It’s that old, like no one got fired for hiring IBM kind of thing, but applied to if it’s good enough for Google or if it’s good enough for Twitter or whatever, so yeah. I agree. I think we do a lot of that and maybe that we shouldn’t.

Drew: I asked on Twitter earlier on that what frustrated people about modern web development best practices and from the responses I got, there’s certainly a lot of dissatisfaction with the current state of things. One trend, which over the last few years is getting momentum is like the Jamstack approach to building sites. And it seems on the surface that this going back to just client-side apps and nothing complex on the server, it sounds like it’s going back to basics, but is it doing that? Is it or is it just masking the complexity of the stack in a different way?

Chris: It depends. I’m a little biased here because I love the Jamstack personally, but I have also seen... Well, I shouldn’t say I have seen. I think what I’m trying to say here is the Jamstack is a term that can apply to a wide range of approaches up to and including a really large two megabyte of JavaScript single page app that has no server side rendering on one end. And then on the other end, flat HTML files that use absolutely no JavaScript at all, and instantly loading your browser and just happen to be shipped from a CDN or something like that. And technically speaking, both of those are Jamstack and are not the flat HTML thing. So Jamstack is not inherently better than server rendered, but in many cases it can be.

Chris: So for those of you who don’t know, Jamstack used to be an acronym that stood for JavaScript, APIs and markup, and they’ve since changed the spelling and changed the definition a little bit there. And it really encompasses an approach to building the web that doesn’t rely on server side rendering. So anything you’re serving, you’ve already compiled and put together and that’s what ships in the browser. And if there’s any other processing or scripting that happens, that happens in the client. Doesn’t have to, but often does. And so what I think is awesome about Jamstack if done a certain way, is it can dramatically improve the performance of the things that you’re building.

Chris: If you’re not just shipping like a metric ton of JavaScript to the client and having all the stuff that you used to do on the server happen in the browser instead, because the browser will always be less efficient at all that scripting than the server would be, but where this really comes to shine, and so I’ll use like WordPress as an example. I love WordPress. I built my career on WordPress. It’s the reason why I was able to become a developer, but every time someone visits a WordPress site out of the box, it has to make a call to a database, grabs some content, mash it into some templates, generate HTML and ship that back to the browser.

Chris: And there are some plugins you can use to do some of that ahead of time, but it is a very slow process, especially on a shared inexpensive web host. A Jamstack approach would be to have that HTML file already built, and you cut... You don’t cut the server out, but you cut all of that server processing completely out. So the HTML file already exists and gets shipped. And in an ideal world, you would even push that out to a bunch of CDNs so it sits as close to the person accessing it as possible. And what that can do is take a load time from a couple of seconds on an inexpensive host to less than half a second, because of how little computing time it takes to actually just request a file, get the file back and load it, if it’s mostly HTML.

Chris: And so, yeah, I really like rambling in long winded response to your question, Drew, but I think the answer is, if you’re using it with something like a static site generator, it can be amazingly more performant than some of the other things we’ve done in the past. And it allows you to get that same WordPress experience where I’m authoring content and I have some templates and I don’t have to hardcode HTML, but the performance is way better on one end.

Chris: And then on the other end, you could theoretically define a React app as Jamstack as well and it can be really slow and buggy and terrible. And so it depends. The other thing I’m seeing happen that’s really, really funny and interesting is we just keep reinventing PHP over and over and over again as an industry in various ways. So-

Drew: We still have PHP as well. It’s not gone.

Chris: Right? And yet PHP still exists and still works great. And so we’ve got... Like I remember when Next.js came out. There was all these kind of, "And here’s all the things you can do with it." And I was like, "Oh, that’s like PHP," but a decade later. And then my friend Zach Leatherman who built Eleventy which is an amazing static site generator has been experimenting with some compiling in real time on the server stuff with Eleventy.

Chris: So it’s like just in time Jamstack and he even jokes that he’s essentially recreated PHP in node and JavaScript, but it’s slightly different because there’s like a serverless build that happens that then instant deploys it to a CDN and it’s like a little weird. So it’s still a house of cards. You’re just shifting around where those cards live and who’s responsible for them, but yeah, yeah. Jamstack is cool. Jamstack is problematic. It’s also not. It’s awesome. It’s potentially overused both as a term and a technology. Yeah. It’s a whole lot of things and I love it in the same way that I love PHP. It’s great and it has problems and every technology and approach is a series of trade-offs.

Drew: Do you think we’re going through some industrial revolution in web development? What used to be skilled painstaking work from individual arts and is now high volume, high production factory output. All the machines have been brought in and the frameworks and the build tools and have we lost that hand rolled touch?

Chris: Well, I mean, yes, to an extent, but we don’t have to. I mean, that analogy is appropriate in many ways, because a lot of the ways we do things today produce... I like to call them front end pollution in the over-reliance on JavaScript, but also in the very literal sense. We have so many heavy build processes now that they generate more actual literal pollution as well. But I think the counter argument here is with a... I will use farming, right? You could go out and hand mill your wheat with a scyther. I forget what you call those. The crescent shaped tool that you use to chop your wheat, or you could use an oxen drawn machine that will pull that off, or you can use a big tractor.

Chris: And I think there’s a clear argument that at some point, factory farming is this big industrial complex that has lost a little bit of that close to the Earth touch, but I don’t think I necessarily need my farmers to be hand chopping their wheat. That is wildly inefficient for very little benefit. And there’s probably a balance there. And I feel the same thing with what we’re doing here. Some of these tools allow us to do more artisan work faster and more efficiently. And sometimes they just turn it into generating a bunch of garbage and turn it out as fast as possible. And there’s not necessarily a clear cut delineation for where that crossover happens. I think it’s a little fuzzy and gray and like a you know it when you see it kind of thing. Sometimes not always. But yeah, I think it’s a little bit of both. The commercialization of the web is both a really terrible thing and also a really great thing that has allowed folks like myself to have a living working on the platform that I love full time.

Chris: That’s awesome. But it’s also produced a lot of problems and I think that’s true for any technology. There’s good and bad that comes with all of it.

Drew: And maybe sometimes we’re just producing really fat pigs.

Chris: Yeah. I’ve gotten a lot more like, it depends as I’ve gotten older. This stuff used to really, really upset me from a purist standpoint. And I still really hate the fact that we’ve forced our users to endorse such a fragile and easily broken web. The web in general has gotten four to five times faster in the last decade. And the average website has only gotten a hundred milliseconds faster in terms of load time, because we just keep throwing more and more stuff at our users. And we could have a really fast resilient web right now if we wanted one, but we don’t. And part of that is a natural trade off for pushing the capabilities of the web further and further and that’s awesome, but I feel like sometimes we do things just because it’s shiny and new and not because it adds real benefit to folks. So I’d love to see a little bit more balance there.

Drew: Is part of the problem that we’re expecting the web to do too much? I mean, for many years we didn’t really have any great alternatives. So we enhanced and maybe over-stretched the high tech document system to behave like a software application. And now we’ve all got really powerful phones in our pockets, running a range of network connected apps. Is that the appropriate outlook for this functionality that we’re trying to build into websites? Should we just all be building apps for that case and leaving the document based stuff to be on the web?

Chris: I would argue the other direction. I think the bigger problem is... So maybe there are certain things for which I even personally I prefer like a native app over something in the web. But I think having the web do more frees you from app ecosystems and allows you as a team to build a thing and be able to reach more people with it, not have to download an app before you can access the thing you want. That’s a really cool thing. And I would argue that potentially the bigger problem is that browsers can’t keep up with the pace of the thing that we want the web to do. And that’s not a knock on the people behind the standards processes. I would not want to go back to every browser just does their own thing and the hell with it. That was awful to develop for.

Drew: It was, yeah.

Chris: We do have some of those similar problems though, just based on how the standards process works. So sometimes you’ll see Google get frustrated because they have so much in-house development power, get frustrated with other browsers that are part of that process not wanting to go along with something or not moving fast enough. And so they just... Leeroy Jenkins it and just run off and go do whatever they want to do. On the flip side you sometimes see Apple moving very, very slow because they don’t put as much investment into the web as they do other parts of their business, which is hopefully, maybe starting to change a little bit with some of the more recent hires they’ve made. But I think one of the things you run into is just the web tends to move a little slowly sometimes.

Chris: Technology moves fast, but the browsers themselves and the technologies they implement don’t always keep up. And so I don’t believe we demand too much of our browsers. I just think you get this natural ebb and flow where we demand a lot. We build a bunch of libraries to polyfill the things that we want and then when the browser eventually catches up, there’s this really slow, petering off as library usage for that particular stuff drops off.

Chris: Yeah. But I don’t know that I would say we demand too much of the web. Yeah, I don’t know. I actually, I love all the things the web can do. I think it’s really, for me, it’s what’s so exciting about the web. I think my frustration is more just with how slow some of these technologies are to come out, particularly on iOS devices. And I say this as someone who, I love my iPhone, but progressive web apps continue to be a second... They just don’t get as much priority as native apps do on that platform, which is disappointing.

Drew: So looking to the future on that note, what should we, as a development community be working on to fix some of these issues? Where should we be placing our efforts?

Chris: Yeah. So I think there are a few different things. And I think some of the tools we’ve talked about, I don’t think they’ll ever necessarily go away. They might change in form a little bit, but so I already see some cool things on the horizon. One of the things people love about single page apps that we’ve never been able to do with, I call them multistage apps, but they’re really just plain old webpages is like the nice transitions that happen between views where you might like fade in, fade out, or something like that.

Chris: There’s a native API in the works that’s going to make that a lot easier. That’s awesome. There’s also a native API in the works for HTML sanitization. So one of the big things that libraries do for you is they, when you’re rendering HTML from third party data, they have some libraries baked in that will help reduce your risk of cross-site scripting attacks.

Chris: There’s not really a good, just native way to do that, but there’s one in the works that will make that a lot easier. And even if you continue to use state based libraries, that should allow them to strip a bunch of code out and that would be an awesome thing.

Chris: One thing that the native web can’t do yet that would be really cool, is a way to handle DOM dipping so that if you want to build some HTML based on a JavaScript object and then update it as the object changes, it would be really cool if you didn’t have to rely on a library for that. And that there was maybe a performant out of the box way to do that in the browser. I think that would solve a lot of problems. As well as more accessible interactive components. I absolutely love when HTML and CSS can replace something I used to need JavaScript for. Doesn’t need to be as rigorously tested, way more fault tolerant, less likely to break, more performant all around. It’s a net win. And so I’d love to see more of those come to the platform.

Chris: So from a browser native thing there’s that. And then the other big thing I think we’re going to start to see more of is a shift away from client-side libraries and a shift to more pre-compiled stuff. Whether that’s static side generators, something like ASTRO that still uses JavaScript libraries, but pre renders them instead of making the browser do it. But those are the, I think, the big things I’m seeing start to happen and I think we’re going to see more and more of.

Drew: So you saying maybe it’s not all doom and gloom and perhaps we can fix this? There’s a way out?

Chris: No, yeah, I see us emerging from the dark ages slowly. And what I think is going to happen is we’re going to hit a point where much like where today people are like, "Why does everybody still use React?" I can imagine in 7 to 10 years time, we’re going to be like, "Why does anybody..." I’m sorry. Not React. jQuery. "Why does everybody still use jQuery?" We’re going to see the same thing with React and Vue. Like, "Why does everybody still start a project with those?" And there’s going to be some new libraries that are starting to emerge to solve a whole new set of problems that we haven’t even dreamed of today.

Drew: One comment from Twitter that I really identified with was from Amy Pellegrini, who said, "Every time I update something, everything gets broken." Yep. I just think we’ve all been there, haven’t we?

Chris: Yeah. I unfortunately don’t think that will ever fully go away because even in the non-build tool era of jQuery, we used to just load it with a script element. You would run into situations where different versions would be incompatible with each other. And so you’d drop a plug in into your site and it would be like, "Sorry, you’re running jQuery 1.83, and this requires 1.89 or higher because it added this new..." And so there’s always been some version of that. I think it’s a lot more pronounced now because so much of it happens in the command line and spits out all these terrible errors that don’t make sense. But yeah, that unfortunately I don’t think will ever go away. I feel the pain though. That one, it’s a big part of the reason why I try and use as few dependencies as possible.

Drew: Me too. Me too. So I’ve been learning all about the lean web or learning more about the lean web than our conversation. What have you been learning about lately, Chris?

Chris: Yeah. Great question. So I have been going deep on service workers in part because I love their ability to both make the web faster, or even if you’re not building a progressive web app, they’re just really, really cool. One of the things I’ve absolutely loved them for though is they allow me to build a single page app like experience in terms of performance, without all the complexity of having to handle JavaScript routing and stuff. So I can have a multipage app, cache my API calls for a short period of time without having to cache them in memory. And so I’ve been able to do some really cool things with them. And then the other thing I’ve been learning a lot about lately is serverless, which allows me to get the benefits of having some server-side code without having to actually manage a server, which is great.

Chris: And so I went really, really deep on those, put together a couple of courses on both of those topics as well, but they have benefited me immensely in my own work, in particular service workers, which has been amazing. I’m obsessed with them. Recommend them for everybody.

Drew: That’s amazing. And where can people find those courses that you put together on?

Chris: So if you go to vanillajsguides.com, you can dig into those and a whole bunch of other courses as well.

Drew: Amazing. If you dear listener would like to hear more from Chris, you can find his book on the web at leanweb.dev and his developer tips newsletter, which I believe now gets over 12,000 subscribers-

Chris: Yeah. Up a little bit from the last time we chatted.

Drew: Yeah. That’s at gomakethings.com. Chris is on twitter @chrisferdinandi. And you can check out his podcast at podcast.com or wherever you usually get your podcasts from. Thanks for joining us today, Chris. Do you have any parting words?

Chris: No, that was a really great summary, Drew. Thank you so much. You hit all the key links. So thanks so much for having me. This was great.

Smashing Podcast Episode 43 With Matthew Phillips: What Is Astro?

In this episode, we’re talking about Astro. Will this modern static site builder launch you into the stratosphere? Drew McLellan talks to developer Matthew Phillips to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s an engineer at Skypack and a major contributor to a new project called Astro, which aims to combine performance best practices with the developer experience improvements we see from component based approaches. So we know he knows all about Astro, but did you know he can fit 18 whole lemons in his mouth? My smashing friends, please welcome Matthew Phillips. Hi, Matthew, how are you?

Matthew Phillips: I’m smashing.

Drew: That’s good to hear. I wanted to talk to you today about Astro, but before we do, why don’t you tell us a little bit about your background and how you’ve got to where you are today?

Matthew: Yeah, well, I’ve been working on front-end web development for a long time, probably six or seven years. The previous company, I was one of the maintainers of canjs, front end framework. Worked on that full-time open source for about three years I think. Also did quite a bit of consulting, different large and small companies on front end. And so I have a lot of experience in the front end. I had a big interest in web components and wrote various libraries surrounding web components. One’s called Haunted, may have heard of that, some people might have,

Matthew: and Fred, who’s the owner of Skypack, who started Skypack and worked on the Snowpack project, I knew him because he worked for Google on the Polymer project, which is a web component project. So I knew him just through the industry and I was thinking about changing jobs, looking to reset a little bit and they were hiring. So I jumped aboard, very interested. And have also a big background in ES modules and just module loading in general and that’s what they were working on at the time. So it was just good fit and so I decided to join aboard.

Drew: So you’ve really got your teeth into the back of the back end side of things, is that a fair assessment?

Matthew: I think so. I’m not super up to data on all the terminology, but I think that’s right.

Drew: That sounds about right to me. So I’m hearing a lot of buzz about Astro and that it’s some sort of static site generator, but I think that that term possibly under sells what it’s doing. What exactly is Astro and what is the problem that it’s solving for us?

Matthew: Right. Yeah. I mean, Astro is a static site generator. It’s kind of hard to explain how Astro came about, but I don’t know if that’d be helpful to go there, but what Astro is in general is, it’s a stack site generator that allows you to use components in any framework that you’re familiar with, whether it be View or React, Svelte, anything really you can bring your own framework and have that workflow that a lot of people enjoy while still generating purely static HTML and CSS.

Drew: So instead of using something like Handlebars or one of those traditionally server side templating languages, you can use your own reactive framework, essentially React or View or Svelte or whatever to act as the templating system for your static site generator. Is that-

Matthew: Yeah, it’s kind of, if you’ve heard of 11ty, but it’s kind of a halfway between something like 11ty or a more traditional static site generator where you’re using some templating language that is built for basically string concatenation in something front end, more front end driven static site generator like Gatsby, for example, it’s kind of a halfway between there. We wanted the developer experience, component usage, component usage is very useful. It’s very useful to be able to compose things in small chunks and there’s not a great way to do that in the more traditional templating engines that exist.

Matthew: So people, I think, gravitate towards these component based frameworks just because they’re so composable and the appeal to it doesn’t necessarily, it’s not necessarily, "Hey, I want this thing to be interactive in the client always." It’s just, "I want to compose things in small parts." And so yeah, we’re kind of a halfway between that, but we still want to generate this ideal static content. And I think there’s a lot of people who, like I said, they gravitate towards the framework way of doing things, but they’re not super happy with what it actually produces because, I’m writing a blog or I’m writing a marketing page or something like that, I don’t need all this Java script, but I’m kind of used to it and it builds well.

Matthew: So, I guess that’s kind of the problem you’re trying to solve is, we love, as people with... We have a lot of people in our community and on the team with a background in, I guess you would say the front of the front end, and they really want this plain HTML and CSS output, so it’s a way to balance those two desires, I guess.

Drew: So I guess it would be great for teams who are maybe building some sort of product in React or View or what have you, and then it comes to their marketing site and their document and their blog and all those things that actually they want to be really well SEO optimized and really faster load and really low overhead and would be ideal as static HTML and CSS pages, but they could still use their normal workflows and all the tools they’re used to to develop those.

Matthew: Yeah. Those workflows, those are super important. I think a lot of people can be a little critical from the outside. Like, "Oh, why did you build this thing this way? Why did you use React or whatever to build this landing page?" But these are teams and they’re spending a lot of time building websites or building internal tools or whatever it is they’re building and it takes a lot of effort to like, "Oh, we’re going to switch to a totally different context and use Jekyll or something else," and you got to get people up to speed.

Matthew: So I think those workflows are really, really important. And I read articles all the time where this team’s like, "Oh yeah, we use React. So we built our marketing site in React too." And if we can allow people to still use those normal workflows, but produce better output for what you’re actually trying to build, then I think that’s a huge win.

Drew: There’s a massive difference, isn’t there, between somebody just working solo on interesting projects that take their fancy and they might say, "Oh, okay, the ideal technical solution for this particular thing is this. And the ideal solution for this other thing is that," and there’s no real cost for them switching around. But when you’re talking about a team, if you take on the ideal solution for something that isn’t part of your normal tool kit, then you are almost bringing in technical debt into the team because somebody needs to keep their skills up to date with that other thing in order to keep it moving forward. So yeah. That’s really interesting.

Drew: Of course, one of the big things people worry about with these JavaScript heavy frameworks, React and all the others, is the weight of the JavaScript. So, I mean I guess performance is a big factor when it comes to the performance is a big reason that somebody might choose to use Astro. Is that right?

Matthew: Oh yeah, absolutely. So Astro does not add any JavaScripts by default. You can add your own script tags obviously and you can do anything you can do in HTML, but by default, thought of the other kind of component based frameworks, we don’t actually add any JavaScript for you unless you specifically tell us to. And I think that’s one thing that we really got right early. And it was kind of an accident actually, is that we were just building this thing and we just didn’t put in the part to make the JavaScript get loaded. We just didn’t write that part. We just wrote the part that generated the HTML and we’re like, "Oh, we actually like this better."

Matthew: So anyway, so what we wind up doing is we use a technique called partial hydration. I don’t know if you’re familiar with that, but essentially it’s a way to, you have a component and we only want to hydrate the part that actually is needed in the client. So if you’re familiar with more of a traditional SPA, single page app approach, usually have one component, which is your app component and it’s just nested a thousand components inside of it. Right? And some of those components are actually interactive, right? There could be a dropdown or there could be some type of form with validation, whatever it may be. Those are the parts that actually need to run in the client, but just the way the SPA architecture works, you got to run all the code for the entire thing for it to work at all.

Matthew: So partial hydration is, generally speaking, it’s a way to figure out what are the parts that actually matter, the parts that actually need to run in the client, and just only seeing that JavaScript. So one of the members of our team, Nate Moore, worked on this project called Microsite, which it was a Preact server rendering project, Preact. And what it would do is you would tell it, "Okay, this component needs to actually run in the client," and it would add the JavaScript for that. So he had worked on this partial hydration idea before and we just adopted that. He joined our team and we adopted that approach.

Matthew: So one thing that Astro does that’s unique is you tell it how you want it to hydrate in the client, and what I mean by that is there are different ways you can hydrate. Astro always loads JavaScript lazily, meaning that we don’t add a script tag for your component in the head or something like that. We don’t do that. Instead we have an in-line script that loads the JavaScript. And so you can load, I think there’s four different ways now, you can load on page load. So that’s the load event that exists in browsers, you can load on idle. So there’s a browser API called requestIdleCallback, and what that will do is it will let you know basically when the CPU is idle, when the browser’s not busy doing work, so you can load that way. And you can load on visibility, which means that, for example, maybe you have a component that’s far down in the page, you wait until the user scrolls that component into view, and then we load the JavaScript.

Matthew: And then lastly, there’s one called media and that’s based on media queries. So the use case for that is that, let’s say, you have some component that only runs on mobile, for example, and I’m sure you’ve seen the sidebars that you can click into view. Those types of things, usually a lot of times, don’t exist on desktop so you can set a media query and it will only load that component when it matches that media query.

Matthew: So anyways, those are the four ways to hydrate. So I think one thing that we did well is that we force you to choose which one of those things to do. So it makes the developer stop and think about, what it is the best way to load this code? Do I really need this code? Does this component need to run right away? Oh no, this thing only exists down the page. Let’s make this be visible.

Drew: So yes, I guess there’s all sorts of trade offs between each type. I guess if something’s only going to load when the browser is idle, then you don’t have control over if that’s going to happen in time for whatever sort of interaction that you want.

Matthew: Yeah. You would do that for maybe lower priority things, I guess. I mean it’s usually pretty safe, especially in Astro sites. Idle happens much quicker. You think about something that’s built as a SPA where there’s a lot of stuff going on, it’s rendering stuff and doing all this and maybe idle takes a little bit longer, but yeah, there’s definitely trade offs to all these. But I think the key thing is that we didn’t do anything magical really. I mean, it’s not like we figured out some crazy way to get performance. We just make you think about, what is the performance characteristics of what I’m building? And how should it load? And do I really need this thing to be in the browser at all? Or is this just happening one time when you’re building the site?

Drew: Yeah. I guess a lot of developers forget that the fastest site is one with no JavaScript on it. And so if you could just reduce the amount of JavaScript that is loading and passing, then it’s going to be quicker by default. So Astro renders all your JavaScript out to static HTML and CSS, and you can bring your own framework is something that it’s sort of described as, be that React or View or what have you. Does that mean Astro needs to have support for all of these frameworks? Or is it built in such a way that actually it really doesn’t matter what the JavaScript is that it’s dealing with?

Matthew: Yeah. There are little, we call plugins for these frameworks. So we’ve written a bunch of them already. If you just MPM install Astro, I think you get React, View, Svelte, Preact. I think it’s just those four. And I know we also have written our own plugins for Solid.JS, which is a newer framework, and Lit, LitElement, We have one for that as well. So they’re actually pretty easy to write. Every framework has a different way to render to HTML. So that’s what these plugins do is that you give them a component, or Astro gives them a component, and then they just render that thing to HTML.

Drew: I was going to ask, yes, because all the frameworks have their own mechanism, don’t they for rendering out? So these plugins essentially enable Astro to hook into those rendering methods and-

Matthew: Yeah, exactly. That’s all they do, is that... Yeah. Yeah.

Drew: That’s excellent. So I’m presuming that Astro isn’t going to be able to take an existing, say React single page application and turn it into a static site. I’m guessing you actually need to build your site in a particular way with Astro in mind in the first place. Is that right?

Matthew: Kind of. I mean definitely it’s better to start from a position where you are thinking about it as a static site, but you certainly can take a React, like I said, one, you have your app component, you can put that in Astro and you can say client load, which that says to load this thing in the client, and then you get your SPA. So you can actually build a SPA on top of Astro and then maybe pluck things out over time, you’re like, "Oh wait, this header doesn’t need to be run on the client, let me grab that out of my SPA and put it in the Astro file." Do it that way.

Drew: So I’ve seen the documentation refer to the approach of islands rather than one big land mass. So can you explain that to us? What does that mean?

Matthew: Yeah, it gets back to what I was talking about before with the partial hydration is that, instead of having, like I said, one big SPA that is your entire application and everything derives from that, instead you have these small what we call islands of interactivity. I think Jason Miller of Google came up with this terminology. So you might have your top navigation bar and that’s an island, and then you might have a tabs island with some content, and you have those sorts of things. So they’re like mini apps within your page.

Drew: Okay. So you might have essentially a component which renders your main navigation and then a second component next to it, which is showing your number of items in your cart, for example, and you could pick different approaches to when those are hydrated. So the navigation would probably be just rendered out to HTML and not really interactive, it’s just links. And the cart component would actually be more interactive, would be running on the client and updating as you add things to your cart, or whatever the scenario would be.

Matthew: Yeah, exactly. And like you said, it’s a good point is that you can choose different ways to hydrate each of those. Some of those you maybe don’t need to hydrate at all, some of them you need to hydrate immediately, some of them you might need to hydrate in visibility because you have these different islands, you can think about them individually and what’s the best way to actually load them. Something like a cart, you probably want to do pretty early, because you want the user to see that cart number show up pretty quickly.

Drew: So when a component loads, one that we want to be fully hydrated, when that hydration process occurs in the browser, what’s going on under the hood there? Is the whole initial JavaScript that would’ve loaded when the page loaded in the traditional architecture, is that whole bundle then downloaded and instantiated at that point? Or is there something more clever going on?

Matthew: No, that’s exactly how it works. Like I said, we didn’t really do anything magical, it’s just very pretty straightforward. You say that you want something to load on idle, we load it on idle. What we do is we inject our own little script in specifically for that component, and, for example, for idle there’s a API called requestIdleCallback, window.requestIdleCallback, when that gets called by the browser, we import your JavaScript and that’s basically it. And then we render it. Each framework has a different way to render components on the client and so we have that code that actually does the rendering. And then from there, you’re inside of the framework component. Anything that you do, if it’s a View component, anything you do with View, it all just happens inside of there.

Drew: And so you’re still leaning on the traditional tools like Webpack and what have you to do your bundling for that to make sure that you’re only loading one instance of React and all those sorts of things?

Matthew: Yeah. We use Snowpack. Our team were the creators of Snowpack. Fred created initially, but that’s a more modern tool than something like Webpack, and what that does is that gives you basically a dev server that compiles things on demand. So instead of getting one giant bundle of your entire "app", each file gets compiled individually in Dev, and then when you deploy that production, of course it all gets bundled in an optimized sort of way. Yeah.

Drew: One of the nice things about static site generators is that they’re generally very simple. You’re taking some markdown files or whatever it is and rendering them out to HTML, and there’s not really too much to go wrong there. Is there more inherent risk with the complexity of what Astro is doing that you could make a change to your code, create a new component or whatever, and suddenly find that Astro won’t build because there’s an incompatibility? Is that a risk?

Matthew: That’s a really good question. I mean, yeah. I guess anytime you add another layer of obstruction, there’s a possibility of incompatibilities. The biggest thing is that you’re working with a framework and you got to make sure your framework version matches the plugin, the React plugin or whatever it is that you’re using, but we keep all those things up to date. So I haven’t seen a lot of issues around incompatibilities, and what’s great about Astro in particular, one of the things I love about it is our community is very passionate and we have people, because we chose this big tent, bring your own framework approach, we have people in our Discord who are Svelte specialists. They’re very good at that. They’re very good at View. And if you have any questions, something that you don’t know how to do, you can go there and ask the question and there’s probably someone that can help you.

Matthew: So I know that there in the past, there’s been issues where certain features of View didn’t work right, and that’s because our plugin didn’t implement something correctly, and we have people that fix that stuff very quickly.

Drew: So there’s quite an active community. You say it was around a Discord server?

Matthew: Yeah. Yeah. We have a Discord and a lot of people on there, people that contribute to documentation, people that help with support questions, and very vibrant community. Yeah.

Drew: Well, what’s the maturity of Astro like I mean, how long has it been going and are people using it in production?

Matthew: Yeah, there’s definitely a lot of people using it in production. The idea of Astro, as we’ve been talking about is a way to make building multiple page apps, bringing that architecture back, taking the new modern way people build things with components and component frameworks, but getting rid of the SPA part of it, which I think causes a lot of problems in sites that don’t need to be SPAs.

Matthew: So we trying to marry the new way of building things with what we think is a better architecture for a lot of websites. So our first approach to that was to build a static site generator, but the technology behind Astro doesn’t necessarily have to just generate static sites, we just thought that was the best way to go. And in doing that, we targeted a certain kind of website. We targeted people who are building blogs or people who are building marketing pages, these sorts of things, maybe even getting into e-commerce a little bit.

Matthew: So we’ve really been focused on getting that story right, so a lot of the people who have built stuff in the production, there’s tons of people who have built blogs and deployed those. And we’ve gotten some marketing sites and stuff like that as well. So I think that area is definitely maturing. Probably the next thing we’ll go after, and it might be a little while, but eventually we’ll get into e-commerce. More things actually need to be dynamically rendered on the server. You can’t currently do that with Astro, but we’re definitely going to get there.

Matthew: We’re currently gearing up towards our 1.0 release. We have a few things left to iron out. The initial implementation of Astro was hacky in some regards, and there are things that were not great about it. So some people in the team have been rebuilding our Astro compiler and we’re gearing up towards 1.0. I can’t give a definite date, but by the end of the year, we’re hoping to get that out. So that would be the point where we consider it, obviously 1.0 is a big milestone and we consider it ready for everybody, people who are very cautious about adopting new tools would be able to definitely get into it by then.

Drew: And how many people are working on the core of Astro? I mean, obviously there’s the community around it, but I imagine there’s a more core team of people working on it.

Matthew: Yeah. At Skypack, we have four people. Well, yeah, four people working on it.

Drew: So is Skypack the main sponsor of it as a project?

Matthew: Yeah. So Skypack was, or is, a CDN for loading JavaScript. What you can do is you can load any packages that get published MPM, you can load them directly in the browser using Skypack. And when we started working on Astro, what we were really trying to do, we were trying to figure out a way to help people who were using Skypack to find a way, people wanted to host their content, host their own JavaScript on Skypack, And we’re looking for ways to do that. And we kind of fell into Astro out from that. We were like, "Well, we really need to know about how the person builds their website to better optimize the loading of everything."

Matthew: So we’re like, "Well maybe we could build a little thing to where you can put your components together and we know about these components, so we know exactly what JavaScript you need." And we’re working on optimizations as what Astro grew out of, but then Astro has taken off to a bigger extent than I think we really even anticipated. So, we’re kind of seeing that Astro is maybe the future of the company, so we’re building the business around Astro now. Still TBD on what that means exactly, but that’s kind of the direction we’re going.

Drew: It sounds like the future is pretty bright for Astro. Are there features that you’ve still not got to or that you plan to add in the future or you’re hoping to add?

Matthew: Yeah. So one big one that we had at the very, very beginning and then we took out for reasons that, more than I can get into, but components in markdown. This is something, if you’ve heard of MDX, people are very passionate about this. They want to be able to use components within their markdown files. MDX is not MDX file, but that’s something that we currently don’t have. It’s something that we know that people are definitely excited about and we’re actually working on it right now. So, that’s something we should have very soon. In Astro, you can already have a .md file as your page, that way you’re writing a blog post, you do it in a markdown file instead of in .astro file. But soon you’ll be able to use .MDC, which when you do that, you’ll be able to write mark down, but you’ll also be able to put components inside of that.

Drew: That sounds like it would be great for things like documentation sites, for example, where you might have loads of documentation in markdown format, because it’s primarily text, but then want to throw in something interactive to help explain a concept or-

Matthew: Examples.

Drew: Examples. Yeah. So things like blogs, things like marketing sites, possibly documentation, those sorts of things are all good to go and a great use for Astro right now?

Matthew: Yeah. If you run npm init astro, it runs our generator and the generator has a bunch of different example starter templates essentially. We have one for blog. We have one for blog with multiple authors. So if you have multiple people working on a blog together. We have a portfolio. Astro is very good for portfolio websites. And then we do have one for docs as well. So all of those things that we’ve been talking about, there’s already starter templates for all of those.

Drew: Where’s the best place right now for somebody to learn more about Astro if they want to get started with it?

Matthew: I think docs.astro.build is probably the best place. Or if you just go to astro.build, there’s also a link to it. But that gives you our getting started documents, documentation. I think we have translations in a dozen languages already. And yeah, then I think there’s lots of links to jump on Discord and start asking questions.

Drew: And that Discord is the best place to go if somebody is a developer and wants to get involved, maybe, implementing a plugin for a different framework that you’ve not covered or maybe even contributing in a more heavyweight way?

Matthew: Oh yeah, we have a channel specifically for people who want to start contributing. That’s definitely a great place. If you’re more comfortable on GitHub, we have lots of people there as well.

Drew: Well, that’s fantastic. Is there anything else we should know about Astro?

Matthew: It’s the best and everyone should start using it.

Drew: Tell us briefly a bit more about Snowpack, because that sounds really interesting. From the perspective of people who might be familiar with some of these older tools like Webpack, what are the key differences with how Snowpack approaches the job?

Matthew: Yeah. I mean, Snowpack comes from more of the perspective, and Vite is another tool that’s very similar to Snowpack. They both do a very similar thing. Where they approach it from, you really wanted to approach it from your loading modules in the browser, the browser has a native way to load modules now, you can do a script type equals module and it can load any module that has import and export statements. However, what most people write in their modules is they import from different packages on MPM and the browser doesn’t have any way to load stuff off of MPM. It doesn’t know about that kind of thing. So what Snowpack does essentially is it does, it does know about, if you import React, it’s going to turn that React import into a URL that the browser can understand. So it’s all it does, is it translate the JavaScript or type script or whatever, the JSX, whatever it is that you write, which is not compatible with the browser and makes it compatible. That’s essentially what they do.

Drew: Sorry. Is that where Skypack then comes in, because it’s loading that React module from Skypack?

Matthew: Yeah. Well, it can. Snowpack Doesn’t do that by default. It does a more traditional local environment. So you’re still going to do your MPM install and do all that sort of thing. There is a way to turn on a Skypack integration. That’s still something that we’re trying to figure out the best way. Like I said, we came at this from the approach of, we wanted to make Skypack better for users, and make it easier to use Skypack. And we fell into Astro because of that. So I think we’re going to probably, at some point, get back to integrating things more tightly, but that would be the ideal, right? I think is that when you, I don’t know, I’m just thinking off the top of my head here, but when you deploy your website, maybe we translate all those React URLs to instead come from Skypack, that way they’re well cached and all that sort of thing.

Drew: Yeah. So-

Matthew: TBD on that.

Drew: I’ve been learning all about Astro. What have you been learning about lately Matthew?

Matthew: Oh, well, I mean I’m always learning lots of stuff. I think lately, the Astro compiler, it was originally, it’s all JavaScript and they’ve been rewriting it in Go. So Go programming language. I’ve used Go before, but it’s been quite a while so I’ve been relearning that as I play around with the new compiler.

Drew: Yeah. There seems to be a trend in all sorts of parts of the ecosystem of JavaScript tools being replaced by Go versions just for the performance.

Matthew: Yeah. Yeah.

Drew: As our projects get bigger and bigger and our build times get longer and longer, everyone’s looking for the next way to speed it up.

Matthew: Yeah. That’s exactly, that was it. I mean, we knew that we needed to rewrite it anyways and we’re like, "Why not just go for the speed boost as well?"

Drew: Yeah. Yeah. If you, dear listener, would like to hear more from Matthew, you can find him on Twitter where he’s @matthewcp or his personal website, which is matthewphillips.info. You can find out how to get started with astro at astro.build. Thanks for joining us today. Matthew. Did you have any parting words?

Matthew: No. Go download Astro and yeah, join Discord and talk to us.

Smashing Podcast Episode 39 With Addy Osmani: Image Optimization

In today’s episode of the Smashing Podcast, we’re talking about image optimization. What steps should we follow for performant images in 2021? I spoke with expert Addy Osmani to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s an engineering manager working on Google Chrome, where his team focuses on speed, helping to keep the web fast. Devoted to the open source community, his past contributions include Lighthouse, Workbox, Yeoman, Critical, and to do NVC. So we know he knows his way around optimizing for web performance. But did you know he wants won the Oscar for best actress in a supporting role due to a clerical error? My smashing friends, please welcome Addy Osmani. Hi, Addy. How are you?

Addy Osmani: I’m smashing.

Drew McLellan: That’s good to hear. I wanted to talk to you today about images on the web. It’s an area where there’s been a surprising amount of changes and innovation over the last few years, and you’ve just written a very comprehensive book all about image optimization for Smashing. What was the motivation to think at this time, "Now is the time for a book on image optimization?"

Addy Osmani: That’s a great question. I think we know that images have been a pretty key part of the web for decades and that our brains are able to interpret images much faster than they can text. But this overall topic is one that continues to get more and more interesting and more nuanced over time. And I always tell people this is probably, I think, my third or fourth book. I’ve never intentionally set out to write a book.

Addy Osmani: I began this book writing out an article about image optimization, and then over time I found that I’d accidentally written a whole book about it. We were working on this project for about two years now. And even in that time, the industry has been evolving browsers and tooling around images and image formats have been evolving.

Addy Osmani: And so I wrote this book because I found myself finding it hard to stay on top of all of these changes. And I thought, "I’m going to be a good web citizen and try to track everything that I’ve learned in one place so everybody else can take advantage of it."

Drew McLellan: It is one of those areas, I think, with a lot of performance optimization in the browser, it’s a rapidly shifting landscape, isn’t it? Where a technique that you’ve learned as being current and being best practice, some technology shift happens, and then you find it’s actually an anti-pattern and you shouldn’t be doing it. And trying to keep your knowledge up and make sure that you’re reading the right articles and learning the right things and you’re not reading something from two years ago is quite difficult.

Drew McLellan: So to have it all collected in one well-researched book from an authoritative source is really tremendous.

Addy Osmani: Yeah. Even from an author’s perspective, one of the most interesting things and perhaps one of the most stressful things for our editorial team was I would hand in a chapter and say it was done. And then two weeks later, something would change in a browser, and I’d be like, "Oh, wait. I have to make another last minute change."

Addy Osmani: But the image landscape has evolved quite a lot, even in the last year. We’ve seen WebP support finally get across the finishing line in most modern browsers. AVIF image support is in Chrome, coming to Firefox, JPEG XL, lazy loading. And across the board, we’ve seen enhancements in how you can use images on the web pretty concretely in browsers. But again, a lot for folks to keep on top of.

Drew McLellan: Some people might view the subject of image optimization as a pretty staid topic. We’ve all, at some point in our careers learn, how to export for web from our graphics software. And some of us that might be in the habit of taking those exported images and running them through something like ImageOptim.

Drew McLellan: So we might know that we should choose a JPEG when it’s a photographic image and a PNG when it’s a graphic based image and think that, "Okay, that’s it. I know image optimization, I’m done." But really, those things are just table stakes, aren’t they, at this point?

Addy Osmani: Yeah, they are. I think that as our ability to display more detailed, more crisp images and images within even in a different context, depending on whether you care about art direction or not, has evolved over time. I think the need to figure out how you can get those images looking as beautiful as intended to your end users, keeping in mind their environment, their device constraints, their network constraints is a difficult problem and something that I know a lot of people still struggle with.

Addy Osmani: And so when it comes to thinking about images and getting a slightly more refined take on this beyond just, "Hey, let’s use a JPEG," or "Let’s use a PNG," I think there’s a few dimensions to this worth keeping in mind. The first is just generally compression. You mentioned ImageOptim, and a lot of us are used to just dragging an image over into a place and getting something smaller off the back of it.

Addy Osmani: Now, when it comes to compression, we’re usually talking about different codecs. And codecs are a compression technology that usually have an encoder component to them for encoding files and a decoder component for decoding them and decompressing them. And when you come to deciding whether you’re using something, you generally need to think about whether the photos or the images that you’re using are okay for you to approach using a lossy compression approach or a loss less approach.

Addy Osmani: Just in case folks are not really as familiar with those concepts, a lossless approach is one where you reproduce the exact same file at the very end upon decompression. So you’re not really losing much in the way of quality. Lossless is a lot more putting your image through a fax machine. You get a facsimile of the original, and it’s not going to be the original file. There might be some different artifacts in place there. It might look subtly different. But in general terms, the more that you compress, the more quality that you typically lose.

Addy Osmani: And so with all of these modern image codecs, they’re trying to see just how much quality you can squeeze out while still maintaining a relatively decent file size, depending on the use case.

Drew McLellan: So really, from a technology point of view, you have a source image and then you have the destination file format. But the process of turning one into the other is open for debate. As long as you have a conforming file, how you do it is down to a codec that can have lots of different implementations, and some will be better than others.

Addy Osmani: Absolutely. Absolutely. And I think that, again, going back to where we started with JPEG and PNG, folks may know the JPEG was created for a lossy compression of photos. You generally get a smaller file off the back of it, and it can sometimes have different banding artifacts. PNG was originally created for a lossless compression, does pretty well on non-photographic images.

Addy Osmani: But since then, things have evolved. Around 2010, we started to get support for WebP, which was supposed to replace JPEG and PNG and beats them in compression by a little bit. But the number of image formats and options on the table has just skyrocketed since then. I think things are headed in generally a good direction, especially with modern formats like AVIF and JPEG XL. But it’s taken a while for us to get here. Even getting WebP support across all browsers took quite some time.

Addy Osmani: And I think ultimately what swayed it is making sure that developers have been asking for it, they’ve had an appetite for being able to get better compression out of these modern formats, and the desire to just have good compatibility across browsers for these things, too.

Drew McLellan: Yeah. WebP seems really interesting to me, because as well as having lossless and lossy compression available within the format, we obviously have a much reduced file size as a result. And there’s good browser support, and we see adoption from big companies like Google and Netflix and various big companies.

Drew McLellan: But my perception in the industry is that we don’t see the same sort of uptake at the grassroots level. Is WebP still waiting for its day to come?

Addy Osmani: I think that I would say that WebP is arriving. A lot of folks have been waiting on Safari and WebKit support to materialize, and we finally have that. But when we think about new image formats, it’s very important that we understand what does support actually mean. There’s browser support for decoding those images. We also need really good tooling support so that whether you’re in a node environment, image CDN, if you’re in a CMS, you have the ability to use those image formats.

Addy Osmani: I can remember many years ago when WebP first came out. Early adopters had this problem of you’d save your WebP file to your desktop, and then suddenly, "Oh, wait. Do I need to drag this into my browser to view it?," or, "If my users are downloading the WebP, are they going to get stuck and be wondering what’s going on?"

Addy Osmani: And so making sure that there’s pretty holistic support for the image format at both an operating system level as well as in other context is really important, I think, for an image format to take off. It’s also important for people who are serving up images to think about these use cases a little bit so that, if I am saving or downloading a file, you’re trying to put it into a portable format that people can generally share easily. And I think this is where, at least on iOS, iOS has got support for a hike and hyphen. And converting things over to JPEGs when necessary allows people to share them.

Addy Osmani: So thinking through those types of use cases where we can make sure that users aren’t losing out while we’re delivering them better compression is important, I think.

Drew McLellan: I have a slide sharing service that I run that, as you can imagine, deals with hundreds of thousands of images. And when I was looking at WebP, and this was probably maybe three years ago, I was primarily looking at a way to reduce CDN bandwidth costs, because if you’re serving a smaller file, you’re being charged less to serve it. But while I still needed a fullback image, a legacy image format as well, my calculations showed that the cost of storing a whole other image set outweighed the benefits of serving a smaller file. So here we are in 2021. Is that a decision I should be reconsidering at this point?

Addy Osmani: I think that’s a really important consideration. Sometimes, when we talk about how you should be approaching your image strategy, it’s very easy to give people a high-level answer of, "Hey, yeah. Just generate five different formats, and that will just scale infinitely." And it’s not always the case.

Addy Osmani: I think that when you have to keep storage in mind, sometimes trying to find what is the best, most common denominator to be serving your users is worth keeping in mind. These days, I would actually say that WebP is worth considering as that common denominator. For people who have been used to using the picture tag to conditionally serve different formats down to people, typically you’d use a JPEG as your main fallback. Maybe it’s okay these days to actually be using the WebP as your fallback for most users, unless you’ve got people who are on very, very old browsers. And I think we’re seeing a lot less of that these days. But you definitely have some flexibility there.

Addy Osmani: Now, if you’re trying to be forward facing, I would say go pick one format that you feel works really well. If you can approach storage in a way that scales and is flexible to your needs, what I would say people should do is consider JPEG XL. It’s not technically shipping in a browser just yet. When it does, JPEG XL should be a pretty great option for a lot of photos in lossy or lossless use cases or for non-photo use cases as well. And it’s probably going to be much better than WebP V1. So that’s one place.

Addy Osmani: I think that AVIF is probably going to be better if you need to go to really low bit rates. Maybe you care a lot about bandwidth. Maybe you care a little bit less about image fidelity. And at those bit rates, I could imagine it looking crisper than some of the alternatives. And until we have JPEG XL, I’d try to take a look at your analytics and understand whether it’s possible for you to serve AVIF. Otherwise, I’d focus on that WebP. If you were analytics, I guess most people can be served WebP and you care a little bit less about wide-gamut or text overlays, places where chromosome sampling may not be perfect in WebP. That’s certainly something worth keeping in mind.

Addy Osmani: So I would try to keep in mind that there’s not going to be a one size fits all for everybody. I personally, these days, worry a little bit less about the storage and egress and bandwidth costs, just because I use an image CDN. And I’m happy to say I use Cloudinary personally. We use lots of different image CDNs at where I work. But I found that not having to worry as much about the maintenance costs of dealing with image pipelines, dealing with how I’m going to support like, "Oh, hey, here’s yet another image format or new types of fallbacks or new web APIs," that has been a nice benefit to investing in something that just takes care of it for me.

Addy Osmani: And then the overall cost for my use cases have been okay. But I can totally imagine that if you’re running a slide service at that scale, that might not necessarily be an option, too.

Drew McLellan: Yeah. So I want to come back to some of these upcoming future formats. But I think that’s worth digging into, because with any sort of performance tools, Lighthouse, or WebPageTests, if any of us run our sites through it, one of the key things that it will suggest is that we use a CDN for images. And that is a very realistic thing to do for very big companies. Is it realistic and within the reach of people building smaller websites and apps, or is that actually as easy to do as it sounds?

Addy Osmani: I think the question people should ask is, "What are you using images for?" If you only have a few images, if you’re building a blog and the images you’re adding in are relatively simple, you don’t have hundreds and hundreds or thousands of thousands of images, you might be okay with just approaching this at build time, in a very static way, where you install a couple of NPM packages. Maybe you’re just using Sharp. And that takes care of you for the most part.

Addy Osmani: There are tools that can help you with generating multiple formats. It does increase your build time a little bit, but that might actually be fine for a lot of folks. And then for folks who do want to be able to leverage multiple-

Addy Osmani: And then for folks who do want to be able to leverage multiple formats, they don’t want to deal with as much of the tooling minutia and want to be able to get a really rich responsive image or story in place, I would say try out an image CDN. I was personally quite reticent about using it for personal projects for the cost concerns initially, and then over time as I took a look at my billing, I actually realized it’s saving me time that I’d otherwise be investing in addressing these problems myself. I don’t know how much you’ve had to write custom scripts for dealing with your images in the past but I realized if I can save myself at least a couple of days of debugging through these different npm packages a month, then the costs kind of take care of the time I’m saving and so it’s okay.

Addy Osmani: But it can be something where if you’re scaling to 100s of 1000s or millions of images and that’s not something that’s necessarily covered by your revenue or not something that you’re prepared to pay for, you do need to think about alternative strategies. And I think we’re lucky that we have enough flexibility with the tools that are available to us today to be able to go in either of those directions, where we do something a little bit more kind of custom, we tackle it ourselves or roll our own image CDN or we invest in something slightly more commercial. And we’re at a place where I’d say that for some use cases, yeah you can use an image CDN and it’s affordable.

Drew McLellan: I guess, one of the sort of guiding principles is always just to be agile and be prepared for change. And you might start off using an image CDN to dynamically convert your images for you as they’re requested, and if that gets to a point where it’s not sustainable cost-wise you can look at another solution and have your code base in a state where it’s going to be easy to substitute one solution for another. I think generally and anywhere you’re relying on a third-party service, that’s a good principle to have isn’t it? So these upcoming image formats, you mentioned JPEG XL. What is JPEG XL? Where’s it come from? And what does it do for us?

Addy Osmani: That’s an excellent question. So JPEG XL is a next generation image format, it’s supposed to be general purpose and it’s a codec from the JPEG committee. It started off with some roots in Google’s pic format and then Cloudinary’s FUIF format. There have been a lot of formats over the years that have kind of been subsumed by this effort, but it’s become a lot more than just the kind of sum of its individual parts and some of the benefits of JPEG XL are it’s great for high fidelity images, really good for lossless, it’s got support for progressive decoding, lossless JPEG transcoding, and it’s also kind of fuss and royalty free, which is definitely a benefit. I think that JPEG XL could potentially be a really strong candidate. We were talking earlier about, if you were to just pick one, what would you use? And I think the JPEG XL has got potential to be that one.

Addy Osmani: I also don’t want to over promise, we’re still very early on with browser support. And so I think that we should really wait and see, experiment and evaluate how well it kind of lines up in practice and meets people’s expectations but I see a lot of potential with JPEG XL for both those lossy and lossless cases. Right now, I belief that Chrome is probably the furthest along in terms of support, but I’ve also seen definitely interest from Mozilla side and other browsers in this so I’m excited about the future with JPEG XL. And if we were to say, what is even shorter term of interest to folks? There’s of course AVIF too.

Drew McLellan: Tell us about AVIF, this is another one that I’m unfamiliar with.

Addy Osmani: Okay. So we mentioned a little bit earlier about AVIF maybe being a better candidate if you need to go to low bit rates and you care about bandwidth more than image fidelity, as a general principle, AVIF really takes the lead in low fidelity high appeal compression. And JPEG XL, it should excel in medium to high fidelity, but they are slightly different formats in their own rights. We’re at a place where AVIF has got increasingly good browser support, but let me take a step back and talk a little bit more about the format. So AVIF itself is based on the AV1 video codec, which has been standardized by the Alliance for Open Media, and it tries to get people significant compression gains over JPEG, over WebP, which we were talking about earlier. And while the exact savings you can get from AVIF will depend on the content and your quality targets, we’ve seen plenty of cases where it can offer over 50% savings compared to JPEG.

Addy Osmani: It’s got lots of good features, it’s able to give you container support for new features like high dynamic range and wide color gamuts, film grain synthesis. And again, similar to talking about being forward facing, one of the nice things about the picture tag is that you could serve users AVIF files right now and it’ll still fall back to your WebP or your JPEG in cases where it’s not necessarily supported. But going back to your example about Photoshop Save For Web, you could take a JPEG that’s 500 kilobytes in size, try to shoot for a similar quality to Photoshop Save For Web and with AVIF I would say that you probably be able to get to a point where that file size is about 90 kilobytes, 100 kilobytes so quite a lot of savings with no real discernible loss in quality.

Addy Osmani: And one of the nice things about that is you’re ideally not going to be seeing as much loss of the texture in any images that have rich detail. So if you’ve got photos of forests or camping or any of those types of the things, they should still look really rich with AVIF. So I’m quite excited about the direction that AVIF has. I do think it needs a little bit more work in terms of tooling support. So I dropped a tweet out about this the other day, we’ve got a number of options for using AVIF right now, for single images we’ve got Squoosh, squoosh.app, which is written by another team in Chrome, so shout out to Surma and Jake for working on Squoosh. Avif.io has got a number of good options for folks who are trying to use AVIF today, regardless of what tech stack they’re focused on, Sharp supports AVIF too.

Addy Osmani: But then generally you think about other places where we deal with images, whether it’s in Figma or in Sketch or in Photoshop or in other places, and I would say that we still need to do a little bit of work in terms of AVIF support there, because it needs to be ubiquitous for developers and users to really feel like it’s landed and come home. And that’s one of the areas of focus for us with the teams working on AVIF in Chrome at the moment, trying to make sure that we can get tooling to a pretty good place.

Drew McLellan: So we’ve got in HTML, the picture element now, which gives us more flexibility over the traditional image tag. Although the image tag’s come a long way as well, hasn’t it? But we saw picture being added, it was around the same time as the native video tag, I think in that sort of original batch of HTML5 changes. And this gives us the ability to specify multiple sources, is that right?

Addy Osmani: Yes, that’s right.

Drew McLellan: So you can list different formats of images and the browser will pick the one it supports, and that enables us to be quite experimental straight away without needing to worry too much about breaking things for people with older browsers.

Addy Osmani: Absolutely. I think that’s one of the nicest benefits of using the picture tag outside of use cases where we’re thinking about our direction, just being able to serve people an image and have the browser go through the list of potential sources and see, okay, well, I will use the first one in that list that I understand otherwise I’ll fall back, that’s a really powerful capability for folks. I think at the same time, I’ve also heard some folks express some concern or some worry that we’re regenerating really huge blobs of markup now when we’re trying to support multiple formats and you factor in different sizes for those formats and suddenly it gets a little bit bulky.

Addy Osmani: So are there other ways that we could approach those problems? I don’t want to sell people too much on image CDNs, I want them to stand on their own. But this is one of those places where an idea called content negotiation can actually offer you an interesting path. So, we’ve talked a little bit about picture tag where you have to generate a bunch of different resources and decide on the order of preference, right, extra HTML. With content negotiation, what it says is let’s do all of that work on the server. So the clients can tell the server what formats it supports up front via list of MIME types via Accept HTTP header. Then the server can do all the heavy work of generating and managing ultimate resources and deciding which ones to send down to clients. And one of the powerful things here is if you’re using an image CDN, you can point to a single resource.

Addy Osmani: So maybe if we’ve got a puppy image like puppy.JPEG, we could give people a URL to puppy.JPEG and if their browser supports WebP or it supports a AVIF the server can get really smart about serving down the right image to those users depending on what their support looks like, but otherwise fall back without you needing to do a ton of extra work yourself. Now, I think that’s a powerful idea. There’s a lot that you can do on the server, we sometimes talk about how not everybody has got access to really strong network quality, your effective connection type can be really different depending on where you are.

Addy Osmani: Even living in Silicon Valley, I could be walking from a coffee shop to a hotel or I could be in the car and the quality of my wifi or my signal may not be that great. So this is where you’ve got access to other APIs, other ideas like the Save-Data client hint for potentially being able to serve people down even smaller sized resources, if the user has opted in to data savings. So there’s a lot of interesting stuff that we could be doing on the server side and I do think we should keep pushing on these ideas of finding a nice balance where people who are comfortable with doing the market path have got all the flexibility to do so and people who want slightly more magical solution have also got a few options.

Drew McLellan: The concept of this sort of data saver approach was something that I learned of first from your book. I mean, let’s go into that a little bit more because that’s quite interesting. So you’re talking about the browser being able to signal a preference for wanting a reduced data experience back because maybe it’s on a metered connection or has low battery or something.

Addy Osmani: Exactly. Exactly. I’ve been traveling in the normal times or the before times back when we would travel a lot more, I’ve experienced plenty of places in the world or situations where my network quality might be really poor or really spotty, and so even opening up a webpage could be a frustrating or difficult experience. I might be looking up a menu and if I can’t see pictures of the beautiful food they’ve got available I might go somewhere where I can, or I might, I don’t know, make myself some food instead. But I think that one of the interesting things about data saver is it gives you a connection back to what the user’s preferences are. So if as a user, I know that I’m having a hard time with my network connection. I can say, "Okay, well, I’m going to opt into data saver mode in my browser."

Addy Osmani: And then you can use that as a developer as a signal to say, "Okay, well, the user’s at a bit of a constrained, maybe we will surf them down much smaller images or images of a much lower quality." But they still get to see some images at all, which is better than them waiting a very long time for something much richer to be served down. Other benefits of these types of signals are that you can use them for conditionally serving media. So maybe there are cases where text is the most important thing in that page, maybe you can switch those images off if you discover that users are in kind of a constrained environment. I’ll only spend 30 seconds on this, but you can really push this idea to it’s extremes. Some of the interesting things you can do with Save-Data are maybe even turning off very costly features implemented in JavaScript.

Addy Osmani: If you have certain components that are considered slightly more optional, maybe those don’t necessarily need to be sent down to all users if they only enhance the experience. You can still serve everybody a very core, small, quick experience, and then just layer it on with some nice frosting for people who have a faster connection or device.

Drew McLellan: Potentially, I guess it could factor into pagination and you could return 10 results on a page rather than a 100 and those sorts of things as well. So lots of interesting, interesting capabilities there. I think we’re all sort of familiar with the frustrating process of getting a new site ready, optimizing all your images, handing it over to the client, giving them a CMS to manage the content and find that they’re just replacing everything with poorly optimized images. I mean, again, an image CDN, I guess, would be a really convenient solution to that but are there other solutions, are there things that the CMS could be doing on the server to help with that or is an image CDN just probably the way to go?

Addy Osmani: I think that what we’ve discovered after probably at least six or seven years of trying to get everybody optimizing their images is that it’s a hard problem where some folks involved in the picture might be slightly more technically savvy and maybe comfortable setting up their own tooling or going and running Lighthouse or trying out other tools to let them know whether there are opportunities to improve. I’d love to see people consistently using things like Lighthouse to catch if you’ve got opportunities to optimize further or serve down images of the right size but beyond that, sometimes we run into use cases where the people who are uploading images may not necessarily even understand the cost of the resources that they’re uploading. This is commonly something we run into, and I’ll apologize, I’m not going to call people out too much, but this is something we run into even with the Google blog.

Addy Osmani: Every couple of weeks on the Google blog, we’ll have somebody upload a very large 20 or 30 megabyte animated GIF. And I don’t expect them to know that that’s not a good idea, they’re trying to make the article look cool and very engaging and interactive, but those audiences are not necessarily going to know to go and run tools or to use ImageOptim or to use any of these other tools in place and so documenting for them, that they should check them out, is certainly one option. But being able to automate away the problem, I think is very compelling and helps us consistently get to a place where we’re hopefully balancing the needs of all of our users of CMSs, whether they’re technical or non-technical, as well as the needs of our users.

Addy Osmani: So I think the image CDNs can definitely play a role in helping out here. Ultimately, the thing that’s important is making sure you have a solution in place between people, stakeholders who might be uploading those images, and what gets served down to users. If it’s an image CDN, if it’s something you’ve rolled yourself, if it’s a built step, just needs to be something in place to make sure that you are not serving down something that’s very, very large and inefficient.

Drew McLellan: Talking about animated GIFs, they’re surprisingly popular. They’re fun, we love them, but they’re also huge. And really, it’s a case where a file format that was not designed for video is being used for video. Is there a solution to that with any of these image formats? What can we do?

Addy Osmani: Oh, gosh. The history of GIFs is fascinating. We saw a lot of the formats we know and love or have been around for a while were originated in the late '80s to early '90s, and the GIF is one of those. It was created in 1987. I’m about as old as the GIF.

Addy Osmani: As you mentioned, it wasn’t originally created necessarily for use case. I think it was Netscape Navigator which in mid '90s maybe added support for looping GIFs and giving us this kind of crazy fun way to do memes and the like, but GIFs have got so many weaknesses. They’re kind of limited in many cases to a very finite color palette; 256 colors, in many cases. They’re a bitmapped raster format with pixel value stored in image files.

Addy Osmani: They’re very inefficient, for a number of reasons. And you mentioned that they’re also quite large. I think that we’ve gotten into this place of thinking that if we want a short segment of video or animation that’s going to be looping, the GIF is the thing that we have to use. And that’s just not the case.

Addy Osmani: While we do see that there are modern image formats that have support for animation, I think that the most basic thing you can do these days is make sure you’re serving a video down instead of a GIF. Muted auto-play videos combined with HD64, HD65, whatever video you’re going to use, can be really powerful, and significantly smaller for use cases where you need to be showing a sequence of images.

Addy Osmani: There are options for this. AVIF has got image sequences in there, potentially. Other formats have explored these ideas as well. But I think that one thing you can do is, if you’re using GIFs today, or you have users who are slightly less technical who are using GIFs today, try to see if you can give them tools that will allow them to export a video instead, or if your pipeline can take care of that for them, that’s even better.

Addy Osmani: I have plenty of conversations with CMS providers where you do see people uploading GIFs. They don’t know the difference between a video and a GIF file. But if you can just, whether it’s with an image CDN or via some built process, change the file over to a more efficient format, that would be great.

Drew McLellan: We talked briefly about tools like ImageOptim that manage to strip out information from the files to give us the same quality of result with a smaller file size. I’m presuming that’s because the file formats that we commonly deal with weren’t optimized for delivery over the Web in the first place, so they’re doing that step of removing anything that isn’t useful for serving on the Web. Do these new formats take that into consideration already? Is something like ImageOptim a tool that just won’t be required with these newer formats?

Addy Osmani: I’m anticipating that some of the older formats... Things that have been around for a while, take a while to phase out or to evolve into something else. And so I can see tools like ImageOptim continuing to be useful. Now, what are modern image formats doing that are much better? Well, I would say that they’re taking into account quite a few things.

Addy Osmani: They’re taking into account, are there aspects of the picture that the human eye can’t necessarily make out a difference around? When I’m playing around with different quality settings or different codecs, I’m always looking for that point where if I take the quality down low enough, I’m going to see banding artifacts. I’m going to see lots of weird looking squares around my buildings or the details of my picture.

Addy Osmani: But once those start to disappear, I really need to start zooming in to the image and making comparisons across these different formats. And if users are unlikely to do that, then I think that there are good questions around is that point of quality good enough? I think that modern image formats are pretty good at being able to help you navigate, filtering out some of those details pretty well. Keeping in mind what are the needs of color, because obviously we’ve got white gamut as a thing right now as well.

Addy Osmani: Some people might be okay with an amount of changing your color palette versus not, depending on the type of images that you have available, but definitely I see modern formats trying to be resilient against things like generational loss as well. Generational loss is this idea that... We mentioned memes earlier. A common problem on the Web today is you’ll find a meme, whether it’s on Facebook or Instagram or Reddit or wherever else, you’ll save it, and maybe you’ll share it around with a friend. Maybe they’ll upload it somewhere else. And you suddenly have this terrible kind of copy machine or fax effect of the quality of that image getting worse and worse and worse over time.

Addy Osmani: And so when I see something get reshared that I may have seen three months ago, now it might not be really, really bad quality. You can still make out some of the details, but image formats, being able to keep that in mind and work around those types of problems, I think are really interesting.

Addy Osmani: I know that JPEG XL was trying to keep this idea of generational loss in mind as well. So there’s plenty of things that modern codecs and formats are trying to do to evolve for our needs, even if they’re very meme focused.

Drew McLellan: Let’s say you’ve inherited a project that has all sorts of images on it. What would be the best way to assess the state of that project in terms of image optimization? Are there tools or anything that would help there?

Addy Osmani: I think that it depends on how much time you’ve got to sink into the problem. There are very basic things people can try doing, like obviously batch converting those images over to more modern formats at the recommended default quality and do an eyeball check on how well they’re doing compared to the original.

Addy Osmani: If you’re able to invest a little bit more time, there are plenty of tools and techniques like DSSIM and other ways of being able to compare what the perceptual quality differences are between different types of images that have been converted. And you can use that as a kind of data-driven approach to deciding, if I’m going to batch convert all of my old images to WebP, what is the quality setting that I should be relying on? If I’m going to be doing it for AVIF or JPEG XL, what is the quality setting that I should be relying on?

Addy Osmani: I think that there’s plenty of tools people have available. It really just depends on your time sink that’s possible. Other things that you can do, again, going back to the image CDN aspect, if you don’t have a lot of time and you’re comfortable with the cost of an image CDN, you can just bulk upload all of those images. And there are CDNs that support this idea of automatic quality setting. I think in Cloudinary it’s q_auto, or something like that.

Addy Osmani: But the basic idea there is they will do a scan of the image, try to get a sense of the type of content that’s in there, and automatically decide on the right level of quality that you should be using for the images that are getting served down to users. And so you do have some tooling options that are available here, for sure.

Drew McLellan: I mean, you mentioned batch processing of images. Presumably you’re into the area of that generational loss that you’re talking about, when you do that. When you take an already compressed JPEG and then convert it to a WebP, for example, you risk some loss of quality. Is batch converting a viable strategy or does that generational loss come too much into play if you care about the pristine look of the images?

Addy Osmani: I think it depends on how much you’re factoring in your levels of comfort with lossy versus lossless, and your use case. If my use case is that I’ve inherited a project where the project in question is all of my family’s photos from the last 20 years, I may not be very comfortable with there being too much quality loss in those images, and maybe I’m okay with spending a little bit more money on storage if the quality can remain mostly the same, just using a more modern format.

Addy Osmani: If those are images for a product catalog or any commerce site, I think that you do need to keep in mind what your use case is. Are users going to require being able to see these images with a certain level of detail? And if that’s the case, you need to make those trade-offs in mind when you’re choosing the right format, when you’re choosing the right quality.

Addy Osmani: So I think that batch is still okay. To give you a concrete idea of one way of seeing people approach this at scale, sometimes people will take a smaller sample of the images from that big collection that they’ve inherited, and they’ll try out a more serious set of experiments with just that set. And if they’re able to land on an approach that works well for the sample, they’ll just apply it to the whole batch. And I’ve seen that work to varying degrees of success.

Drew McLellan: So optimizing file size is just sort of one point on the overall image optimization landscape. And I’d like to get on to talking about what we can do in our browsers to optimize the way the images are used, which we’ll do after a quick word from this episode sponsor.

Drew McLellan: So we’ve optimized and compressed our large files, but now we need to think about a strategy for using those in the browser. The good old faithful image tag has gained some new powers in recent times, hasn’t it?

Addy Osmani: Yeah, it has. And maybe it’s useful for folks... I know that a lot of people that ask me about images these days also ask me to frame it in terms of metrics and the Core Web Vitals. Would it be useful for me to talk about what the Core Web Vitals are and maybe frame some of those ideas in those current terms?

Drew McLellan: Absolutely, because Core Web Vitals is a sort of initiative from Google, isn’t it, that we’ve seen more recently? We’re told that it factors into search ranking potentially at some level. What does Core Web Vitals actually mean for us in terms of images?

Addy Osmani: Great question. As you mentioned, Core Web Vitals is an initiative by Google, and it’s all about trying to share unified guidance for quality signals. That can be pretty key to delivering a great user experience on the Web. And it is part of a set of page experience signals Google Search may be evaluating for ranking purposes, but they can impact the Core Web Vitals in a number of ways.

Addy Osmani: Now, before I talk about what those ways are, I should probably say, what are the Core Web Vitals metrics? There’s currently three metrics that are in the Core Web Vitals. There’s largest contentful paint, there’s cumulative layout shift, and there’s first input delay. Now, in a lot of modern Web experiences we find that images tend to be one of the largest visible elements on the page. We see a lot of product pages where we have a big image that’s the main product item image. We see images in carousels, in stories and in banners.

Addy Osmani: Now, largest contentful paint, or LCP, is a Core Web Vitals metric that tries to measure when the largest contentful element, whether it’s an image text or something else, is in a user’s viewport, such that we’re able to tell when that image becomes visible. And that really allows a browser to determine when the main content of the page has really finished rendering.

Addy Osmani: So if I’m trying to go to a recipe site, I might care about how that recipe looks, and so we care about making sure that that big hero image of the recipe is visible to me. Now, the LCP element can change over time. It’s very possible that early on in load, the largest thing may be a heading, but as the page continues to load, it might actually end up being a much larger image or a poster of some sort.

Addy Osmani: And so when you’re trying to optimize largest contentful paint, there’s about four things that you can do. The first thing is making sure that you’re requesting your key hero image as early on as possible. Generally, we have a number of things that are important in the page. We want to make sure that we can render the main page’s content and layout.

Addy Osmani: For layout, typically we’re talking about CSS. So you may be using critical CSS, inline CSS, in your pages, want to avoid things that are render blocking, but then when it comes to your image, ideally you should be requesting that image early. Maybe that involves just making sure that the browser can discover that image as early on in the page as possible, given that a lot of us these days are relying on frameworks.

Addy Osmani: If you’re not necessarily using SSR, server-side rendering, if you are waiting on the browser to discover some of your JavaScript bundles, bundles for your components, whether you have a component for your hero image or product image, if the browser has to wait to fetch, parse, execute, compile and execute all of these different files before it can discover the image, that might mean that your largest contentful image is going to take some time before it can be discovered.

Addy Osmani: Now, if that’s the case, if you find yourself in a place where the image is being requested pretty late, you can take advantage of a browser feature called link rel preload to make sure that the browser can discover that image as early as possible. Now, preload is a really powerful capability. It’s also one that you need to take a lot of care with. These days, it’s very easy to get to a place where maybe you hear that we’re recommending preload for your key-

Addy Osmani: Maybe you hear that we’re recommending preload for your key hero image, as well as your key scripts, as well as your key fonts. And it becomes just this really big, massive trying to make sure that you’re sequencing things in the right order. So the LCP images is definitely one key place worth keeping in mind for this.

Addy Osmani: The other thing, as I mentioned four things, the other thing is make sure you’re using source set and an efficient modern image format. I think that source set is really powerful. I also see sometimes when people are using it, they’ll try to overcompensate and will maybe ship 10 different versions of images in there for each possible resolution. We tend to find, at least in some research, that beyond three by images, users have a really hard time being able to tell what the differences are for image quality and sharpness and detail. So DPR capping, device pixel ratio capping, is certainly an idea worth keeping in mind.

Addy Osmani: And then for modern image formats, we talked about formats earlier, but consider your WebP, your AVIF, your JPEG XL. Avoid wasting pixels. It’s really important to have a good strategy in place for quality. And I think that there are a lot of cases where even the default quality can sometimes be too much. So I would experiment with trying to lower your bit rate, lower your quality settings, and see just how far you can take things for your users while maintaining sharpness.

Addy Osmani: And then when we’re talking about loading, one of the other things that the image tag has kind of evolved to support over the last couple of years is the lazy loading. So with loading equals lazy, you no longer need to necessarily use a JavaScript library to add lazy loading to your images. You just drop that onto your image. And in chromium browsers and Firefox, you’ll be able to lazy load those images without needing to use any third-party dependencies. And that’s quite nice too.

Addy Osmani: So, we’ve got lazy loading in place. We’ve got support for other things like sync decoding, but I’m going to keep things going and talk very quickly about the other two core vitals metrics.

Drew McLellan: Go for it, yep.

Addy Osmani: So, get rid of layout shifts. Nobody likes things jumping around their pages. I feel like, one of my biggest frustrations is I open up a web page. I hover my finger over a button I want to click, and then suddenly a bunch of either ads or images without dimension set or other things pop in. And it causes a really unpleasant experience.

Addy Osmani: So cumulative layout shift tries to measure the instability of content. And a lot of the time, the common things that are pushing your layout shifts are images or other elements on your page that just don’t have dimension set. I think that that’s one of those places where it’s often straightforward for people to set image dimensions. Maybe it’s not something we’ve historically done quite as much of, but certainly something worth spending your time on. In tools like lighthouse will try to help you collect, like what is the list of images on your page that require dimensions? So you can go and you can set them.

Drew McLellan: I was going to say, that’s a really interesting point because when responsive web design became a thing, we all went through our sites and stripped out image dimensions because the tools we had at our disposal to make that work required that we didn’t have height and width attributes on our images. But that’s a bad idea now, is it?

Addy Osmani: What’s old is new again. I would say that it’s definitely worth setting dimensions on your images. Set dimensions on your ads, your eye frames, anything that is dynamic content that could potentially change in size is worth setting dimensions on.

Addy Osmani: And for folks who are building really fun out there experience, out there is the wrong phrase, really fun layout experiences where maybe you need to do kind of more work on responsive cards and the like; I would consider using CSS aspect ratio or aspect ratio boxes to reserve your space. And that can compliment setting dimensions on those images as well for making sure that things are as fixed as possible when you’re trying to avoid your layout shifts.

Addy Osmani: And then, finally last Core Web Vital is first input delay. This is something people don’t necessarily always think about when it comes to images. So it is in fact possible for images to block a user’s bandwidth and CPU on page load. They can get in the way of how other critical resources are loaded in, in particular on really slow connections or on lower end mobile devices that can lead to bandwidth saturation.

Addy Osmani: So first input delay is a Core Web Vital metric that captures, it users first impression of a site’s interactivity and responsiveness. And so by reducing main thread CPU usage, your first input delay can also be kind of minimized. So in general there, just avoid images that might cause network contention. They’re not render blocking. But they can still indirectly impact your rendering performance.

Drew McLellan: Is there anything we can do with images to stop them render blocking? Can we take load off the browser in that initial phase somehow to enable us to be interactive quicker?

Addy Osmani: I think it’s really important increasingly these days to have a good understanding of the right optimal image sequence for displaying something above the fold. I know that above the fold is an overloaded term, but like in the user’s first view port. Very often we can end up trying to request a whole ton of resources, some of them being images, that are not really necessary for what the user is immediately going to see. And those tends to be great candidates for loading later on in the page’s lifecycle, great things to lazy load in place. But if you’re requesting a whole slew of images, like a whole queue of things very early on, those can potentially have an impact.

Drew McLellan: Yeah. So, I mean, you mentioned lazy loading images that we’ve historically required a JavaScript library to do, which has its own setbacks, I think, because of historic ways that browsers optimize loading images, where it’s almost impossible to stop them loading images, unless you just don’t give it a source. And if you don’t give it a source and then try and correct it with JavaScript afterwards, if that JavaScript doesn’t run, you get no images. So lazy loading, native lazy loading is an answer to all that.

Addy Osmani: Yeah, absolutely. And I think that this is a place where we have tried to improve across browsers, the native lazy loading experience over the last year. As you know, this is one of those features where we shipped something early and we’re able to take advantage of conversations with thought leaders in the industry to understand like, "Oh, hey, what are the thresholds you’re actually manually setting if you’re using lazy sizes or you’re using other JavaScript’s lazy loading libraries?" And then we tuned our thresholds to try getting to a slightly closer place to what you’d expect them to be.

Addy Osmani: So in a lot of cases, you can just use native lazy loading. If you need something a lot more refined, if you need a lot more control over being able to set the intersection observer thresholds, the point of when the browser is going to request things, we generally suggest, go and use a library in those cases, just because we’re trying to solve for the 90% use case. But the 10% is still valid. There might be people who still need something a little bit more. And so, for most people, I’m hopeful that native lazy loading will be good enough for the foreseeable future.

Drew McLellan: Most of all, it’s free. A simple attribute to add, and you get all this functionality for free, which is great. If there was one thing that our listener could do, could go away and do to their site to improve their image optimization, what would it be? Where should they start?

Addy Osmani: A good place to start is understand how much of a problem this is for your site. I’d go and check out either lighthouse or pay speed insights. Go and run it on a few of your most popular pages and just see what comes out. If it looks like you’ve only got one or two small things to do, that’s fantastic. Maybe you can put some time in there.

Addy Osmani: If there’s a long list of things for you to do, maybe take a look at the highest opportunities that you have in there, things that say, "Oh, hey, you could save multiple seconds if you were to do this one thing." And focus your energy there to begin with.

Addy Osmani: As we’ve talked about here, tooling for modern image formats has gotten better over time. Image CDNs can definitely be worth considering. But beyond that, there’s a lot of small steps you can take. Sometimes if it’s a small enough site, even just going and opening up Squoosh, putting a few of your images through there can be a great starting point.

Drew McLellan: That’s solid advice. Now I know it’s a smashing publication, but I really must congratulate you on the book. It’s just so comprehensive and really easy to digest. I think it’s a really valuable read.

Drew McLellan: So I’ve been learning all about image optimization. What have you been learning about lately, Addy?

Addy Osmani: What have I been learning about lately? Actually, on a slightly different topic that still has to do with images, so when I was doing my masters at college, I got really deep into computer vision and trying to understand, how can we detect different parts of an image and do wild and interesting things with them?

Addy Osmani: And a specific problem I’ve been digging into recently is I’ve been looking at pictures of myself when I was a baby or a kid. And back then, a lot of the food is my parents would take were not necessarily on digital cameras. They were Polaroids. They’re often somewhat low resolution images. And I wanted a way to be able to scale those up. And so I started digging into this problem again recently. And it led me to learn a lot more about what I can do in the browser.

Addy Osmani: So I’ve been building out some small tools that let you, using machine learning, using TensorFlow, using existing technologies, take a relatively low resolution image or illustration, and then upscale them to something that is much higher quality. So that it’s better than simply just like stretching the image out. It’s like actually filling in detail.

Addy Osmani: And that’s been kind of fun. I’ve been learning a lot about how stable web assembly is now across browser, how well you can use some of these ideas for desktop application use cases. And that’s been really fun. So I’ve been digging into a lot of web assembly recently. And that’s been cool.

Drew McLellan: It’s funny, isn’t it? When a technology comes along that turns everything you know on its head. We’ve always said that on the web, we can make images smaller. But if we’ve only got a small image, we can’t make it bigger. It’s just impossible. But now we have technology that, under a lot of circumstances, might make that possible. It’s really fascinating.

Drew McLellan: If you, dear listener, would like to hear more from Addie, you can find him on Twitter where he’s @AddieOsmani and find all his projects linked from AddyOsmani.com. The book “Image Optimization” is available both physically and digitally from Smashing right now at smashingmagazine.com. Thanks for joining us today, Addy. Do you have any parting words?

Addy Osmani: Any parting words? I have a little quirk from history that I will share with people. Tim Berners-Lee uploaded the very first image to the internet in 1992. I’m not sure if you can guess what it was, but you’ll probably be surprised. Drew, do you have any guesses?

Drew McLellan: I’m guessing a cat.

Addy Osmani: A cat. It’s a good guess, but no. This was at CERN. And the image was actually of a band called Les Horribles Cernettes, which was a parody pop band formed by a bunch of CERN employees. And the music they would do is like doo-wop music. And they would sing love songs about colliders and quirks and liquid nitrogen and anti-matter wearing sixties outfits, which I found just wonderful and random.

Smashing Podcast Episode 38 With Ivan Akulov: Why Is My React App Slow?

In this episode, we’re talking about React performance. What factors slow our React apps down, and how can we fix it? I spoke to expert Ivan Akulov to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a Google developer expert, full-stack software engineer, and a performance consultant, and he’s the founder of web performance agency, PerfPerfPerf. He spends much of his time elbow deep in JavaScript and has contributed to different open source projects, often with a performance focus. We know he knows his stuff when it comes to web performance, but did you know he once rescued a panda from a rooftop using only a pogo stick? My smashing friends, please welcome, Ivan Akulov. Hi Ivan. How are you?

Ivan Akulov: Smashing. Thank you.

Drew McLellan: I wanted to talk to you today about web performance, because that’s your professional focus and your area of expertise. But in particular, about performance with React. How much of your work involves working with reactive framework such as React? Is it something that’s becoming a lot more common?

Ivan Akulov: Yeah. I think it’s 50-50. I think half of my work is dedicated to helping clients with low net performance and another half of my work is dedicated to helping clients with React runtime performance.

Drew McLellan: Is it increasing? Is that balance increasing? Do you see more clients adopting React over traditional methods or over other frameworks?

Ivan Akulov: Well, to be honest, it’s hard to compare React with other ... There are two ways to answer this question. The first one is whether React is getting more popular than traditional like JavaScript libraries, jQuery, et cetera. That’s definitely true. That’s been going on for a while. Another one is whether React, like direct gross or false compared to Vue and other frameworks.

Ivan Akulov: To be honest, no. It’s really hard to judge from my corner. What I know is that React definitely seems to be most popular framework. Also, I have a few friends from different parts of the world and this is actually not true for different geographies. For example, In Georgia, which is the country, not the US State. As far as I remember, most of the local developers use Angular, and that’s fairly interesting. I came to do React talk there once, and the folks who were organizing, they went and told me that it will be harder to find attendees because React is not so popular with them.

Drew McLellan: That’s really interesting. IF someone was to come to you and say, "Hey Ivan, you’re a handsome man. Why is my React app slow?" Where would you start to look? Are there main sorts of problems that developers run across when it comes to React?

Ivan Akulov: Yeah. When a developer comes to me and asks, "Hey my app is slow. Why is it happening? How can we approve it?" My first step would be to reproduce that locally. When I reproduce that locally, I would record from dev tools, performance profile, and React DevTools performance profile. So, that would be my two primary tools.

Drew McLellan: You mentioned React profiling tools, what do those tools tell you? Do they tell you, like for example, which components are being slow inside your app?

Ivan Akulov: Yeah. My first step would be to look into the React DevTools. React DevTools have two types. They have the components tree tab, which are obviously all the components that you have on the app, obviously. There’s also a tab called profiler, which lets you record the profile of how the app renders, like how many times it renders, which components take the most time out of each render.

Ivan Akulov: My first step would be to reproduce that issue that the developer came to me with. Record a profile in session of it using React profiler, and then look into what exactly is happening. Typically, there are two primary issues that are making this slow, two low-hanging fruits that you would focus on first.

Ivan Akulov: The first one is components that are taking too much time rendering and that may be for multiple reasons. Perhaps there’s just a single component that’s doing something expensive. I had one client who ... Well, it’s basically the client that was a static site rendered through the React. What they were doing, they will login articles from the server, in the markdown format. And then they were parsing that markdown into HTML. They were converting that markdown into the HTML on the client, because the article is very large that were taking a few 100 milliseconds. That single component of parsing articles was taking a few 100 milliseconds to render. That’s one example.

Ivan Akulov: Apart from a single component being slow, there could be just subarrays of components rendering unnecessarily and being a bottleneck. Another thing that happens is cascading renders. That’s when you’re doing a single action in the app, and that schedules a few renders one after another. So, there again might be a bunch of reasons for that. There are a lot of ways that could happen. That’s another thing I would look into and I would try to reduce the number of renders or move unnecessary renders scheduled by React.

Drew McLellan: Are there things you can do in the design of an Apple, the design of a page in traditional terms to make sure that you’re not running into these sorts of performance problems?

Ivan Akulov: In the design, you mean the UI/UX, right?

Drew McLellan: Yeah, in the user interface. Are there sort of common traps that is easy to fool into that would make a page, might cause unnecessary re-renders or things like that?

Ivan Akulov: I’m not sure. I can’t think of anything right now.

Drew McLellan: I had an issue, not in React, but in Vue. I’m a recovering React engineer. I work mostly in Vue now. I’ve dealt with some pages where I had a big list of data, and each line in the listing was a component that was being rendered, and this page might be 1,000 items long in some cases. You get that one component rendering 1,000 times. In situations like that, are there ways that you can architect it differently so that, that’s not a problem?

Ivan Akulov: Right. Yeah. There are different ways to solve it. I can only call solution for this when you have a table with a huge number of rows or columns, or at least with a huge number of rows is virtualization, which is basically you take a library of React. We need to do a React virtualized and you have the list with it.

Ivan Akulov: What the library does is it uses the intersection of your API to find which components are off-screen, which components are on-screen, and it renders on the components that are on-screen. If you have a list of, say, 1,000 items, but at any given moment you could unlist 10 items, then that library would make sure that only 10 of these right items are rendered into the DOM. You get significantly smaller DOM tree, which helps with stellar calculations, which helps with layout recalculations, and a bunch of other stuff. You also get smaller React component tree, which helps with the React reconciliation and similar stuff.

Ivan Akulov: Now, the API for this, which works a bit differently, but which is perhaps market-oriented is the recently-introduced content visibility API. So, this is a CSS property that was added into browsers, into Chrome half a year or a year ago. So, what it does is basically does the same thing that these libraries do. However, what it doesn’t practice is that it makes sure that the off-screen nets are not rendered. So, the browser skips them or ignores them completely.

Ivan Akulov: This also helps to reduce the rendering costs significantly. This is not going to help to reduce the React on a rendering cost; React would still reconcile the whole tree and arrange old relevant nodes of 1,000 components. But if your expensive part lies in the browser rendering and not in direct rendering, then that’s going to help.

Drew McLellan: That sounds promising, and that’s a native browser API, isn’t it, rather than part of React?

Ivan Akulov: Yes, exactly. It’s a single CSS property. There’s actually two CSS properties. The first property is called literally content-visibility. And the second one, I think, content-intrinsic-height, content-intrinsic-width, so two properties. The complex part, the complex thing about ... Actually, the challenging thing about both content visibility and about virtualization is that you can’t really do that if your list items have dynamic height, or dynamic width, if that’s the reason at least. Or actually, you can’t do that. The browser can’t know the height and the width of an element unless you’re trying to reduce it. Either gain the virtualization approach or in the content visibility approach.

Ivan Akulov: The problem is that if you have items with running width or we’re running height, and you don’t know their heights, for sure, then virtualizing them is going to be hard, because the scroll bar would be jumping all the time while you’re scrolling that list, because the browser would be rendering this element, rendering this weight and adjusting the page height. That’s the challenge of that.

Drew McLellan: That always is a classic challenge with laying things out in the web, isn’t it? Knowing what the heights are before they’ve rendered, even down to images and things like that.

Ivan Akulov: Yeah.

Drew McLellan: One of the key differences, building on a framework like React compared with just building HTML and CSS, sort of standard server side rendered pages, is you sort of have this balancing act of the loading performance versus the runtime performance. Is there a way? Is one of those more important than the other? Should you optimize for a site being performant once it’s done its initial load? Or is loading priority more important to stop visitors go away before things even loaded? Or is it a balance of the two?

Ivan Akulov: It really depends. My opinion is that it really depends on what kind of thing you’re doing. If you’re a static site, or if you’re a site or an app, or something that needs to optimize for, say, SEO or showing ads in that ranking and ad cost, then loading performance is going to be more important too, because that’s what search ranking is based on. That’s what ad costs are based on.

Ivan Akulov: And if you’re doing stuff, if you’re a complex single page app, which users come to and do some stuff for a while. I know, you’re some graphics editor, you’re some whatever, you do some complex stuff with JavaScript, then trend performance is perhaps much more important, because that’s actually much harder to measure. The effect of that is much harder to measure.

Ivan Akulov: I believe that runtime performance is much more important here, because that’s what users ... Because that’s what affects the overall user satisfaction. And if you are slow, then users are going to leave the app to competitors, and are going to complain to you. Actually, that’s one way to measure that.

Drew McLellan: With single page applications, is there a meaningful way that we can assess performance across the different parts of the app? Say this part of our app is slow, or that part of our app is slow, and this part is fine. I mean, traditionally, we look at the pages to see how they perform. But in a single page app, hat you’re loading in isn’t just one page, it’s actually you’re scaffolding an entire framework to get to that initial render. So, is there a good way to approach measuring performance across an entire app?

Ivan Akulov: That’s a good question. So, there are a few ways to approach this. The first way is the simplest one, but probably it’s often not what you’re looking for. One thing that you could do is you could use the built-in browser API to collect core web vitals data and collect that data and save it somewhere like in the Google analytics or another storage, and aggregate that data and look at your first input delay, your cumulative layout shift across the whole time the app was rendered, etc, etc. but that’s a very high level review, and it’s perhaps not going to be what you’re looking for.

Ivan Akulov: If I was doing that, what I would probably do is I would focus on the specifics of my app. So, let’s say my app is some text editor. Then what really matters to me that very few user metrics that really matter to me, it’s input latency. The faster the text is rendered after I press a key, the better is the performance. There are perhaps a few other metrics like switching between different menus or applying formatting like bold or italic, or etc.

Ivan Akulov: What I would do in this case is I would try to measure the duration of each of these interactions. I would try to measure the input latency, the duration of renders between I press the key and between the key appears on the screen duration of like applying the bold styling, and etc. I would try to collect this metrics in any real user monitoring software, and I would look in that to figure out whether I’m fast or slow, or whether I’m getting faster or I’m getting slower.

Drew McLellan: Is it more a case of measuring the things that your users are perhaps interacting with, rather than looking at a page and say how fast this page, because that doesn’t really make any sense when you’ve got more interactive interface?

Ivan Akulov: Yeah, exactly. I’ve heard multiple times that for some complex apps, login time is actually not a concern because users are used to ... When you’re opening a Photoshop, your use of that Photoshop is taking a while to load. You’re used to seeing that loading placeholder. It’s definitely not an issue when you’re opening, say, Google ... Google Sheets is not the right example, but any web drawing software. Again, it takes a while to load, that’s fine. That’s fine as long as it actually works quickly after that. If it takes a while to load but it works quickly after that, then users are actually not going to complain, because they’re used to this behavior.

Drew McLellan: You mentioned input delay as you’re typing. I saw a tweetstorm of yours where you went into the subject of components that seem to react too slowly like typing in a text field and the letters taking time to appear. That’s obviously a performance issue, because on a regular web page, typing in a text field is instantaneous. So, what causes those sorts of slowdowns?

Ivan Akulov: Just like with a generic correct performance, there are a lot of things that could cause that. What typically is happening when you’re typing into a text field and it takes a while to render that key that you’ve just pressed is that you’re running too much JavaScript when you’re handling that event. And there could be multiple reasons for that. You could be rendering too many components. Perhaps you’re pressing the key, and that saves the text input state in the Redux store. And that gives us the whole app to render, because I know that invalidates a large part of that Redux store.

Ivan Akulov: Or perhaps you are scheduling a few renders one after another. Or perhaps there’s some third-party library that’s taken a while to recompute something. Really, there’s no unique answers. Actually, rendering performance is really challenging to me. I think in general in this part.

Ivan Akulov: Loading performance is way easier to profile, it’s way easier to analyze, it’s way easier to measure. I think we actually see the effect of that, and that there’s way more content about loading performance, way more tools for loading performance. It’s way easier to measure and profile in that it’s pretty much identical for every application. No matter what application is, no matter what it’s written in, no matter what kind of stuff it does, they all load more or less the same way. Whatever the application is, you could always focus on the same things, and you could teach people the same things, and that would be all right.

Ivan Akulov: Whereas with runtime performance, the specifics of the slowdowns and specific offering time challenges are super different with every app. They could be optimized to some basic stuff, but it’s super hard to talk about them on the higher level, because with every app, they’re different with every single app.

Ivan Akulov: Actually, one of my challenges of them hoping to solve with the version that I’m doing is to give some kind of high level enough introduction to runtime performance that people who attend this workshop can learn that it can apply that to their applications with their specific challenges, and with their specific business logic.

Drew McLellan: If there’s things that you need to be particularly interactive and respond very quickly in terms of rendering, say, to take our example, again, of typing in a text field, and there is other work to be done that’s unavoidable. Is there a way of prioritizing one over the other in React? Can you say, "I need to do this render?", and then once that’s finished, now we do all this updating of state. Is that possible?

Ivan Akulov: Sure, yeah. There are, again, a few ways to do that. The first one is the one React has been working on for a while, which is the concurrent mode and prioritizing stuff that happens on this screen compared to stuff that happens on this screen, and etc, etc. I’ll be honest, I don’t have much knowledge about it yet, mostly because it haven’t stabilized. It’s nice to know about that and I enjoy reading about it, but I don’t think it makes sense to teach about it yet, because that’s not something that you could take and apply right now, but it could change a lot before it’s released to the public.

Ivan Akulov: When React eventually releases the concurrent mode and the whole prioritization thing, that’s likely going to be the universal answer or one of the best answers. Until that, what we could do is we could delay the computations by doing some throttling or advancing, or moving expensive computations to web workers. Or if the expensive works goes not by JavaScript, but by reconfiguring styles and reconfiguring layout, which is actually super common problem in some apps when you’re manipulating with the DOM, and it ends up causing first calculations, then perhaps optimizing these issues.

Ivan Akulov: Yeah. If we have a text editor, and we need to make sure we are typing into it quickly, what I will do is I will try to, or on as few code as possible in every key press. And everything that could be delayed, try to delay it by a few 100 milliseconds, or perhaps a couple seconds to make sure it only runs when the user has finished typing. That’s like a high level overview. Again, specifics really depends on the app. So, there could be better architectural solutions, but that’s what I would start with, or that would be what I look into first.

Drew McLellan: Because with every bit of JavaScript we add to an app, there’s a potential for it to get slower and slower and slower. Is there any way to claw that back? Is it possible for a React app to have like a perfect Lighthouse score, for example?

Ivan Akulov: Yeah. That was actually something. Yeah, getting back to the text, just one thing that I forgot to mention is that if there’s a single isolated component, which has performance of which is super critical and we can’t make it fast with reg, then one thing that I would perhaps try doing is making it work without React at all. So, making it work with direct DOM manipulation and plain JavaScript and stuff like that.

Ivan Akulov: The reason for that is that while React is great in terms of maintainability, like the reason we’ve switched from jQuery to React was that React allows us to write a code that’s much more maintainable, much easier to support. It’s also way easier to accidentally introduce major performance bottlenecks with React. You could accidentally render the whole app or you could accidentally have a component that renders fairly frequently it does some expensive stuff.

Ivan Akulov: If you switch to that specific component to plain JavaScript, then the chances of it accidentally getting slow would be way lower. Getting back to Lighthouse score, that’s actually the approach we’ve taken with the 3perf.com site. I ran from this consulting agency, and it has its own site. So, just really upgraded that site in Gatsby, simply because I wanted to try that stack and it seemed nice, so I did that. And it worked really well in general, apart from one thing, which is the Lighthouse score.

Ivan Akulov: I built this over to Gatsby and deployed to amplify and ensure that the site loads quickly or renders quickly. But the Lighthouse score was bad due to time-to-reactive and to the working time metrics. While the site was rendering quickly, it was loading a huge JavaScript bundle after that, and that JavaScript bundle was executing and taking a while to execute, taking a while to render the same page that the user is already seeing.

Ivan Akulov: One thing I did was I threw a weight of JavaScript that my site was using. In my case, that was fairly easy to do, because there was almost no JavaScript. There was only a few interactive elements, and I replaced them with inline scripts, and that worked great. I settled on the JavaScript. There are Gatsby plugins for that, like Gatsby plugin, no JavaScript. That was one of the most significant wins in terms of loading point. So, I think my Lighthouse score jumped from 60 something to 90 something thanks to this single case.

Ivan Akulov: Actually, I have a friend called Andrey Sitnik. He’s a front-end engineer. He’s fairly known in the Russian front-end community, and Andrei is known for the fact that he’s heavily advocated for using React less. Basically, whenever you open Twitter and whenever you see some conversation about React being slow, you could frequently see him mentioning that, "Hey, you don’t need React to this site at all, because this is a static site. Why are you using React here? Just use some good old web technologies and it will be way faster. Because you don’t need React on the client."

Ivan Akulov: I would say I agree with him. There are a lot of cases where React is convenient for development experience, and I would totally support using it for ... There are a lot of cases including static sites where React is convenient for development experience, but it doesn’t mean it needs to be served to the user. One thing that you could do is use React on the server. Use it to set template engine, basically, but don’t serve it to the client. If you can do that, then that would be one of the greatest loading performance things you can do.

Drew McLellan: So, your top tip for performance is to get rid of all the JavaScript?

Ivan Akulov: Top tip for the React, where you should get rid of React. Yes.

Drew McLellan: One of the things you hear with people adopting a framework like React is that it can be done for performance reasons. It’s much easier to build an asynchronous experience and get faster sort of perceived performance if you have a powerful framework managing your state, rather than relying on a server rendered page, for example, to compile a complete page all at once. You can load in a framework, and then asynchronously populate it.

Drew McLellan: On the other side, you have people who put out warnings that their experiences are that a big React app can be really slow and can be really harmful to performance. With all things, probably, it depends what you’re doing. But going into it, is there a way to judge whether your use is going to be good for performance or bad for performance?

Ivan Akulov: That’s a good question, to be honest. I haven’t heard of cases. That might be totally perhaps my view is skewed because I’m typically working with slow apps, not with fast apps. But I’d be honest, I haven’t heard of cases where people would be switching to React because it’s faster than the original approach to it. People are definitely switching because it’s more convenient to open twice, or because it’s easier to write maintainable codes, or because the ecosystem is larger, or something like that. But I have heard of cases of switching because it’s faster.

Ivan Akulov: Actually, the speed was a thing that was heavily promoted back when React was created, like the whole group, (?), etc, etc. But React, a few years after that mode was introduced, React ditched it, because they oriented themselves on the development experience. I’m not actually sure what they are into themselves with, but I remember that it was pretty concrete thing that they ditched that model because it was not what people were buying React for anymore.

Drew McLellan: Likely, React is always going to be a bit slower than the traditional, but it comes with lots of upsides as well in terms of developer experience and maintainable code.

Ivan Akulov: I think yes. Jeff Edwards has a great article that is called, Our Pit of Success, or something like that. And in the article, he mentions that programming languages and ecosystems have a term of a pit of success. For example, C++ has a pit of success, or a pit of despair of memory issues. Whenever you’re writing code in C++, it’s super easy to write some code that does some direct memory access, and they’re introducing some bugs, or vulnerabilities or whatever.

Ivan Akulov: You have to keep thinking, you have to constantly keep thinking to make sure you are not writing the code that introduces memory issue, that introduces memory bugs. I think the JavaScript, the single pit of success or a pit of despair. JavaScript and React system has a lot of benefits. Again, it’s maintainability, it’s everything we’ve talked about.

Ivan Akulov: I think a pit of despair that’s a trap that’s too easy to fall into, unless you’re actively thinking, and unless you’re actively preventing yourself from falling to it is making an app that slow either in terms of loading performance. Because it’s too easy to install some NPM dependency and import it into the bundle and sub it into 100 kilobytes or 185 kilobytes to a bundle. Or in terms of return performance, because it’s too easy to create a component that would render over time and run in way too many codes or whichever.

Drew McLellan: I came across your work first about a year ago when you posted a case study analyzing the performance of a Notion page. I think we all love Notion, and there’s probably not one person who doesn’t wish it was faster. don’t think this wasn’t paid work, was it? This was just an educational exercise?

Ivan Akulov: Yeah. Occasionally, when I have time to try to do case studies for some popular sites, I tremendously enjoy doing that. It’s also great educational material for whoever finds it useful.

Drew McLellan: And is that the sort of process that you follow when beginning an assessment of any sort of apps performance? Is the case study with Notion, does that follow the same sort of process that you would follow for anything?

Ivan Akulov: Yeah. The (?) process is that you identify an issue, you reproduce an issue locally. In case of Notion, it was the Notion page taken a while to load, and then you profile that with all the tools you have and try to find any low hanging fruits or not so low hanging fruits. Try to figure out how to cut off this fruit. So, that’s the high level review. There are a lot of specifics.

Drew McLellan: It was a very fascinating read, and I’ll put a link to that in the show notes so that people can go and look at it if they’ve not seen it. I saw that you mentioned that React 17 removed one of your favorite performance features last year. What was that about?

Ivan Akulov: React has went through a few generations of performance features. Like React 15, I think up to 15.5 had a built in powerful object which gave you way to measure the most expensive components or components that rendered unnecessarily. You could have written in the console something like perf dot ... I don’t remember the concrete guide. It was like measure something.

Ivan Akulov: Yeah, the idea was that, that was fairly convenient for detection, which components rendered unnecessarily. I see in which components rendered, but the resulting DOM tree was identical to the previous DOM tree. But then React removed that. I don’t know why. I wasn’t actively joining performance back then.

Ivan Akulov: React removed that. I think they also introduced React profiler back then. But also, at some point, they introduced a different API, which was user timing. The idea was that whenever you are running the development version of React and you are recording a performance trace with the Chrome DevTools performance tab. What React would do is it would measure, it would mark the beginning and the end of each components, when each component renders and when each component effects run, like componentDidMount, componentDidUpdate.

Ivan Akulov: So, it would measure the beginning and the end of each of these components, and it’s lifecycle hooks. And it would part put them into the performance recording using the user timing API. This was super convenient for debugging, because when you record a performance recording of a single render or whatever, and you open the main thread pane, and you look into it, what you would see is you would see a lot of wrecked internal code, like its fiber algorithm working on the components, calling array component.

Ivan Akulov: It would be super hard to identify where each component rendering starts, where each component rendering ends. But if you scroll a bit higher and open the user timing session that you would be able to see that straight ahead, and you would be able to match what’s happening in the user timing app scene, which component is rendering right here to what’s happened in the performance pane. If you see some expensive salary calculation of the performance pane, you would be able to just scroll a bit higher and see that, "Hey, this matches this specific component or this specific inode, componentDidMount virtually."

Ivan Akulov: So, this was super convenient for debugging, like particular performance issues. However, the problem with this was that for React developers, it was fairly hard to maintain. There was a GitHub discussion with the description, with the particular reasoning. What React ended up doing was they removed this API in React 17. Removed this future in React 17.

Ivan Akulov: So, right now in React 17, the only way to debug React performance is to use the React profiler. While this works great for a lot of things, there are a few use cases like seeing lifecycle hooks, which React profiler doesn’t measure or my chain. Figuring out why a specific component takes a while to render, which again, React profiler shows you that this specific components takes 30 or 300 milliseconds to render, but it doesn’t show why and to figure out why you have to switch back to the performance pane.

Ivan Akulov: So, with user timings, that was easy to match a specific component to what’s happening inside of that component, and without user timing, with just the React profiler that’s actually harder. It’s a pity it get removed.

Drew McLellan: How are things looking for the future of performance with React? Do you know of any features and changes that are coming that might help?

Ivan Akulov: Yeah. There are two things that I’m looking forward to. I think the one is the concurrent mode, which lets React prioritize some stuff over another stuff. I think the defer was happening of this screen. I haven’t been really following its development. I know that it’s mostly close to be released. It could take another year, perhaps, but it’s fairly close to getting released.

Ivan Akulov: Another thing is the recently introduced theme, which is React server components. That’s actually the thing I’m really looking forward to. So there are two areas where React apps may be slow. The one is the runtime performance, and the other is loading performance. And loading performance is not only about the huge bundle and etc, etc, which everyone is talking about. But it is also about the bundle execution, and more importantly, the React hydration process.

Ivan Akulov: So, whenever you have a React app that’s server-side rendered, and you serve that page to the client, and then a large React server act to that page, what React does is it gets through the hydration process. It gets all the DOM nodes that have been already ordered render. It reconstructs the virtual DOM tray, and it reattaches this ... Or resource the relationship between its virtual DOM and the actual DOM nodes.

Ivan Akulov: The problem with its process is that this is the single most expensive process during page loading. IF you’re loading a page, and that page runs a few chunks of JavaScript, then that chunk of JavaScript is going to be the most expensive. It could easily take a few 100 milliseconds, or like a second on slower device. This means that for the whole second of the whole few 100 milliseconds, the page would not responsive. So, if the user tries to scroll it or interact with it during that time, then the page could just not respond at all.

Ivan Akulov: Yeah, hydration is typically, one of the most expensive things, and it’s hard to optimize, because React needs to hydrate all these components. There are only a few things that you could do with it today. One thing is partial hydration, which is, if you have some pieces of the site or of the app that you don’t need to rehydrate, which can stay static, but you could write a bit of code around that and bailout these subarrays from rehydration. If these subarrays are typically expensive, then not rehydrating them would save you a lot of time. But this is actually hard to do nowadays. There are a few libraries for that, but this is not a popular approach. It’s hard to do. We could do that, but it typically requires writing your own code around the subarrays.

Ivan Akulov: What server rendered components are going to do is they are going to take partial hydration. They’re basically going to introduce partial hydration and a bunch of other benefits in the code. So, taking back that example that we’ve talked about earlier, like a static site, which loads a huge pile of markdown from the server, and then converts it to HTML during hydration.

Ivan Akulov: One way to avoid paying that cost is to turn that component that converts markdown into HTML into server rendered component and do this conversion on the server, and serve the concrete HTML to the client. Ad that will save you a few 100 milliseconds of the markdown, if the markdown blob is large.

Ivan Akulov: I’m really looking forward towards React server components. So, they are going to be great for a lot of reasons, but also particularly for making hydration less expensive.

Drew McLellan: That sounds really good. You’ve got a workshop coming up at the end of May with Smashing. And this being 2021, of course, it’s all online. It’s called the React performance masterclass. What sort of things would an attendee expect to learn?

Ivan Akulov: My goal with this workshop is to take a few apps, a few example of apps that have the same issues that I see in client apps over and over again and again, and to show attendees, to walk attendees through ... Actually, ask attendees to do the same optimization to their apps. But also to guide attendees and to walk attendees through my mindset, through my process, which I applied to solving to identifying and solving each of these specific problems.

Ivan Akulov: We’ll talk about issues like expensive renders, like when you have a component that takes a while to render, how to identify it, how to optimize it. We will talk about expensive effects like componentDidMount. If you use a glass component or if you use a functional component. We will talk about net server renders. What to do when you click a button and that causes the whole app to render, and that makes the app slow. We will talk about cascading renders when you’re scheduling a few renders in it all.

Ivan Akulov: We will also talk about hydration, and about operation, and what to do with expensive layout and stellar calculations, and how to identify them, how to fix them. That’s the problems I’m planning to show. Perhaps also something else if it fits. Well, we would also talk about bunch of solutions for that starting from partial hydration, which is for hydration going through ways to correct hooks and more advanced third-party libraries that help with optimizing net server renders and making the components render fast.

Ivan Akulov: We would walk through tools which help with detecting what specific color are rendered, white rendered. And we would also talk through solutions like virtualization or on the content visibility, CSS property, or other stuff. The CSS contained property, which is rarely used, and not really known trick, but it helps with performance optimization.

Ivan Akulov: We would also look at solutions like virtualization and content visibility. The content visibility, CSS property, and other stuff that helps with optimizing layout thrashing, optimizing expensive stellar calculations. That’s what I’m planning to talk about. But the primary focus would be on showing attendees the most common departments, the most common issues that happened, and specific ways to identify them, to profile them and to fix them. So, that’s my goal.

Drew McLellan: It sounds like that, yes, you’re going to equip attendees with everything they need to identify and fix their own performance problems, which sounds really great. So, I’ve been learning all about React performance today. What have you been learning about lately, Ivan?

Ivan Akulov: One experience that I’ve been having lately is ... I’ve been helping a client to optimize a large conflict point for their site. It’s actually not about React or performance of React. It wasn’t performance. They don’t use React at all. But the challenge is that we’ve done pretty much everything we could have done with their site like pretty much all the ...

Ivan Akulov: We’ve got pretty much all the low hanging fruits. We’ve optimized everything that makes sense. The page is actually so large that the browser renders eight in steps. It renders. It parses it in steps. It parses a few 100 lines, then it renders these few 100 lines, and it parses the next few 100 lines, and renders these few 100 lines. It renders the header fields. It renders some parts of the main content field. After that, then it renders another part of the main content.

Ivan Akulov: What this ends up doing is this chunk rendering and pushing to large conflict point way higher than I would expect it to be if the browser rendered everything in one go. I don’t see any typical reasons that they typically see in apps that would push that large conflict point higher.

Ivan Akulov: Anyway, what I’m doing right now is I am going deep into Chrome internals and trying to figure out what exactly it does when it’s rendering that page and why exactly the chunked rendering is happening and what we can do to make sure it doesn’t happen. To make sure the page renders in one go. Actually, there isn’t learning experience for me. I just hope I don’t need to compile from scratch.

Drew McLellan: Let’s hope so. If you, dear listener, would like to hear more from Ivan, you can find him on Twitter where he’s at @iamakulov. And his personal website is iamakulov.com. His agency, Perf Perf Perf, can be found on the web at 3perf.com. And if you like to find out more about Ivan’s workshop on React performance, you can find all the information at smashingconf.com. Thanks for joining us today, Ivan. Do you have any parting words?

Ivan Akulov: Take care, be fast, and enjoy your life.

Smashing Podcast Episode 37 With Adam Argyle: What Is VisBug?

In this episode, we’re talking about VisBug. What is it, and how is it different from the array of options already found in Chrome DevTools? Drew McLellan talks to its creator Adam Argyle to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a bright, passionate, punk engineer with an adoration for the web, who prefers using his skills for best in class UI and UX, and empowering those around him. He’s worked at small and large companies, and is currently a developer advocate working at Google on Chrome. He’s a member of the CSS working group and the creator of VisBug, a design debugging tool. So we know he knows his way around design and UX, but did you know he owns more pairs of flip flops than any living biped? My smashing friends, please welcome Adam Argyle.

Adam Argyle: Hello.

Drew: Hi Adam, how are you?

Adam: Oh, I am smashing, you know it.

Drew: That’s good to hear. So I wanted to talk to you today about your project, VisBug, and generally, about the concept behind design debugging and how it might fit into project workflows. I mean, we’ve had developer focused browser debugging tools for a long time, I mean, probably more than a decade now. But those are obviously very much focused on code. So what is different about VisBug? And what’s the sort of problem that it’s trying to solve?

Adam: Awesome. Yeah, the main problem that it’s rooted in is, as a front-end engineer I work with designers all the time, and I always loved this moment where we sat down and I’d be like, "Okay. I’m making the final touches. We’ve got another day or two until we deploy. So designer, sit down, and would you critique this? I want you to open up my local host version on your browser and on your phone, or whatever, and talk to me about what you see."

Adam: And after doing this for many years and always loving this interaction, I kind of started to feel guilty after a while because of how common and simple the tasks were. They’d be like, "One pixel down here. Five pixels margin here." And it was always nits and nudges, and nits and nudges to spacing and type. I mean, rarely was it like, "Ooh, hold on minute while I spend 30 minutes changing some angular, or whatever, to adjust my DOM so that the DOM can support your request," or whatever.

Adam: It was usually tiny stuff. And then I ended up making a survey, and I surveyed all these designers at Google. And I was like, "When you open up DevTools, what do you do?" And it kind of was resounding that they just need basics. And so it was born out of, I was like, "This should be easier. You shouldn’t have to pop the hood on the Ferrari, move a chunk of engine, just to change the color of the car seats. That’s not fair. You should just be able to touch the car’s seats and change the color, just like a design tool." I was like, "Something could facilitate this workflow." And I was like, "Okay, I guess I’ll hack on something to see if I can create the solution."

Adam: And that’s how it all started. It really started with spacing and then typography. And once I had a selection mechanism down that emulated design tools it was like, "Well what else can I do?" And it just kept going from there. But yeah, born in that moment.

Drew: So the idea is that the client asks you to make the logo bigger, and VisBug helps the browser behave more like a design tool for making those sorts of tweaks. So closer to something like Illustrator, or Photoshop, or Figma, or any of these types of things.

Adam: Yeah. That use case is a good one too. Because you could be a with a client and they say, "Oh, we love this," this is so classic, "we love the design, but that color blue is hard for us." And you’re like, "Really?" This is like, people can submit a form and you can make money, but you want to talk to me about blue right now? And usually it would create a whole cycle. The PM would go, "Okay, we’ll take down your request and then we’ll send it to design."

Adam: But if the designer’s there and it’s their browser that’s showing it they’d be like, "Okay. Well I’ll just click the thing and change the color." And you can nip an entire cycle of work by just prototyping the change there in the browser. So it is. It’s most effective against an existing product, right? Because it’s a debugging tool. It’s not necessarily a generation tool. It doesn’t create a site for you. It can, but it’s kind of awkward.

Drew: So technically it’s an extension that you install in a Chrome browser. Is that right?

Adam: Yep. And it’s an extension. When you launch it it downloads a JavaScript file that says, "Here’s a custom element called VisBug." And then you put the DOM element, vis-bug on the page. And poof, I just take that moment and turn it into a toolbar, and start to listen to events on the page. I listen to your hover events, and I listen to your click events. And I try to do my best to intercept them, and not compete with your main page.

Adam: But yeah, that’s the essence of... The only reason it’s an extension is just so it’s easy to put on your page. Although at this point it does have some settings now that come with you across browsers. But it’s still mostly, 99.9%, a custom element with no dependencies. I think I like a color library I use, and it’s otherwise just all vanilla. Yeah.

Drew: I guess that’s how Firebug sort of started out, wasn’t it? As a Firefox extension back in the day.

Adam: Yep. That’s why it’s called VisBug. It’s very much inspired by Firebug but for visual designers.

Drew: Ah. There we go. I mean, this isn’t perhaps the ideal format, being an audio podcast, to talk about a visual tool. But run us through, if you will, some of the sort of tools and the options that VisBug gives you.

Adam: Absolutely. So one of the first things that VisBug does, and you can also, if you are at home or at a computer, you can go to visbug.web.app, and try VisBug without the extension, right?

Drew: Ah.

Adam: It’s a web component, so I’ve loaded up a webpage for you here at visbug.web.app that looks like it’s got a whole bunch of art boards, and then of course, VisBug preloaded. And the goal of this site is to let you play, and explore, and delete. I think the delete key is one of the most satisfying tools to begin with. You’re like, "What can I do to a page?" And you’re like, "Well I can destroy it."

Adam: And I made it so that you can hold delete, it will find the next... Which is pretty difficult on a delete. You delete something and it selects the next sibling. So it’ll select the next sibling forever. If you hold delete until you delete the whole... Anyway, very satisfying. Hit refresh and it all comes back. But the first tool that VisBug ships with, so when you just launch it, is the guides tool. And I used to literally hold up paper to my screen, or I would go get a system extension that would allow me to sort of mark things and create lines.

Adam: Because, yeah, alignment becomes very optical at a certain point for a lot of designers, right? They don’t want, necessarily, mathematical alignment, right? This is why typography has optical kerning. It’s not math kerning. This is human kerning. And so the guides tool is rooted in that a lot of nits that happen from a designer are zooming in on stuff, checking alignment. Is the spacing good?

Adam: So that’s the second thing that the guides tool does. When you launch it and you just hover on stuff you’ll see the element that you’re hovered on gets a little box around it. And then dashed guides show up, just like rulers would normally do. And just like in Sketch and Zeplin where you sort of hover and you get these guides, it’s the same concept, just live on your page. And if you click something, and then hover to a new destination, you get measuring tools. And the measuring tools are in pixels, and they’re calculated... So visually, how many pixels are between it. Not what did someone say. It’s not adding up all the spacing, it’s just you click this thing and it’s this far away from that other box.

Adam: And I think that becomes really helpful, because you can hold shift and continue clicking, and essentially verify that you have equal spacing between five icons. And it’s just a couple of clicks. Don’t have to know code, just launch VisBug, hover, click, click, click, and you get to see that, "Oh look it is. Yeah. 15 pixels between each of these." Or sometimes you get something that’s kind of annoying, you’ll click in a box and then click its parent box and you’ll realize that its top distance is nine and the bottom one is eight. And you go, "How will I center this? It is somehow in between." And shakes fist.

Adam: But at least you’re able to see it nice and easily with the guides tool. So yeah, that’s the guides tool.

Drew: I’ve definitely been there, with holding up bits of paper to the screen. And also, the other trick that I would use is to open another browser window and use the edge of the window to align items. And then you sort of try and keep everything in the right place so that as you make code change and refresh it’s all still lining up. Yeah, not an ideal way of working, so.

Adam: Not an ideal way of working. Yep. And there’s the next... So, oh, and the first version of that was very loose. It didn’t snap, it just held up a crosshair, which is a feature that I’ll add back later. So some users are like, "Hey, I love the snapping, it’s just like my design tools. But what if I want a loose measurement? Or I want to do a letter, I want to measure a letter, not its letter box?" And so, well, this guides tool could very easily be changed to having a modifier key.

Adam: So here’s where VisBug gets a little kind of different, but also hopefully familiar, is it’s very heavy on hotkey modifiers. So just like if you watch a pro designer, they’re very much hotkey savvy. And they’re hitting hotkeys here, zooming in, hitting hotkeys over there, and just doing all their nudging from their keyboard. And so VisBug is very keyboard-centric in the way that you change things.

Adam: It’s also because VisBug allows multiple selections, and it can change 100 items’ spacing at the same time. And it does so relatively. So anyway, it has a couple interesting quirks, but the keyboard in a modifier concept is really important. And you can hold option, or shift, or command in a lot of the tools and get something different, or get a new sort of feature in there.

Drew: So it’s one of those tools where it really pays to learn the keyboard shortcuts.

Adam: It does. And so when you launch VisBug and you hover over one of the tool icons, you’ll get a breakdown. It throws out a little flyout menu, it says the hotkey for choosing this tool, and it tells you what it can do, and what interactions to do in order to get them. So the guides tool says, "Element guides, just hover. Measure something, click, and then hover something new. Sticky measurements are shift plus click so they’ll persist."

Adam: And these guides are really nice too for screenshotting. So if you’re reviewing a PR, even as just a front-end engineer, or maybe a designer reviewing a PR, this can be a really powerful way for you to get in there and, yeah, have some high fidelity inspection. Which kind of leads us into the next tool. Do you want to hear about the next tool?

Drew: Yeah, sure. Let’s go for it.

Adam: Awesome. The next one is the inspect tool. And this one is like... Designers usually, they don’t want all of the CSS, right? When they expect with... I almost said Firebug, but the Chrome DevTools, you get the full list, right? I selected this H1 and so here’s everything all the way back to the browser style sheet. And the designer’s like, "The browser what? The browser has a style sheet?"

Drew: Down at the murky bottom of that scrolling panel.

Adam: The murky bottom, right?

Drew: Yeah.

Adam: It’s like you peeled back all the layers and then you’re like, "Ooh, I don’t like these layers anymore." And the inspect tool here, it says, "Ah, designers, I know what you want. It’s just the border color." Basically, only show me something if it’s unique, so don’t just cover me with CSS properties. And I’m really mostly interested in color, typography, and spacing. So I’m going to look at margins, line heights, font family’s really important, right? There’s a whole extension just to tell you what the font family is on a page.

Adam: In VisBug that’s just a line item in the inspect tool. So you just launch VisBug, hit inspect, and hover on any typography and it’ll tell you the font family. So yeah, it tries to make a designer focused in what it surfaces, yeah.

Drew: So that tool is not showing any inherited styles. Is that right?

Adam: That is correct. Unless they are inherited and unique. So if they... A text color or something, if the text color isn’t literally the word inherit, it will tell you that it’s a computed value, that it’s something interesting.

Drew: Yeah, that’s a really useful just... Yes. Helps you focus on the things that are just literally applying to that one instance of something, which is obviously what you wanted to change. I mean, I guess this could be really useful, all these tools would be really useful in, sort of as you mentioned, getting stakeholder feedback. And sort of working interactively with a client.

Drew: I guess it would work equally well over screen sharing, as we have to do these days, more and more. You don’t have to be sat at a computer with someone, you could be sat on the other end of a call and share your browser and do it that way. I guess it’d be quite an effective way of getting feedback when a client can’t point at the screen and say-

Adam: Definitely.

Adam: It’s always magical when you turn the live webpage into what looks like a Zeplin artboard. Someone’s like, "What... Did we just go somewhere new?" And you’re like, "No, this is your product. We’re just interacting with it very visually." Yeah, it can be really nice.

Drew: Are there any other interesting use cases that you’ve seen VisBug put to or that have occurred to you might be interesting?

Adam: Yeah. So, yeah, there’s so many it’s kind of hard to start. Oh, one that’s important is developer to developer communication. VisBug works on the calculated values. So it doesn’t look at your authored values. And that can be really nice, because you’re sort of measuring and inspecting the absolute end result into the way that the pixels got calculated on the screen. And that can be really nice, to have a conversation that way, as you’re working on the results, as opposed to the authoring side.

Adam: And you can go back towards like, "Okay, well how did we go wrong in the authoring side if this is what we got visually?" Which also kind of plays into, the next tool is the accessibility inspect tool. So the inspect tool makes it easy just to see the styles on an element, and it breaks them down in a very designer-friendly way. The accessibility tool helps you inspect all of the elements on a page, and it surfaces any accessible properties it has, which makes it, I’m hoping, easier to go verify that something is done.

Adam: So a PR... And things often get created. So this is, again, developer to developer, designer developer, you’re reviewing interfaces. It’s just so critical. If you’re looking at an interface and you’re curious, VisBug has a use case for you there. There’s also use cases where you can sort of prototype in the browser. So we talked about one where it’s like, the client wanted to try blue. Okay, that’s a pretty easy scenario.

Adam: But there’s other ones too. If you hit command D on VisBug you’ll duplicate an element. And it doesn’t care what you’re duplicating. So you could duplicate a header, go add some spacing between the two headers, and go make a variant live in the browser. You double click the header text and it becomes an editable text field, and you go try a new headline out and go see how the headline fits. Go adjust some spacing and you just saved yourself all this developer work, finding a source file and all that sort of stuff, and you’re just...

Adam: So yeah, it can help you explore and verify. It’s kind of a weird... I mean, it’s a lot of the things DevTools does, right? It comes in after you’re done, it doesn’t actually give you source code very often, it’s not very often that you copy code out of DevTools. You might copy a key value pair. Like, "Oh, I changed this style." But yeah, anyway.

Drew: Mm-hmm (affirmative). Yeah. I can think of sort of particularly visual cases where you might want to, you mentioned, duplicating items. You might want to take a whole section of the page and duplicate it to simulate what it would be like if there was a lot more content than you were expecting.

Adam: Yes. That’s the chaos testing use case.

Drew: Yeah.

Adam: Absolutely.

Drew: Which is something that we all have to deal with, designing with sort of CMS-based systems and all those sorts of fun tasks.

Adam: Yep, that’s a really crucial use case too. Because I do that one for... Yeah, headlines, like I said. You just double click some text and I just go slam the keyboard. Blah, blah, blah, blah, and hit a bunch of spaces, blah, blah. And I’m like, "Okay, how’d the layout do? Oh, it did good. Okay, good, I can move on to the next thing. What happens if I duplicate this four times? Is there still space between everything? Does it flow next to the next item?"

Adam: It can be really nice for that simulation of the, yeah, content chaos. Really short title, really long titles, has no friends, has a million friends. How do you handle these use cases in the UI? Yep.

Drew: So it works with any browser-based content. So PWAs as well as regular webpages?

Adam: Yes, it does. So if you have Spotify installed, I do this all the time, I’ve got Spotify installed and I’ll just be like, "Spotify, you look like you’re an impossible app to inspect." But guess what? VisBug don’t care. VisBug overlays all your stuff, inspects all the typography. I made a light theme for... Oh, I have a tweet somewhere where I made a light theme of Spotify.

Adam: Oh, this was another use case, sorry, for prototyping color. I can create a light theme on the product itself without having to go mess with a bunch of sticker sheets, right? So there’s this important even mentality, I’d love VisBug to help folks get into which is, use your product as a playground. Use that as... It’s so real. It’s more real than your design comps are. So spend some more time in there. I think you’ll find that you can make more effective design decisions working on your actual product.

Drew: And the case of accessibility as well is particularly interesting, because often, particularly these days, we’re working very much in component libraries, and looking at small components of a page. And spending less time looking at all those integrated together to create the sort of views that a customer actually interacts with. And it gets really difficult to keep an eye on those sort of finer details like accessibility things, attributes, that aren’t visible on the page.

Drew: It’s very difficult to keep an eye on things that aren’t visible. So this is where tooling can really, really help to be able to inspect something and see that, yes, it’s got the correct roles on it and it’s-

Adam: It does. That’s the exact use case. I want a PM to be able to go verify this stuff. I want a designer to be able to go look at accessibility and not have to pop open the tools, find the DOM node, it’s all crunched up in the elements panel and looking weird. That it just says, "Here’s the area attributes, here’s the title if it exists." There’s also some other accessibility tools to. VisBug ships with the search icon. The search icon has multiple ways to interact with it.

Adam: So first it queries the page. So if you know the element type or the element class name that you want you can just search it, so you don’t have to find it with the mouse. But that also has slash commands in it. So there’s plugins in VisBug, and they’ll execute scripts on the page. So if you’ve ever had a bookmark that you’ve saved three or four... You’re like, "I’m going to use this one because it highlights all the borders and shows me my boxes." It’s like a debug trick or something.

Adam: It’s probably a VisBug plugin. So you launch VisBug, hit slash, and you’ll get autocomplete, and it’ll show you all the different plugins. And there’s some accessibility ones that are really nice that overlay errors, and various things like that. So I agree. Accessibility should be more accessible. That’s just lame to say. But it needs to be closer to the tool belt. And I think sometimes it’s too far away, and maybe that’s why it gets missed. So I’m hoping if it’s a little more up front, and center, and easier that it gets checked more. Yeah.

Drew: And it’s interesting you say that VisBug works with the sort of computed values of things, so like colors. So does that mean that if you have several layered elements that have different levels of opacity that you’d be able to measure the exact color that is being rendered on the screen rather than-

Adam: Ooh.

Drew: ... looking at the individual elements and trying to somehow work it out?

Adam: That’s a really good question. So I think, if I’m understanding the question right, which this is a classic difficulty in the front-end is, yeah, how do you know if you have a half opaque text word, what is its color over gray versus over white? And how do you know its contrast? Right now, we don’t know. So VisBug knows the color, and it’ll say, "50% gray," or whatever the color is that you have there. But it doesn’t know anything smarter than that. It’s not able to...

Adam: I think what you’d have to do in that case is create a canvas, paint all the layers on there, and then use an eyedropper or a... So you’d render it in canvas, make them all smashed together into a single painted layer, and then go pluck the single pixel value out to see what its actual end computed gray is after it’s been layered on the other stuff.

Adam: I think someone specced it, or maybe I have it as a GitHub issue that it would be nice. Because VisBug could facilitate this, 100%. VisBug, behind the scenes, I’ve already done with text metrics, where you hover on things and it gives you crazy rad information about the fonts. It’s almost too much info, like x height, and cap height, but it goes even more. And it’s like, "Ooh, I’m kind of turned off at a certain point." So I have to figure out how to find the signal versus noise there.

Adam: But yeah, I like this thought process, because we should have a tool that does that. And if we know how to compute it, we can teach VisBug to do it, and that would be a really cool feature to have, opacity relevant calculated color. Love it.

Drew: Yeah, I mean, it’s the sort of standard case of having text against a background where you’re not sure if the contrast is enough to pass the accessibility requirements. And perhaps it’s not, perhaps it’s too low contrast and you want to then tweak the values until you get it just to the point where the contrast is good, but it’s not drifted too far away from what the client initially wanted in terms of brand colors and things.

Adam: I call that bump, bump until you pass.

Drew: Yeah.

Adam: Because that’s what it feels like. I’m like, "Ooh, I’m a little short on the score." So it’s like, I’ll go to my HSL lightness and I’ll just bump, bump, bump, and watch the little numbers tick up until it’s like, "Ding," I got a green check mark. I’m like, "Okay, cool." And yeah, sometimes, some of that color is not cool. So, have you studied much of the 3.0 perceptual accessibility work that’s going on? So that we’ll no longer have AA or AAA, we’ll have on number and it includes things like font thinness. So if it’s a thin font it will get a lower score, if it’s a thick font it goes... Because there’s a lot that goes into contrast.

Drew: Yeah, no, I hadn’t seen any of that, but that sounds-

Adam: Anyway, it’s a really cool thing to explore.

Drew: That sounds fascinating, yes. I’ll have to find someone to talk to about that. That’s another episode. So, I mean, I’m sure some developers might argue that everything that VisBug is doing you can just do through the CSS panel in DevTools. And I think that’s sort of fair but probably misses the point, in that, yes, you are manipulating CSS when you’re making changes, but it’s putting a sort of designer-focused user interface on top rather than a developer-focused interface. Is that a fair characterization of it?

Adam: That’s a really fair one. And honestly, the best ideas graduate out of VisBug into DevTools. And they already have. So VisBug, if you hit command option C on any element it takes every computed style, at least that’s unique. Again, so it’s like, we’ll do ones that we’re not just going to give you all these inherited properties. But puts them all on your clipboard, and you can go paste that style somewhere else, in a style sheet, in a CodePen, and literally recreate the element in a couple clicks.

Adam: And those sort of interactions have made their way into DevTools, into that elements panel. There’s other things, though, that haven’t, which is, the DevTools is a single node inspection only tool. And VisBug follows the design tool mantra which is, no, I should be able to multiselect. I need to be able to bulk edit, bulk inspect. And so I use VisBug all the time for spacing. Because I can highlight multiple elements and see margin collapsing.

Adam: In DevTools you can’t ever see it, because you can only see one node at a time most of the time, although there’s way to show multiple margins, but it’s not the same. And so, yeah, it has these niche use cases that can be really fun like that. Another one is, if you highlight a... Let’s say you have a typography system and you have H1 through H7, like in a storybook or something like that, you can highlight all of them in VisBug, hold shift, just click all of them. Boop, boop, boop, boop, go to the typography tool and hit up or down, and it makes a relative change to each of them.

Adam: So each of them will nudge up one or down one. And that’s just not something that DevTools makes very easy. And so, yeah, it has some superpowers like that, because it’s a little more agnostic. And it’s prepared to always iterate on an array. Yeah.

Drew: So what was the origin of VisBug? And now is it just a personal project? Or is it a Google project? Or what’s the status of it?

Adam: Yeah. So first, status is, it is a Google project. Its primary goal is to be a place to prototype and explore before things go into DevTools. At least from the Google side of things. But from my personal side of things I still see it as a place to go bake in the common tasks, or to bake in some optimizations to get through common tasks. And just to give a wider audience a way to look into the DOM.

Adam: I really think that the DevTools is super powerful, but it’s very intimidating. Just one tab in it can take a career to learn. I’m still learning things in DevTools, and I use them all the time. And so yeah, this is kind of a different audience in some ways. It’s more of the beginners, the folks coming in, or maybe even folks like PMs, managers, that don’t ever intend to code but are interested in the output. And so it kind of gives them, yeah, just light tooling to get into there.

Drew: It’s an interesting point you bring up, because I personally often find that I struggle to find a comfortable workflow in managing all these sort of DevTools. And you’ve got all these little claustrophobic panels, and you can detach them into another window, but then you’re having to keep track of two different windows. And once you’ve got a few browser windows open you can’t... You focus one and you don’t know which DevTools belongs to it.

Drew: And then within the panels themselves, it’s kind of a sort of a bit of a Wild West of user interface conventions. You’ll scroll and things’ll start doing strange things that you didn’t expect. And in terms of user experience I feel like it’s all just a big mess.

Adam: It is. Yeah.

Drew: Do you think that’s unavoidable? Can it be better?

Adam: I definitely have thoughts here. And yeah, I think a good... So let’s say you have a listener right now that’s like, "I’m pretty savvy with the DevTools. I don’t think they’re that crazy." I’d say, "Okay, go open up Android Studio or Xcode. Begin a project, and go look at the DevTools, go look at the output. How familiar do you feel right now?" Probably very foreign. You’re looking at that going, "This is garbage. Why do they do this? Why is this panel over here?" And your mind starts to race with all these questions why and confusion.

Adam: And it’s like, well that’s how everyone feels the first time they open DevTools. So you got to really kind of be empathetic to that.

Drew: Is it inevitable that... Can we do better? Or is this just the sort of natural order of things?

Adam: So here’s my current take on this, is I think complexity is really easy to find yourself getting into. And DevTools is one of those things, they’re just naturally complex. There’s no good UI to facilitate a lot of these things. A lot of these things get built by devs. And I think devs building tools for devs is fine, because you’re going to have... If it’s the only way, or if it’s even if it’s a good way, you’re going to learn it, and you’ll get good at it, and you’ll get comfy with it.

Adam: And all DevTools are kind of weird, because they’re made for their weird use cases, right? Development is weird. Let’s just be honest. We make invisible cogs and invisible two by fours, and we build houses, basically, with invisible, virtual parts. So yeah, we need weird tools to go inspect these things, and to tell us what they’re outputting.

Adam: Now, that being said, what VisBug does, and what I’ve been kind of slowly moving things into DevTools as, is smaller tools that are more focused as opposed to a big tool that claims to do a lot. I think it’s hard for things to do a lot really well. And this is classic argument, right? This is all stars, specialists versus generalists. Neither are always going to be perfect.

Adam: But what VisBug is trying to do is, it has made specialists. So the guides tool just does guides. And that tool never leak into the other tools of the page. And so I’m trying to do that more with DevTools, where DevTools wants to help designers more, which is something VisBug has helped inspire DevTools to see. And the way that I keep introducing things is, instead of making a grid editor, for example, where you can... "Full power of grid in one overlay," right? "You can add tracks, remove tracks, blah, blah, blah."

Adam: And I’m like, "That sounds really cool and also really complex." I’m like, "Grid is crazy, there’s no way we’re going to build a GUI for that." So I’m like, "Why don’t we just handle grid template columns first, and the ability to manage the tracks in there, almost like they’re chips? What if we could just add, and edit, and delete them?" They’re much more physical and less of string. I’m like, "Well what we’ve done is, we’ve created a micro-experience that solves one problem really well and then doesn’t leak anywhere else, and it’s also really naïve. It’s a naïve tool."

Adam: So and a good example of that is the angel tool in DevTools. Have you seen that tool yet?

Drew: No, I haven’t.

Adam: Any angle... So this is, I’m calling these type components. So their CSS is typed, and the angle is a type, and many CSS properties will take a type value of angle. And what I was like... Well, angles, those are just a wheel like a clock. Why don’t we give someone a GUI so that if they click an angle they can change an angle and snap it to 45, snap it to 90, there’s common interactions with just this unit of angle.

Adam: And we made a tool for it. And it’s super cool. It looks great, the interaction is great, keyboard accessible the whole nine, and that’s an example where I think you can make small focused things that have big impact, but don’t necessarily solve some big problem. And yeah, you’ll have another tool like Webflow that’s trying to create entire design tool and facilitate all your CSS.

Adam: So, yeah, I don’t know the right answer, but I do know that an approachability factor comes in when things do less. And so it just kind of makes it a little easier. Like VisBug, you might only know three tools on it. You only use the guides, the margin tool, and then the accessibility inspect tool. Maybe you never use the move tool or the opposition tool. Just, yeah.

Drew: I mean, talking of design tools, we’ve seen a big rise in the last few years of tools. Things like Figma, which are great for originating new design work in the browser. Is there overlap there with what Figma is doing and what VisBug is trying to do?

Adam: There’s definitely overlap. I think they come at it from different directions. One of the things that I’m frustrated with Figma at is not something that VisBug could solve. And I think that design these days, even with the powerful tools and the Flexbox-like layouts that we have, I still think we start wrong when we draw a box on a canvas of a certain size. I’m like, "Sorry, that’s just not the web. You’re already not webby."

Adam: Nothing is very content-focused. If I just drop a paragraph into Figma, it gives it some default styles and I’m like, "Why doesn’t it do what the web does? Put it in one big long line." You’re like, "Contain it somehow," right? And so I don’t know. I think that Figma is empowering people to be expressive, limitless... What is the phrase I like to use? Yeah, okay, it’s expression-centric. That’s where I think VisBug and a lot of debug tooling is...

Adam: So yeah, one is empowering expression, and the other one is empowering inspection and augmentation. You need both, I think. I think that in one cycle of a product you’re in full expression. You need to not have any limiters. You need it to feel free, create something exciting, something unique. But then as your product evolves and as more teammates get added, and just the thing grows and solidifies, you’ll exit a phase of expression and into a phase of maintenance, and augmentation, and editing.

Adam: At which point your Figma files do two things, they get crusty, because your product is more... Well, it’s real. Your product has made changes, and design decisions, because it’s now in the medium. And so your file starts to look crusty. And then your file also just is constantly chasing production. And that’s just a pain in the butt. And so VisBug is sort of waiting. So in the expression phase VisBug’s like, "I can’t help you very much. I’m just sort of, I’m not that powerful at expression."

Adam: But then as you have a real product you can inspect it. And yeah, it can inspect anything. It has no limits. It goes into shadow DOM and everything. So yeah, I think they’re just different mentalities for different phases of products, yeah.

Drew: So in VisBug if you have made a whole lot of changes, maybe you’re sat with a client and you’ve tweaked some spacing, and you’ve changed some colors, and you’ve got it looking exactly how the client wants, they’re happy. They obviously now think that all the work has been done.

Adam: It’s done.

Drew: Which of course, it’s not. We understand that. But what is the path? What is the developer journey from that point to... I mean, I presume that it’s not practical to save or export, because there’s no way to map what you’re doing in the browser with those source files that originated that look. But what’s the journey? How do you save, or export, or is it, I guess, taking a screenshot? Or what do you do?

Adam: Yeah, there’s a couple paths here. And I want to reflect quickly on what we do in DevTools. So let’s say, DevTools, we made a bunch of changes, there is the changes tab in DevTools, I don’t think very many people know about it, which will surface your source file changes, and some other changes in there that you could go copy paste.

Adam: And yeah, this becomes a hard thing with all these tools that are editing code output, they don’t have any knowledge of source or authoring files. I mean, maybe they have source maps, but I think that’s a really interesting future. If we get to something where the calculated output could be mapped all the way back to the uncompiled source, that’d be really cool. But until then, VisBug does do similar to what you do in DevTools. Where you just copy paste the sort of pieces.

Adam: But I will share some fun ways to sort of make it even better. So one thing, let’s say you made a header change, color change, and a change over here. You can go to the inspect tool, and when you hover on something it will show you a delta. It’ll say, "Local modifications." And if you hold shift you can create multiple sticky pinned inspections. And so you’ll go to your header, you’ll click it, you’ll hold shift, click your other little box, and hold shift to click another little box. And now you have tool tips showing what you changed over the actual items in the page, take a screenshot, and ship it to a dev.

Adam: And they can sort of say, "Okay, I see you changed margin top to 20 pixels. I don’t use pixels or margin top in my CSS. So I’ll go ahead and change to margin block start two RAM, thank you and bye bye." And that’s kind of nice, is that the editor didn’t have to care or know about the system details, they just got to say something visually and screenshot it. So that workflow is nice. It’s pretty hands off and creates a static asset which is fine for a lot of changes.

Adam: But if you had a lot of changes and you really changed the page and you wanted to save it, there is another extension called... Let’s see. Page, single file. Single file will download the entire current page as a single file HTML element, at which point you could drag that right into Netlify and get yourself a hosted version of your prototype.

Adam: Because what VisBug does is, it writes its styles in line on the DOM notes themself. So save file comes with it all. And I’ve got a tweet where I went to GitHub and I made... I just totally tweaked the whole site, and it looked cool. And I was like, "All right, save file." And I saved it, opened it up in a new tab, just dragged it into the new tab and I was like, "Well this is really cool." Because VisBug’s been wanting a feature like this for a while. But it’s a whole other extension’s responsibility, is taking those third party assets, dealing with all the in line... And anyway, so it’s really nice that that exists.

Adam: And so you can deliver a file, if you want to, or host it somewhere, and share multiple links to multiple versions of production. You modified production and then shipped it into netlify, and someone can go inspect it, and it’s still responsive at that point too, right? At that point it’s not a static comp you’re sharing, it’s still the live, responsive... Anyway, it’s exciting. I mean, there’s a future here that’s, I think, really, really interesting and not far away.

Adam: It’s just like we’re a little still stuck, as designers, in our expression land. We’re just too happy expressing. And we’re dipping our toes into design systems, but even those I think are starting to get a little heavy for designers. And they’re like, "Ooh, maybe it’s too much system now." And like, "Ugh, I’m getting turned off. I liked making pretty stuff. And it’s a whole new job if you’re doing design ops," or whatever. So...

Drew: I like the fact that VisBug takes an approach of not being another DevTools panel, because the interface, it embeds a toolbar on top of your page just like a design toolbar. I guess that was a deliberate move to make it more familiar to people who are familiar with design tools.

Adam: Yep. If you’ve used Paint or Photoshop, they all come that way. And so it was the sort universal thing, that if I put a toolbar on the left that floated over your content, almost everyone’s going to be like, "Well I’ll go hover on these and see what my options are. And here’s my tools. And I get to go play." And it made a really nice, seamless interaction there. I do have a really exciting almost finished enhancement to this.

Adam: So, it’s so cool to me, but I don’t know if everyone else is going to be as excited. And this’ll be a mode that you can change in your extension settings, is how do you want to overlay the page? Because right now VisBug puts a toolbar right on the browser page, which the page is rendered normal, and I know this is going to be weird to say that, but okay, so you scroll the page, and the content, and the body is width to width in the browser, right? So it’s filling the little viewport.

Adam: I have a mod where, when you launch VisBug it takes the whole HTML document and shrinks it into an artboard. It looks like an artboard. It’s floating on a shadow on a gray space. You can infinitely pan around it. So you can scroll away from your page canvas, and what it lets you do is, see, let’s say you have a page that’s really long, and you want to measure something from the top to the bottom, well you can do that right now, but you’d kind of lose context as you go.

Adam: Well in this new VisBug zoom scenario, you hold option or alt on your keyboard, you use the mouse wheel, or you hit plus minus with your command and you can zoom your webpage as if it’s an artboard. And I try to make it as seamless as it is. So you’re going in and out, and you scroll down, you go in and out, measure from the... And VisBug just doesn’t care. It keeps drawing computed overlays, you can change spacing.

Adam: Because I think it’s really important, as a designer to see the bird’s eye of your page live. Animations are still playing, y’all. Scrollable areas are still scrollable, right? It’s really cool. You’re like, "My whole page in one view." Anyway, so it’s almost done. It’s in-

Drew: Sounds trippy.

Adam: It’s very trippy. And it’s in, I just need to make sure it works cross browser, because it’s doing some, obviously, some tricky things to make your live page feel that way. But yeah.

Drew: Amazing. Is it... I mean, I presume that VisBug is fairly regularly updated and is being progressed. What is it that we might expect to see in the future?

Adam: Yep, that’s definitely one of the features I’m working on there. I have a feature where... So, when you click something you get an overlay with what looks like handles, right? And it’s sort of an illusion, it’s supposed to make you feel comfortable. And the intent is to eventually have those handles be draggable. But I have some fundamental things I have to solve first, like elements in the browser don’t have a width. So if you just start grabbing the width I have to do work to make that illusion feel right.

Adam: And you might not even get the results you want, because it could be a block level element that you’re pulling the width smaller, and you’re not getting reflow of an item next to it. And you might be wondering why. So I have prototypes where you can drag corners, drag elements around. But I really need to focus on how the design tools are doing this. They always have this toggle button. And it’s like... See, what’s the toggle called?

Adam: But it’s basically like shrink... I call it shrink wrap. Shrink wrap my element, it’s the width of this element is the width of its content, versus here’s the width of my element, stick something in it. So I need something like that in the browser, overlayed on the element so that you could choose between these and maybe even something that let’s you choose between block and inline, so that you could get the results that you want.

Adam: But ultimately the goal here is that VisBug does not want to be entirely keyboard-driven. I want you to be able to drag spacing. If you see 12 margin spacing on top, you should be able to reach in and grab it, whereas right now you have to hit up on the keyboard to specify the top side of the box needs an addition of margin.

Adam: And so yeah, I have a couple of quirks to work out, in terms of strategy. But it’s very much a goal to make it even closer to design tools. And maybe even I will bend in that. It’s like, well, if you want to change the width and you’re going to get a weird design, there’s always ways to get out of it with VisBug, like the position tool really lets you escape the flow. So flow is ruining your idea, the position tool lets you escape.

Adam: And so there’s... If someone was to get really savvy with VisBug they would blow people’s minds, because it’s sort of unlimited, and it’s like, what can you bring to the table? It has an expression element to it. There is definitely expressive tactics. But anyway, so long story short is, the illusion is, I just want to make it smaller and smaller and smaller. I want the illusion to just be like, "Wow, I’m really feeling like a design tool."

Adam: And then, yeah, some enhancements to exporting would be nice. But also, enhancement to exporting for DevTools would be nice, and that doesn’t really stop us. So I don’t know. There’s a ton of issues, definitely go vote on them. I think one of the next big features I’d love to do is green lines. So instead of just showing accessibility overlays on hover to really indicate some things with green lines, and expose more, and surface more information, and I don’t know. Yeah.

Drew: Sort of thinking about the process of building a Chrome extension like this, I mean, presuming it’s all implemented in JavaScript, how much like regular web development is it? Building a Chrome extension.

Adam: That’s good question. It’s... Phew, this is hard one. It’s quirky. First off, the environment that you get to launch your code in isn’t the browser. They don’t really give you full access there. You can, if you really get tricky with it, which VisBug had to graduate into, this even trickier scenario. So right now, I used to execute in the... This is going to get so fuzzy so fast.

Adam: Because there’s multiple sandboxes for your extension, for privacy issues. And they make it hard to execute scripts on the actual page, right? Because you don’t want someone submitting your form when you launch the thing or something, submitting it to themselves or whatever. It could be really destructive. So it has some quirks like that. There’s a bridge you have to pass over. And one of them that’s been plaguing VisBug is, VisBug used to use...

Adam: So it’s all custom elements, and custom elements allow you to pass rich data to them as property. So you’re saying like, customelement.foo=myrichobject, full of arrays or whatever. And the custom element just gets that as some data on the node itself. But since I’m in this weird little sandbox world, if I try to set something unique like that on my object, essentially it’s filtered out. They’ve established that certain things can’t... So I can pass a string to my custom element, but I can’t pass it a rich object.

Adam: But yeah, other than little quirks like that, once you get the flow down, and if you spend the time to get a rollup scenario, which is going to be an hour or so of work so that you give LiveReload in your thing, it can become pretty natural. I think Firefox has, honestly, the best extension development experience if you’re savvy with the CLI you can spin something up with one command, and it installs it, gives you these LiveReload features, and gives you debugging tools. It kind of holds your hand through it, it can be really nice.

Adam: But ultimately, it’s a little quirky. That’s why I do a lot of the work on that demo site that looks like a bunch of artboards, because I don’t really need a real webpage most of the time, to do VisBug testing, as long as I’ve got artboards that simulate various issues, or have accessible things to look at, and sort of give me the content I need to see. I do a lot of the work right there in the browser as if it’s just a normal web application. So VisBug’s dev experience is really easy, unless you’re trying to test it across browser, and then it just gets kind of messy and whatever.

Drew: That’s really interesting insights. So I’ve been learning all about VisBug today, what have you been learning about lately, Adam?

Adam: I am still improving my wok skills. So I want to be a wok man, and I’m not talking the ’90s cassette player. I’m want to flip veggies and have them kind of catch fire a little bit in the air, cover them with some delicious spices, and just really sear up that garlic and make it crispy delicious. And then put it on a little bed of rice and slide it towards you and see what you think.

Adam: So I’m excited for summer right now, because that means I get to whip out the wok and get back into that fast-paced, hot cooking environment, and it’s really fun.

Drew: Amazing. That sounds delicious. If you, dear listener, would like to hear more from Adam you can follow him on Twitter where he’s @argyleinc, and find his personal website at nerdy.dev. If you want to give VisBug a try, you can find it in the Chrome Web Store, and you can try out the sandbox version at visbug.web.app. Thanks for joining us today Adam. Did you have any parting words.

Adam: No, you were really nice. This was really sweet. Thanks for having me on, I really appreciate it.

Smashing Podcast Episode 36 With Miriam Suzanne: What Is The Future Of CSS?

In this episode, we’re starting our new season of the Smashing Podcast with a look at the future of CSS. What new specs will be landing in browsers soon? Drew McLellan talks to expert Miriam Suzanne to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: She’s an artist, activist, teacher and web developer. She’s a co-founder of OddBird, a provider of custom web applications, developer tools, and training. She’s also an invited expert to the CSS Working Group and a regular public speaker and author sharing her expertise with audiences around the world. We know she knows CSS both backwards and forwards, but did you know she once won an egg and spoon race by taking advantage of a loophole involving macaroni? My smashing friends, please welcome Miriam Suzanne. Hi, Miriam. How are you?

Miriam Suzanne: I’m smashing, thank you.

Drew: That’s good to hear. I wanted to talk to you today about some of the exciting new stuff that’s coming our way in CSS. It feels like there’s been a bit of an acceleration over the last five years of new features making their way into CSS and a much more open and collaborative approach from the W3C with some real independent specialists like yourself, Rachel Andrew, Lea Verou and others contributing to the working group as invited experts. Does it feel like CSS is moving forward rapidly or does it still feel horribly slow from the inside?

Miriam: Oh, it’s both, I think. It is moving quite fast and quite fast is still sometimes very slow because there’s just so many considerations. It’s hard to really land something everywhere very quickly.

Drew: It must feel like there’s an awful lot of work happening on all sorts of different things and each of them edging forward very, very slowly, but when you look at the cumulative effect, there’s quite a lot going on.

Miriam: Yeah, exactly, and I feel like I don’t know what kicked off that change several years ago, whether it was grid and flexbox really kicked up interest in what CSS could be, I think, and there’s just been so much happening. But it’s interesting watching all the discussions and watching the specs. They all refer to each other. CSS is very tied together. You can’t add one feature without impacting every other feature and so all of these conversations have to keep in mind all of the other conversations that are happening. It’s really a web to try to understand how everything impacts everything else.

Drew: It feels like the working group very much always looking at what current practice is and seeing what holes people are trying to patch, what problems they’re trying to fix, often with JavaScript, and making a big messy ball of JavaScript. Is that something that’s a conscious effort or does it just naturally occur?

Miriam: I would say it’s very conscious. There’s also a conscious attempt to then step back from the ideas and say, "Okay, this is how we’ve solved them in JavaScript or using hacks, workarounds, whatever." We could just pave that cow path, but maybe there’s a better way to solve it once it’s native to CSS and so you see changes to things like variables. When they move from preprocessors like Sass and Less to CSS, they become something new. And that’s not always the case, sometimes the transition is pretty seamless, it’s more just take what’s already been designed and make it native. But there’s a conscious effort to think through that and consider the implications.

Drew: Yeah, sometimes a small workaround is hiding quite a big idea that could be more useful in itself.

Miriam: And often, hiding overlapped ideas. I was just reading through a lot of the issues around grid today because I’ve been working on responsive components, things like that, and I was like, "Okay, what’s happening in the grid space with this?" And there’s so many proposals that mix and overlap in really interesting ways. It can be hard to separate them out and say, "Okay, should we solve these problems individually or do we solve them as grouped use cases? How exactly should that be approached?"

Drew: I guess that can be, from the outside, that might seem like a frustrating lack of progress when you say, "Why can’t this feature be implemented?" It’s because when you look at that feature, it explodes into something much bigger that’s much harder to solve.

Miriam: Exactly.

Drew: Hopefully, solving the bigger problem makes all sorts of other things possible. I spent a lot of my career in a position where we were just sort of clamoring for something, anything, new to be added to CSS. I’m sure that’s familiar to you as well. It now seems like it’s almost hard to keep track of everything that’s new because there’s new things coming out all the time. Do you have any advice for working front-enders of how they can keep track of all the new arrivals in CSS? Are there good resources or things they should be paying attention to?

Miriam: Yeah, there are great resources if you really want a curated, a sense of what you should be watching. But that’s Smashing Magazine, CSS-Tricks, all of the common blogs and then various people on Twitter. Browser implementers as well as people on the working group as well as people that write articles. Stephanie Eckles comes to mind, ModernCSS. There’s a lot of resources like that. I would also say, if you keep an eye on the release notes from different browsers, they don’t come out that often, it’s not going to spam your inbox every day. You’ll often see a section in the release notes on what have they released related to CSS. And usually in terms of features, it’s just one or two things. You’re not going to become totally overwhelmed by all of the new things landing. They’ll come out six weeks to a couple of months and you can just keep an eye on what’s landing in the browsers.

Drew: Interesting point. I hadn’t thought of looking at browser release notes to find this stuff. Personally, I make efforts to follow people on Twitter who I know would share things, but I find I just miss things on Twitter all the time. There’s lots of cool stuff that I never get to see.

Drew: In that spirit, before we look too far into the future into what’s under development at the moment, there are quite a few bits of CSS that have already landed in browsers that might be new to people and they might be pretty usable under a lot of circumstances. There are certainly things that I’ve been unaware of.

Drew: One area that comes to mind is selectors. There’s this "is" pseudo-class function, for example. Is that like a jQuery "is" selector, if you remember those? I can barely remember those.

Miriam: I didn’t use jQuery enough to say.

Drew: No. Now even saying that, it’s so dusty in my mind, I’m not even sure that was a thing.

Miriam: Yeah, "is" and "where", it’s useful to think of them together, both of those selectors. "Is" sort of landed in most browsers a little bit before "where", but at this point I think both are pretty well-supported in modern browsers. They let you list a number of selectors inside of a single pseudo-class selector. So you say, ":is" or ":where" and then in parentheses, you can put any selectors you want and it matches an element that also matches the selectors inside. One example is, you can say, "I want to style all the links inside of any heading." So you can say "is", H1, H2, H3, H4, H5, H6, put a list inside of "is", and then, after that list say "A" once. And you don’t have to repeat every combination that you’re generating there. It’s sort of a shorthand for bringing nesting into CSS. You can create these nested "like" selectors. But they also do some interesting things around specificity... Sorry, what were you going to say?

Drew: I guess it’s just useful in making your style sheet more readable and easy to maintain if you’re not having to longhand write out every single combination of things.

Miriam: Right. The other interesting thing you can do with it is you can start to combine selectors. So you can say, "I’m only targeting something that matches both the selectors outside of "is" and the selectors inside of "is"". It has to match all of these things." So you can match several selectors at once, which is interesting.

Drew: Where does "where" come into it if that’s what "is" does?

Miriam: Right. "Where" comes into it because of the way that they handle specificity. "Is" handles specificity by giving you the entire selector gets the specificity of whatever is highest specificity inside of "is." "Is" can only have one specificity and it’s going to be the highest of any selector inside. If you put an "id" inside it, it’s going to have the specificity of an "id." Even if you have an "id" and a class, two selectors, inside "is", It’s going to have the specificity of the "id."

Miriam: That defaults to a higher specificity. "Where" defaults to a zero specificity, which I think is really interesting, especially for defaults. I want to style an audio element where it has controls, but I don’t want to add specificity there, I just want to say where it’s called for controls, where it has the controls attribute, add this styling to audio. So a zero-specificity option. Otherwise, they work the same way.

Drew: Okay. So that means with a zero specificity, it means that, then, assuming that somebody tries to style those controls in the example, they’re not having to battle against the styles that have already been set.

Miriam: That’s right, yeah. There’s another interesting thing inside of both of those where they’re supposed to be resilient. Right now, if you write a selector list and a browser doesn’t understand something in that selector list, it’s going to ignore all of the selectors in the list. But if you do that inside of "is" or "where", if an unknown selector is used in a list inside of "is" or "where", it should be resilient and the other selectors should still be able to match.

Drew: Okay, so this is that great property of CSS, that if it doesn’t understand something, it just skips over it.

Miriam: Right.

Drew: And so, you’re saying that if there’s something that it doesn’t understand in the list, skip over the thing it doesn’t understand, but don’t throw the baby out with the bathwater, keep all the others and apply them.

Miriam: Exactly.

Drew: That’s fascinating. And the fact that we have "is" and "where" strikes me as one of those examples of something that sounds like an easy problem. "Oh, let’s have an "is" selector." And then somebody says, "But what about specificity?"

Miriam: Right, exactly.

Drew: How are we going to work that out?

Miriam: Yeah. The other interesting thing is that it comes out of requests for nesting. People wanted nested selectors similar to what Sass has and "is" and "where" are, in some ways, a half step towards that. They will make the nested selectors easier to implement since we already have a way to, what they call "de-sugar" them. We can de-sugar them to this basic selector.

Drew: What seems to me like the dustiest corners of HTML and CSS are list items and the markers that they have, the blitz or what have you. I can remember, probably back in Frontpage in the late ’90s, trying to style, usually with proprietary Microsoft properties, for Internet Explorer back in the day. But there’s some good news on the horizon for lovers of markers, isn’t there?

Miriam: Yeah, there’s a marker selector that’s really great. We no longer have to remove the markers by saying... How did we remove markers? I don’t even remember. Changing the list style to none.

Drew: List style, none. Yup.

Miriam: And then people would re-add the markers using "before" pseudo-element. And we don’t have to do that anymore. With the marker pseudo-element, we can style it directly. That styling is a little bit limited, particularly right now, it’s going to be expanding out some, but yeah, it’s a really nice feature. You can very quickly change the size, the font, the colors, things like that.

Drew: Can you use generated content in there as well?

Miriam: Yes. I don’t remember how broad support is for the generated content, but you should be able to.

Drew: That’s good news for fans of lists, I guess. There’s some new selectors. This is something that I came across recently in a real-world project and I started using one of these before I realized actually it wasn’t as well supported as I thought, because it’s that new. And that’s selectors to help when "focus" is applied to elements. I think I was using "focus within" and there’s another one, isn’t there? There’s-

Miriam: "Focus visible."

Drew: What do they do?

Miriam: Browsers, when they’re handling "focus", they make some decisions for you based on whether you’re clicking with a mouse or whether you’re using a keyboard to navigate. Sometimes they show "focus" and sometimes they don’t, by default. "Focus visible" is a way for us to tie into that logic and say, "When the browser thinks focus should be visible, not just when an item has focus, but when an item has focus and the browser thinks focus needs to be visible, then apply these styles." That’s useful for having outline rings on focus, but not having them appear when they’re not needed, when you’re using a mouse and you don’t really need to know. You’ve clicked on something, you know that you’ve focused it, you don’t need the styling there. "Focus visible" is really useful for that. "Focus within" allows you to say, "Style the entire form when one of its elements has focus," which is very cool and very powerful.

Drew: I think I was using it on a dropdown menu navigation which is-

Miriam: Oh, sure.

Drew: ... a focus minefield, isn’t it?

Miriam: Mm-hmm (affirmative).

Drew: And "focus within" was proven very useful there until I didn’t have it and ended up writing a whole load of JavaScript to recreate what I’d achieved very simply with CSS before it.

Miriam: Yeah, the danger always with new selectors is how to handle the fallback.

Drew: One thing I’m really excited about is this new concept in CSS of aspect ratio. Are we going to be able to say goodbye to the 56% top padding hack?

Miriam: Oh, absolutely. I’m so excited to never use that hack again. I think that’s landing in browsers. I think it’s already available in some and should be coming to others soon. There seems to be a lot of excitement around that.

Drew: Definitely, it’s the classic problem, isn’t it, of having a video or something like that. You want to show it in like a 16 by 9 ratio, but you want to set the dimensions on it. But maybe it’s a 4 by 3 video and you have to figure out how to do it and get it to scale with the right-

Miriam: Right, and you want it to be responsive, you want it to fill a whole width, but then maintain its ratio. Yeah, the hacks for that aren’t great. I use one often that’s create a grid, position generated content with a padding top hack, and then absolute position the video itself. It’s just a lot to get it to work the way you want.

Drew: And presumably, that’s going to be much more performance for the layout engines to be able to deal with and-

Miriam: Right. And right away, it’s actually a reason to put width and height values back on to replaced elements like images, in particular, so that even before CSS loads, the browser can figure out what is the right ratio, the intrinsic ratio, even before the image loads and use that in the CSS. We used to strip all that out because we wanted percentages instead and now it’s good to put it back in.

Drew: Yes, I was going to say that when responsive web design came along, we stripped all those out. But I think we lost something in the process, didn’t we, of giving the browser that important bit of information about how much space to reserve?

Miriam: Yeah, and it ties in to what Jen Simmons has been talking about lately with intrinsic web design. The idea with responsive design was basically that we strip out any intrinsic sizing and we replace it with percentages. And now the tools that we have, flex and grid, are actually built to work with intrinsic sizes and it’s useful to put those all back in and we can override them still if we need to. But having those intrinsic sizes is useful and we want them.

Drew: Grid, you mentioned, I think sort of revolutionized the way we think about layout on the web. But it was always sort of tempered a little bit by the fact that we didn’t get subgrid at the same time. Remind us, if you will, what subgrid is all about and where are we now with support?

Miriam: Yeah. Grid establishes a grid parent and then all of its children layout on that grid. And subgrid allows you to nest those and say, "Okay, I want grandchildren to be part of the grandparent grid." Even if I have a DOM tree that’s quite a bit nested, I can bubble up elements into the parent grid, which is useful. But it’s particularly useful when you think about the fact that CSS in general and CSS Grid in particular does this back and forth of some parts of the layout are determined based on the available width of the container. They’re contextual, they’re outside-in. But then also, some parts of it are determined by the sizes of the children, the sizes of the contents, so we have this constant back and forth in CSS between whether the context is in control or whether the contents are in control of the layout. And often, they’re intertwined in very complex ways. What’s most interesting about subgrid is it would allow the contents of grid items to contribute back their sizing to the grandparent grid and it makes that back and forth between contents and context even more explicit.

Drew: Is that the similar problem that has been faced by container queries? Because you can’t really talk about the future of CSS and ask designers and developers what they want in CSS without two minutes in somebody saying, "Ah, container queries, that’s what we want." Is that a similar issue of this pushing and pulling of the two different context to figure out how much space there is?

Miriam: Yeah, they both are related to that context-content question. Subgrid doesn’t have to deal with quite the same problems. Subgrid actually works. It is actually able to pass those values both directions because you can’t change the contents based on the context. We sort of cut off that loop. And the problem with container queries has always been that there’s a potential infinite loop where if we allow the content to be styled based on its context explicitly, and you could say, "When I have less than 500 pixels available, make it 600 pixels wide." You could create this loop where then that size changes the size of the parent, that changes whether the container query applies and on and on forever. And if you’re in the Star Trek universe, the robot explodes. You get that infinite loop. The problem with container queries that we’ve had to solve is how do we cut off that loop.

Drew: Container queries is one of the CSS features that you’re one of the editors for, is that right?

Miriam: Yeah.

Drew: So the general concept is like a media query, where we’re looking at the size of a viewport, I guess, and changing CSS based on it. Container queries are to do that, but looking at the size of a containing element. So I’m a hero image on a page, how much space have I got?

Miriam: Right. Or I’m a grid item in a track. How much space do I have in this track? Yeah.

Drew: It sounds very difficult to solve. Are we anywhere near a solution for container queries now?

Miriam: We are very near a solution now.

Drew: Hooray!

Miriam: There’s still edge cases that we haven’t resolved, but at this point, we’re prototyping to find those edge cases and see if we can solve all of them. But the prototypes we’ve played with so far surprisingly just work in the majority of cases, which has been so fun to see. But it’s a long history. It’s sort of that thing with... Like we get "is" because it’s halfway to nesting. And there’s been so much work over the last 10 years. What looks like the CSS Working Group not getting anywhere on container queries has actually been implementing all of the half steps we would need in order to get here. I came on board to help with this final push, but there’s been so much work establishing containment and all these other concepts that we’re now relying on to make container queries possible.

Drew: It’s really exciting. Is there any sort of timeline now that we might expect them to get into browsers?

Miriam: It’s hard to say exactly. Not all browsers announce their plans. Some more than others. It’s hard to say, but all of the browsers seem excited about the idea. There’s a working prototype in Chrome Canary right now that people can play with and we’re getting feedback through that to make changes. I’m working on the spec. I imagine dealing with some of the complexity in the edge cases. It will take some time for the spec to really solidify, but I think we have a fairly solid proposal overall and I hope that other browsers are going to start picking up on that soon. I know containment, as a half step, is already not implemented everywhere, but I know Igalia is working to help make sure that there’s cross-browser support of containment and that should make it easier for every browser to step up and do the container queries.

Drew: Igalia are an interesting case, aren’t they? They were involved in a lot of the implementation on Grid initially, is that right?

Miriam: Yes. I understand they were hired by Bloomberg or somebody that really wanted grids. Igalia is really interesting. They’re a company that contributes to all of the browsers.

Drew: They’re sort of an outlier, it seems. All the different parties that work on CSS, is mostly, as you’d expect, mostly browser vendors. But yes, they’re there as a sort of more independent developer, which is very interesting.

Miriam: A browser vendor vendor.

Drew: Yes. Definitely. Another thing I wanted to talk to you about is this concept that completely twisted my mind a little bit while I started to think about it. It’s this concept of cascade layers. I think a lot of developers might be familiar with the different aspects of the CSS cascade thing, specificity, source order, importance, origin. Are those the main ones? What are cascade layers? Is this another element of the cascade?

Miriam: Yeah. It is another element very much like those. I think often when we talk about the cascade, a lot of people mainly think of it as specificity. And other things get tied into that. People think of importance as a higher specificity, people think of source order as a lower specificity. That makes sense because, as authors, we spend most of our time in specificity.

Miriam: But these are separate things and importance is more directly tied to origins. This idea of where do styles come from. Do they come from authors like us or browsers, the default styles, or do they come from users? So three basic origins and those layer in different ways. And then importance is there to flip the order so that there’s some balance of control. We get to override everybody by default, but users and browsers can say, "No, this is important. I want control back." And they win.

Miriam: For us, importance acts sort of like a specificity layer because normal author styles and important author styles are right next to each other so it makes sense that we think of them that way. But I was looking at that and I was thinking specificity is this attempt to say... It’s a heuristic. That means it’s a smart guess. And the guess is based on we think the more narrowly targeted something is, probably the more you care about it. Probably. It’s a guess, it’s not going to be perfect, but it gets us partway. And that is somewhat true. The more narrowly we target something, probably the more we care about it so more targeted styles override less targeted styles.

Miriam: But it’s not always true. Sometimes that falls apart. And what happens is, there’s three layers of specificity. There’s id’s, there’s classes and attributes, and there there’s elements themselves. Of those three layers, we control one of them completely. Classes and attributes, we can do anything we want with them. They’re reusable, they’re customizable. That’s not true of either of the other two layers. Once things get complex, we often end up trying to do all of our cascade management in that single layer and then getting angry, throwing up our hands, and adding importance. That’s not ideal.

Miriam: And I was looking at origins because I was going to do some videos teaching the cascade in full, and I thought that’s actually pretty clever. We, as authors, often have styles that come from different places and represent different interests. And what if we could layer them in that same way that we can layer author styles, user styles, and browser styles. But instead, what if they’re... Here’s the design system, here’s the styles from components themselves, here’s the broad abstractions. And sometimes we have broad abstractions that are narrowly targeted and sometimes we have highly repeatable component utilities or something that need to have a lot of weight. What if we could explicitly put those into named layers?

Miriam: Jen Simmons encouraged me to submit that to the working group and they were excited about it and the spec has been moving very quickly. At first, we were all worried that we would end up in a z-index situation. Layer 999,000 something. And as soon as we started putting together the syntax, we found that that wasn’t hard to avoid. I’ve been really excited to see that coming together. I think it’s a great syntax that we have.

Drew: What form does the syntax take on, roughly? I know it’s difficult to mouth code, isn’t it?

Miriam: It’s an "@" rule called "@layer." There’s actually two approaches. You can also use, we’re adding a function to the "@import" syntax so you could import a style sheet into a layer, say, import Bootstrap into my framework layer. But you can also create or add to layers using the "@layer" rule. And it’s just "@layer" and then the name of the layer. And layers get stacked in the order they’re first introduced, which means that even if you’re bringing in style sheets from all over and you don’t know what order they’re going to load, you can, at the top of your document, say, "Here are the layers that I’m planning to load, and here’s the order that I want them in." And then, later, when you’re actually adding styles into those layers, they get moved into the original order. It’s also a way of saying, "Ignore the source order here. I want to be able to load my styles in any order and still control how they should override each other."

Drew: And in its own way, having a list, at the top, of all these different layers is self-documenting as well, because anybody who comes to that style sheet can see the order of all the layers.

Miriam: And it also means that, say, Bootstrap could go off and use a lot of internal layers and you could pull those layers in from Bootstrap. They control how their own layers relate to each other, but you could control how those different layers from Bootstrap relate to your document. So when should Bootstrap win over your layers and when should your layers win over Bootstrap? And you can start to get very explicit about those things without ever throwing the "important" flag.

Drew: Would those layers from an imported style sheet, if that had its own layers, would they all just mix in at the point that the style sheet was added?

Miriam: By default, unless you’ve defined somewhere else previously how to order those layers. So still, your initial layer ordering would take priority.

Drew: If Bootstrap, for example, had documented their layers, would you be able to target a particular one and put that into your layer stack to change it?

Miriam: Yes.

Drew: So it’s not an encapsulated thing that all moves in one go. You can actually pull it apart and...

Miriam: It would depend... We’ve got several ideas here. We’ve built in the ability to nest layers that seemed important if you were going to be able to import into a layer. You would have to then say, "Okay, I’ve imported all of Bootstrap into a layer called frameworks," but they already had a layer called defaults and a layer called widgets or whatever. So then I want a way to target that sublayer. I want to be able to say "frameworks widgets" or "frameworks defaults" and have that be a layer. So we have a syntax for that. We think that all of those would have to be grouped together. You couldn’t pull them apart if they’re sublayered. But if Bootstrap was giving you all those as top level layers, you could pull them in at the top level, not group them. So we have ways of doing both grouping or splitting apart.

Drew: And the fact that you can specify a layer that something is imported into that doesn’t require any third-party script to know about layers or have implemented it, presumably, it just pulls that in at the layer you specify.

Miriam: Right.

Drew: That would help with things pretty much like Bootstrap and that sort of thing, but also just with the third party widgets you’re then trying to fight with specificity to be able to re-style them and they’re using id’s to style things and you want to change the theme color or something and you having to write these very specific... You can just change the layer order to make sure that your layers would win in the cascade.

Miriam: Yup. That’s exactly right. The big danger here is backwards compatibility. It’s going to be a rough transition in some sense. I can’t imagine any way of updating the cascade or adding the sort of explicit rules to the cascade without some backwards compatibility issues. But older browsers are going to ignore anything inside a layer rule. So that’s dangerous. This is going to take some time. I think we’ll get it implemented fairly quickly, but then it will still take some time before people are comfortable using it. And there are ways to polyfill it particularly using "is." The "is selector gives us a weird little polyfill that we’ll be able to write. So people will be able to use the syntax and polyfill it, generate backwards-compatible CSS, but there will be some issues there in the transition.

Drew: Presumably. And you’re backwards-compatible to browsers that support "is."

Miriam: That’s right. So it gets us a little farther, but not... It’s not going to get us IE 11.

Drew: No. But then that’s not necessarily a bad thing.

Miriam: Yeah.

Drew: It feels like a scoping mechanism but it’s not a scoping mechanism, is it, layers? It’s different because a scope is a separate thing and is actually a separate CSS feature that there’s a draft in the works for, is that right?

Miriam: Yeah, that’s another one that I’m working on. I would say, as with anything in the cascade, they have sort of an overlap. Layers overlap with specificity and both of them overlap with scope.

Miriam: The idea with scope, what I’ve focused on, is the way that a lot of the JavaScript tools do it right now. They create a scope by generating a unique class name, and then they append that class name to everything they consider within a scope. So if you’re using "view" that’s everything within a view component template or something. So they apply it to every element in the HTML that’s in the scope and then they also apply it to every single one of your selectors. It takes a lot of JavaScript managing and writing these weird strings of unique ids.

Miriam: But we’ve taken the same idea of being able to declare a scope using an "@scope" rule that declares not just the root of the scope, not just this component, but also the lower boundaries of that scope. Nicole Sullivan has called this "donut scope", the idea that some components have other components inside of them and the scope only goes from the outer boundaries to that inner hole and then other things can go in that hole. So we have this "@scope" rule that allows you to declare both a root selector and then say "to" and declare any number of lower boundaries. So in a tab component it might be "scope tabs to tab contents" or something so you’re not styling inside of the content of any one tab. You’re only scoping between the outer box and that inner box that’s going to hold all the contents.

Drew: So it’s like saying, "At this point, stop the inheritance."

Miriam: Not exactly, because it doesn’t actually cut off inheritance. The way I’m proposing it, what it does is it just narrows the range of targeted elements from a selector. So any selector you put inside of the scope rule will only target something that is between the root and the lower boundaries and it’s a targeting issue there. There is one other part of it that we’re still discussing exactly how it should work where, the way I’ve proposed it, if we have two scopes, let’s call them theme scopes. Let’s say we have a light theme and a dark theme and we nest them. Given both of those scopes, both of them have a link style, both of those link styles have the same specificity, they’re both in scopes. We want the closer scope to win in that case. If I’ve got nested light and dark and light and dark, we want the closest ancestor to win. So we do have that concept of proximity of a scope.

Drew: That’s fascinating. So scopes are the scope of the targeting of a selector. Now, I mentioned this idea of inheritance. Is there anything in CSS that might be coming or might exist already that I didn’t know about that will stop inheritance in a nice way without doing a massive reset?

Miriam: Well, really, the way to stop inheritance is with some sort of reset. Layers would actually give you an interesting way to think about that because we have this idea of... There’s already a "revert" rule. We have an "all" property, which sets all properties, every CSS property, and we have a "revert" rule, which reverts to the previous origin. So you can say "all revert" and that would stop inheritance. That would revert all of the properties back to their browser default. So you can do that already.

Miriam: And now we’re adding "revert layer", which would allow you to say, "Okay I’m in the components layer. Revert all of the properties back to the defaults layer." So I don’t want to go the whole way back to the browser defaults, I want to go back to my own defaults. We will be adding something like that in layers that could work that way.

Miriam: But a little bit, in order to stop inheritance, in order to stop things from getting in, I think that belongs more in the realm of shadow DOM encapsulation. That idea of drawing hard boundaries in the DOM itself. I’ve tried to step away from that with my scope proposal. The shadow DOM already is handling that. I wanted to do something more CSS-focused, more... We can have multiple overlapping scopes that target different selectors and they’re not drawn into the DOM as hard lines.

Drew: Leave it to someone else, to shadow DOM. What stage are these drafts at, the cascade layers and scope? How far along the process are they?

Miriam: Cascade layers, there’s a few people who want to reconsider the naming of it, but otherwise, the spec is fairly stable and there’s no other current issues open. Hopefully, that will be moving to candidate recommendation soon. I expect browsers will at least start implementing it later this year. That one is the farthest along because for browsers, it’s very much the easiest to conceptualize and implement, even if it may take some time for authors to make the transition. That one is very far along and coming quickly.

Miriam: Container queries are next in line, I would say. Since we already have a working prototype, that’s going to help a lot. But actually defining all of the spec edge cases... Specs these days are, in large part, "How should this fail?" That’s what we got wrong with CSS 1. We didn’t define the failures and so browsers failed differently and that was unexpected and hard to work with. Specs are a lot about dealing with those failures and container queries are going to have a lot of those edge cases that we have to think through and deal with because we’re trying to solve weird looping problems. It’s hard to say on that one, because we both have a working prototype ahead of any of the others, but also it’s going to be a little harder to spec out. I think there’s a lot of interest, I think people will start implementing soon, but I don’t know exactly how long it’ll take.

Miriam: Scope is the farthest behind of those three. We have a rough proposal, we have a lot of interest in it, but very little agreement on all the details yet. So that one is still very much in flux and we’ll see where it goes.

Drew: I think it’s amazing, the level of thought and work the CSS Working Group are putting into new features and the future of CSS. It’s all very exciting and I’m sure we’re all very grateful for the clever folks like yourself who spend time thinking about it so that we get new tools to use. I’ve been learning all about what’s coming down the pike in CSS, what have you been learning about lately, Miriam?

Miriam: A big part of what I’m learning is how to work on the spec process. It’s really interesting and I mean the working group is very welcoming and a lot of people there have helped me find my feet and learn how to think about these things from a spec perspective. But I have a long ways to go on that and learning exactly how to write the spec language and all of that. That’s a lot in my mind.

Miriam: Meanwhile, I’m still playing with grids and playing with custom properties. And while I learned both of those, I don’t know, five years ago, there’s always something new there to discover and play with, so I feel like I’m never done learning them.

Drew: Yup. I feel very much the same. I feel like I’m always a beginner when it comes to a lot of CSS.

Drew: If you, dear listener, would like to hear more from Miriam, you can find her on Twitter where she’s @TerribleMia, and her personal website is miriamsuzanne.com. Thanks for joining us today, Miriam. Do you have any parting words?

Miriam: Thank you, it’s great chatting with you.

Smashing Podcast Episode 35 With Stephanie Stimac & Melanie Richards: What’s Next For HTML Controls?

In this episode, we’re talking about HTML controls. Why are they so hard to style, and how might that change in the future? Drew McLellan talks to Microsoft’s Stephanie Stimac and Melanie Richards to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: My first guest is a program manager for Microsoft Edge developer experiences, but prefers to think of herself as a designer, front-end developer and developer advocate for Microsoft Edge. My second guest is also a program manager for Microsoft Edge focused on the web platform. She too has a background in web design and front end development. She loves designing and building fun things for the web and is currently doubling in 3D art.

Drew: So we know that they’re both experienced web developers working hard to move the web platform forward, but did you know together they won the Kentucky Derby dressed as a pantomime horse? My smashing friends, please welcome Stephanie Stimac and Melanie Richards. Hi Stephanie. Hi Melanie. How are you?

Stephanie Stimac: I am smashing.

Melanie Richards: I’m also simply smashing.

Drew: It’s been probably about a year Stephanie, since we last had you on the podcast, and you have the dubious honor of being our first ever return guest. At that point a year ago, Edge was transitioning over to a chromium rendering engine.

Drew: Melanie, I’m guessing that that transition was a big deal for your team on web platform as well. How have things been over the last year? Has the transition been smooth and successful?

Stephanie: I think so. So I think Gavin, we talked last, we were just rolling out our stable version across some platforms. And now we’re on Linux as well, and there’s been just so much good reception from the developer community, people are excited to use Edge, so the reception has been really great and I know for developer experiences. We’ve been working on some fun stuff that’s coming up still soon, but it’s been really good.

Drew: That’s amazing. I didn’t realize that Edge was also available on Linux now, because it’s been on the Mac for a while as well, which is great to be able to run a page on a Mac. I mean, windows obviously being the sort of dominant desktop operating system. The role is the primary browser on that platform is sort of fairly immense.

Drew: And there’s been a bit of a spotty history when it comes to Microsoft and it’s browsers, I think we can be honest about that. Sometimes leading the way and then maybe stumbling for a little bit and getting left behind. But we all know as developers the pain that comes from such an important browse not being up to par. So it’s great to see that now it’s a really first-class experience for users, but also for developers too with edge, with all sorts of development tools and at a really first-class experience in that regard as well.

Melanie: Yeah, it’s been wonderful for us on the team, because we’ve had kind of a true opportunity to help push the web forward a little bit more. When we were kind of building on top of edge HTML, there were some areas where we had to play catch up on certain APIs.

Melanie: And now that we’re collaborating and bringing new ideas into the chromium code base and to standards, it becomes a lot easier to say, okay, what’s next? How can we solve problems for developers and for our users? So, it’s kind of been a joy collaborating with folks across the different companies on this one.

Drew: It feels very natural that it should be a collaborative experience and that’s kind of what the web is designed to be, right?

Melanie: Absolutely.

Drew: So, I wanted to talk to you both today about HTML controls. And that term itself, I guess is wrapped up in quite a bit of sort of platform specification jargon. What do we mean in practical terms when we’re talking about HTML controls and what are the sort of problems that designers and developers might counter with them on an everyday project?

Melanie: Yeah, so primarily we’re thinking about form controls that enable user input in some fashion. So you have your Slack, your radio, checkbox, buttons, this extends also to the video player and controls as well.

Melanie: So I think something that a lot of us have experienced as far as participants in this customizable controls effort have experienced personally, is sort of wrestling with getting these controls to fit the brand and the user experience that we’re going after for our particular user base.

Melanie: So, there’s things that seem like they should be fairly trivial, just getting the right colors in select options. And the fact that you have to just completely recreate a control in order to do that, to align to your branding, which is something that a lot of projects require that is so challenging.

Melanie: I saw a tweet a couple months back when we were talking about this with some other browser vendors. Someone was saying, Oh, you want icons in your select options, you have one problem. So you recreate the select and now you have 37 problems.

Melanie: There’s so many things that you have to manage as a designer developer, getting the accessibility right, and there’s so many different dimensions of that, the semantics, the keyboard interactions, high contrast, supporting different color schemes, that sort of thing. And we find that folks are just recreating these all over the place, several different frameworks even within the same company, a lot of developer designer energy being put into this and it’s like, okay, what if we could just make it easier to use the things out of the box and build on top of those and not have to recreate the wheel here?

Drew: I think there was this sort of concept with early implementation of form controls, that they should look like they’re native to the operating system. Which you can kind of understand from a view of wanting consistency across the user experience for the whole of the operating system.

Drew: We’ve all used desktop apps, particularly cross-platform ones that implement their own controls rather than using the native ones and that experience can be really horrible. So you can see where that thinking has come from. But I think it’s sort of almost a false promise that there is a consistent experience, because the controls in a webpage never really behaved in the same way as the controls in native applications and operating system, they never really functioned like native controls. So it was sort of a coat of paint, but not really providing the same user experience. Was it?

Stephanie: Right. So yeah, I’ve dived into the history of controls a little bit, and I think in the beginning they did behave like native platform controls, because in the early days of the web, it was the underlying operating system that was sort of rendering those controls.

Stephanie: And then this idea that developers wanted more control over functionality and style. I was reading a blog post from I think, 2001, and so like CSS had finally just been standardized and was sort of embraced as the main styling language and people were trying to style controls and just have more control over controls.

Stephanie: And that led to, I think, and even today that’s led to a huge sort of, I think, discrepancy in the way that they function. Like Melanie said that you have people recreating form controls from scratch, and they may not mimic native form controls at all their functionality. So you’ll have a select that maybe behaves differently on one website than another one.

Stephanie: So the experience can be pretty jarring. And I think even across different platforms too, we have native controls that don’t behave the same way, they behave differently on different platforms. So it does create sort of this interesting problem space for developers when you’re thinking about user experience.

Drew: When you think about all the things that run on the web platform, sort of banking and healthcare services and emergency response, governments, e-commerce, global economies basically are running on top of the web platform these days, through various ways of means. And that’s all built on top of a few HTML controls from 25 years ago, pretty much, they’ve been the same for decades. And they’re pretty terrible really, aren’t they? They’re basic.

Drew: But how did we get to this point where they got so left behind, and nobody sort of touched them for so long? How have we got to the point on the web platform where sort of the weakest link is input controls?

Melanie: Yeah, I think that’s a pretty big challenge, something that we think about quite a lot as browser vendors and as participants in standards is web compatibility. This comes up all the time, you’re thinking about, Oh, should we make this change to CSS or should we tweak this a little bit?

Melanie: And maybe it makes a lot of logical sense for the way people are building today. It makes a lot of logical sense for developer ergonomics, but someone goes, Hey, wait a second, if we make that change, these millions of sites are going to blow up in unexpected ways. There’s just an example on some of these controls where people are applying CSS styles that have no effect today.

Melanie: So if we said, okay, actually we’re going to allow this or that property on a certain control, now, some of these sites are going to do very funky things. So I think because controls are involved in such mission critical flows as you kind of pointed out, people are a little bit nervous about changing something so fundamental to the web in a way that is backwards compatible and won’t break anything.

Melanie: So we kind of have to think about the controls problem in an additive way. And some of the other challenges here are that every browser has kind of implemented their controls under the hood in a different fashion. So some are kind of doing something that’s a little bit orthogonal to the operating system, some are still leaning quite heavily on the operating system, and that can change for the same browser in different platforms. So you have to kind of take all those things into account.

Melanie: I think it’s a tough problem, but I am feeling the winds of change here, everybody recognizes, okay, we need to go and solve this problem, it’s going to take a long time, It’s going to be hard, but let’s try.

Stephanie: To add on top of that too, so I’ve been sitting in on our meetings with Melanie and the open UI initiative that’s sort of leading the standardization of controls. And I don’t think people realize either, like Melanie said, it’s a huge undertaking. And there are some meetings we have that get into such granular detail about the way a select behaves, just to a level that even kind of blows my mind at how specific these problems are that we have to think about. So it is a huge undertaking.

Drew: There was an effort, wasn’t there? With HTML5 to improve things a little bit, and there were some new types for the input element and there was some basic validation capability and the constraint validation API, but it was kind of a subtle evolution, not a revolution, was it successful, do you think?

Melanie: I think that effort did add some necessary capabilities to the web platform, but I think there’s some feeling about the type attribute, maybe we should go a different way in the future, but that type of attribute does a lot. You kind of inherit a lot of behaviors from the base input class that maybe isn’t applicable to that particular element. Maybe there’s a different way to do this and have more purpose-built specific elements so that’s kind of what we’re looking at.

Drew: I think of things like the way that data input works currently with HTML5 or I say works, doesn’t work maybe. You have to sort of just look at the fact that every single site is building custom calendar controls rather than using that native date picker, because the date picker isn’t serving that need. And you kind of have to conclude that some of these native methods have just completely failed.

Melanie: Right. And the date picker is such an interesting one, because I feel there’s two buckets as to why people recreate those. In some cases it’s like, yeah, I want it to basically function as a date picker does, but I really need it to be style to match my own branding. And that day picker control is doing a lot of work, there’s a lot of stuff going on in this one tiny little pop-up world.

Melanie: And then on the other side of the house, you have airline websites, right? Where they’re trying to do something that’s different, that can’t be supported by that date picker control where you’re really looking at range, I can cross different months and that sort of thing. So yeah, that one’s a tricky one, there’s a lot of different use cases packed into one control.

Drew: How can we avoid new sort of falling into that trap again in the future? obviously that’s an example of something that was too complex, obviously very complex to implement, because some rendering engines didn’t even try and others that did try had varying levels of success. How do we avoid falling into that trap in the future? Can we?

Melanie: Yeah. It’s an interesting question, so I think some of the proposals that we’ve made around customizable controls are meant to offer folks a little bit more flexibility with the inbuilt controls, more control over those, if you will.

Melanie: So just kind of break down our basic proposal here, we imagine there’s a couple different solutions for customizable controls, and the right solution sort of depends on the use case and the particular control and how complex it is really. So the different kind of buckets are, we want to have some sort of standardized internal structure to the controls, so named parts basically. And we can create pseudo elements that can target the specific parts.

Melanie: So Greg Whitworth over at Salesforce actually has a proposal that he’s pulling over around a pseudo element for the checkbox and radio indicators, so looking forward to that kind of coming online in that bucket. Then we also looking at name slots, so let’s say that you’re a web developer, the base control mostly works for you, but you just want to replace one little piece of the control.

Melanie: So maybe the button you part of a select, for example. You can just swap out that name to slot. And then if you really want to go truly custom, you can actually completely replace the shadow domino control with the attached added method.

Melanie: And so the idea here is that the developer would have control over the view of the control, and they would still rely on the controller code coming from the web platform to kind of hook up things between the model, so certain data points in the control and the view, so they wouldn’t have to kind of do that underlying logic themselves.

Melanie: So, those are the kind of strategies that we have as far as being able to leverage what’s already been done but really customize it to your use case.

Drew: So that’s sort of getting around this problem that a lot of controls are just kind of a black box on there that’s inserted into the page and you can’t do anything much with it. Replaced elements, is that the right terminology?

Melanie: Yes.

Drew: Yes. So, there’s no way then with CSS or with JavaScript to actually target bits inside it, it’s just a box and you can’t get into it. So the idea here that you’re describing is structuring controls so they’re much more like something that we might build ourselves, with different levels of containers and items in it, so that each of those individual bits can be targeted.

Drew: And then some of them might be named, and so you could keep the basic control but swap out the slots. So if you had a file upload control, you might be able to swap the button with a button of your own choosing, but keep the general functionality implemented by the web platform, am I understanding that right?

Melanie: Yeah, that’s absolutely correct, yeah. We want to make it easier to kind of reach directly into that control and kind of take the pieces you need and update the pieces that you need as well.

Drew: Yeah, that sounds really exciting. But to play devil’s advocate as is my job sometimes, do we really need HTML controls at all? And I think at the number of forms that are being submitted with JavaScript using the fetch API, you can gather some data and make a post request or what have you. And you can take any element and turn on content editable and have the user be able to type in some text or what have you. Do we need native form controls or should we just go rogue and build it all ourselves?

Melanie: Pardon me, that carries a whole lot about accessibility is like "ahhh!", Hopefully that screech doesn’t sound too awful on the mic here, but. I think I’m a huge fan of the semantic web, right? And having things that are truly built for their purpose. Again, there’s a lot of things that you have to get right so that people who are using assistive technologies, for example, really know what they’re interacting with and their assistant technologies know how to inputs their actions and their data into that control as well.

Melanie: And so, clarity over the items that you’re working with really decreases if you kind of just throw a content editable on everything. And then, I feel like JavaScript is eating the world and here’s where I start getting nervous about going into controversial territory and just say the word JavaScript and people are like, what? Pop out of the woodwork.

Melanie: But people can just say, well JavaScript in their browsers or content can be kind of ingested into other environments. And so I still feel it’s super important to work with HTML, work declaratively, don’t necessarily depend on JavaScript for everything, provide a progressively enhanced experience, so.

Drew: I think when you look at the difference between how different controls are rendered on a desktop web page, versus the experience in a mobile browser, think of something like a select control, the interface is completely different on a mobile device, isn’t it? It’s not just whatever the developers built with divs and CSS on the page, the browser just completely takes that over and gives you a different experience.

Drew: That’s more appropriate to the device in question. So I think that’s definitely sort of a glimpse into the predicament that those who are using assistive technologies face when they come up against using things that are completely custom and not based on real solid HTML elements.

Melanie: Right. And it’s tricky if you are a person who’s interacting with the same basic control from site to site, but you have to like relearn how to use that control, because this website decided to use arrow keys to traverse through these items. And this site decided to use tab keys or the tab key. And it’s like, come on, that’s such heavy cognitive overload for folks who are just trying to go about their day.

Drew: Definitely, there’s awful a lot to think about when you go rogue, isn’t there? In terms of accessibility, keyboard use, focus, all these sorts of things that really add an awful lot of code to something that could be quite simple and you could just put the right elements in and get on with your day.

Drew: It’s a real frustration for us developers to try and style the form elements to make them work in the way we want to. And I get the feeling that just about every designer and developer would want to have better native controls. Is that something that you’ve seen in your own research into the developer community Stephanie?

Stephanie: So, yeah, we’ve actually seen that in the developer community. So about a year and a half ago, Greg Whitworth, who is at Salesforce and leading the open UI initiative, ran a survey on Twitter with about 1400 respondents to sort of find out if this controls pain point was... Or I’m sorry, I guess it’s two and a half years ago now 2020 was a blur.

Melanie: By this time.

Stephanie: Yeah. And he was trying to dive deep to see if this controls area was something that web platform team should go invest in. And the biggest reason for developers making their own controls or rebuilding them from scratch was, because they couldn’t change the appearance sufficiently, I think that was about like a third of developers. And then, I think about another third said, because of browser inconsistencies and I think you can assume that that probably has to do with the parents also. So that’s a lot of developer hours being spent rebuilding these things just to change the appearance.

Stephanie: And so Greg sort of identified that, yes, this was a pain point and being the PM that I am, I sort of wanted to find out how big of a pain point it was for developers. So I did my own sort of impromptu gorilla research on Twitter and asked people, how painful is this for you? And I got about 250 responses to this tweet.

Stephanie: And I had asked, what would you rather do than style a select menu? And responses ranged from I would rather chew on glass or boil my toes in lava than attempt to style a native select element to... I’d rather have to build the site and have it be compatible with IE6. So this is a huge, huge pain point for developers. So it’s been a pretty consistent theme that developers aren’t happy with what is there. So.

Drew: There’s been a bit of an effort from the various browsers to have a little bit of a design refresh lately of some of the form controls and try and take some of the opinion out of the design. We have lots of sort of gradients and things going on, didn’t we, in all sorts, which I guess is a primary reason for people wanting to style them in the first place. To try and get a bit of a more neutral look that doesn’t clash at least with their site’s design. Was that something that edge was involved in? I know that it happened in Chrome, was it driven by chromium or was that just Chrome doing it, or how has that worked?

Melanie: I think that’s actually a prime example of some of the cross-company collaboration we’ve been able to do since moving to chromium. So actually on the Microsoft edge side, all of us PMs on the platform are taking just the review of, okay, here’s all the features that we have in our current edge HTML based browser. What’s kind of the situation over in chromium land?

Melanie: At the time I was working on accessibility, so this looks like collaborating with chromium on bringing support for UI automation that accessibility API over to chromium, force colors, windows high contrast support, support for other system settings, but over in controls land, the team was kind of looking at, what our controls look like today, what are our requirements? What is the situation in chromium?

Melanie: So for the Microsoft edge browser, we run in a lot of contexts where there are touch capabilities, so there’s a lot of PCs that have touch screens, for example. And so, touch capability is really important to our form controls, they have to work well for a larger pointer, which is your finger.

Melanie: And we have this kind of fluent design system, so we were just feeling that there were ways to kind of push the controls a little bit more to align to our aesthetic, our touch requirements, our accessibility requirements, that sort of thing. And it actually ended up working out perfectly because we talked to the folks over at Google and they’re like, yeah, we’d love to kind of update, refresh the controls and make them feel more modern.

Melanie: So it was really tight collaboration between the companies to land on something that works for our aesthetic, their aesthetic, the aesthetic of other browsers that are also building on top of chromium. Find something that’s a good middle ground there and then it’s extensible. So yeah, lots of collaboration, it’s still ongoing actually, we’re actually just doing work on the controls refresh for Android, for example, so, lots of cool stuff to do.

Drew: So, sort of looking at further ahead than a design refresh. Are there plans for any sort of new native components coming up?

Melanie: Oh, yeah. Funny that you should ask, because we actually just published an explainer just the other day, for a new pop-up element that I’m very excited about. So I had kind of mentioned that we had proposed a couple of different capabilities for customizable controls. We sent an intent to prototype in the chromium project with a customizable select, ITPs as they call them are just kind of like, Hey, I’m going to play around the code base, kind of like push on my ideas, see if they’re like truly feasible in implementation. And that kind of happens in parallel to some of the standardization efforts.

Melanie: So we filed an ITP for the customizable select, but part of what we needed, we’re talking about reaching into the shadow dome, reaching into the control, we needed something that worked really well for the list box pop up portion of the select control. And we also kind of talk to some of our partners in different design frameworks and found that there was a more generalized need for a pop-up that can be rendered on the top layer, consistently it can break out of any kind of bounding boxes.

Melanie: We find that a lot of the times developers are kind of just like stuffing, they’re like divvy pop-ups in the bottom of the body, because they’re trying to get around these rendering problems, especially because they can’t actually directly control all the context in which their components show up, because there’s component library. So, we kind of took a look at some of these problems and came up with the pop-up proposal.

Melanie: And so this is for any kind of top layer UI that pops up and has light dismiss behaviors. So, the item should close on escape or loss of focus, things like that. And it’s really designed for transient UI, right? So you can only have one pop-up available at a time, unless there’s an ancestry chain, you can have popups inside popups and there’s different use cases for that.

Melanie: So yeah, this is a really early proposal, we’re really excited about it. But we’d love feedback from the community, we have it posted on the Microsoft edge explainers repo. We’re getting so many great questions, which is really exciting to me to just see people engaged with the idea and really pushing on the details and looking at us browser vendors to get things right. So, super excited about that, please check it out and let us know what you think.

Drew: And the stage that’s at, I’ve seen the explainer, which is a document which describes it all. Is that the state of that, there’s no sort of experiments and codes to play around with. It’s more a conceptual, what if we did this sort of stage, is that right?

Melanie: It is conceptual, but we do also have an intention prototype filed on that one as well. And so that is something that a couple of our close collaborators and Google are helping us with, kind of tinkering with the code right now, so that’s kind of exciting just validating our ideas as we make a proposal to the broader community.

Drew: That’s really exciting, I’ve literally just been working on a project at work that is a really key pop-up in our product interface. And the amount of work that’s involved in making sure that it sort of traps focus correctly and as you were saying, do we then allow somebody to interact with a tab or with arrow keys, or all the tiny details of interaction that are involved in that, making sure it appears at the writers that index above all the things that it should be in front of, what happens if somebody scrolls and then they hit the bottom of the scroll?

Drew: All these sorts of tiny, tiny, subtle bits of interaction that are... they’re not individually, they’re not difficult to code for, but the sum of them is a lot of work and the potential for bugs to creep in there and improve complete usability problem for some segments of your audience. To have that such a common thing implemented potentially as part of the web platform, it’s going to be a massive time saver for everyone, isn’t it?

Melanie: I’m so glad to hear that, that would be a great time saver for you, because yeah, that’s exactly what I’m kind of thinking, it’s like, oh, okay, it’s 20 minutes here, 30 minutes there, but multiply that by every single developer who has to do that, and then maybe you miss something and you get a very upset ticket in your feedback channel. So.

Drew: So is the idea that then something like a popup would be a building block for then a customized select control where it would be the options sort of section?

Melanie: Yes, absolutely. That’s one of the cases where we kind of imagine this showing up and it’s worth mentioning that the pop-up control that we’re kind of putting forward is meant to be a base that you can build on top of, because there’s many different types of pop-up UI and your use case might differ a little bit from your neighbor next to you.

Melanie: But it’s worth mentioning we think that there are some classes of top layer UI that actually could warrant their own additional element to pop up, because the paradigms there are a little bit different from the popup that we’re proposing. And it’s a very well-trodden path, a lot of people are rebuilding this control.

Melanie: But we’re trying to find the right balance here between pushing the platform forward and not wanting to flood it with new elements either.

Drew: Yeah. I mean, that’s an important point, isn’t it? Because we sort of want to be confident that the things that are being added to the platform are an evergreen requirement and not just a current interaction fad. I mean, if you sort of think back to five years ago where every website had an enormous carousel on it, we could have at that point decided, oh right, the web platform needs an enormous carousel control built into it.

Drew: Could have built that, and then once something’s in the platform, it stays forever, right? Basically we don’t take things out, they’ve got to keep working forever. And if people then aren’t using them, then it just becomes technical debt. So is there a way we can safeguard against that to make sure that these things are evergreen and not just a fad?

Melanie: There’s a lot of different stakeholders in web standards and I think a lot of these things happen naturally, there do tend to be pretty strong headwinds against adding a new element, because there is this fear of making the wrong choices and having the big forever or capturing something that’s a fleeting sort of problem.

Melanie: So I think what’s key here is to look at the problems that have been around for the longest time, right? And just listen to the various different stakeholders and what they have to say about the proposal that you’ve made and make sure that we have the best insights from everybody in the industry, all working together towards the best solution.

Stephanie: So, thinking of new elements and sort of what would be put into the platform. So Chrome, I believe is working on a toggle switch element. I believe there’s a prototype up for that, but that’s an element that they have in the works, which is one of those elements that sort of makes sense, that is something that’s sort of fundamental that gets used across so many websites that just, again, that makes sense that there should be a native element for that.

Drew: That’s exciting to hear as well, because the work in sort of progressively enhancing a checkbox, for example, to become a toggle switch is... Yeah, yeah, it’s something that’s best avoided if you can. But a toggle switch as an interface device makes a lot of sense for a lot of cases of turning something on or off and being a yes, no choice. So having that sort of thing as a fundamental part of the web platform would be terrific.

Drew: When we think about all the existing controls that are out there that potentially have problems, can they be fixed? I mean, we can’t throw them away. Well, I guess we could come up with alternatives that new sites could start to use in their place, but can we rescue the current ones? Is there a way that we can keep backwards compatibility and still move them forward?

Melanie: Yeah. So I think that’s an interesting question that it encompasses a broad range, right? I depends on what the issue is, I think, look, browser vendors are not perfect either, we have bugs, we should fix the bugs. So there’s plenty of those items. But again there are some things that are very difficult for compat and just keeping the web working if we just change things underneath people.

Melanie: So for example when we were working through the controls refreshing chromium, some of the designers were like, Oh, what if we make these check boxes in these radius this size? And we’re like, yeah, that’s better for usability, but the problem is they’ve been a certain size on the web forever for everyone and bad things will happen if we change that.

Melanie: So, it’s frustrating a little bit sometimes, because you can imagine a better way of doing something, but you don’t want to break everyone. So I think it depends. That’s probably the eventual answer to every question in web development, isn’t it?

Drew: It depends. I think about things like the select element over the multiple attributes, so you can have not select multiple items in the list. I mean, putting to one side how it looks by default in most browsers, the interaction model for that control is from a different era of computing, isn’t it? So much so that it’s rarely used because a typical web user doesn’t know how to interact with it. Can we address things like that? Is that something that can be fixed?

Melanie: That’s a hard question. I believe there’s a lot of creative people in this space come up with some really interesting ideas. I have to think a little bit about that one, because I agree even as a user that I find that interaction pattern a little bit challenging. So yeah, back to the drawing board I guess.

Drew: So, it depends.

Melanie: Oh man. I’m just going to answer every question that you have from now on with that.

Drew: So, Stephanie mentioned open UI a little bit earlier. What is open UI?

Stephanie: So open UI is an initiative under the YCG, and it is focused on standardizing controls. And so I think not... So controls are standardized, but it’s only their function. So I think that’s where the root of a lot of this problem comes from is back 25 years ago when the initial controls were introduced into the first HTML 2.0 Specification. Their parts weren’t standardized, it was just this form is supposed to complete this function or serve this purpose and that’s sort of what was standardized.

Stephanie: And so that is sort of the problem, different browser engines choose to render their controls or build them differently under the hood. And so we can’t give developers access to the different parts, sort of in a compatible way at the moment. And so open UI at its core is sort of driving that initiative to define, so first select, what is a select comprised of? What are the different parts? And drive that work forward.

Stephanie: And so Greg Whitworth is again driving a lot of that work, but it’s an open initiative, so we’ve had quite a few people from the developer community join in on that and are sort of helping to drive that work with Greg and the rest of the team. And so, yeah, at it’s core it’s just trying to find the different parts of the controls and sort of pave the way to get those into an actual standard specification and eventually into browsers.

Drew: So, this was the internal structure that Melanie was talking about just before of being able to identify different slots and then putting names to the different parts that make up a control so they can be targeted and replaced or styled or whatever, but it’s just making sure that that is consistent across different browsers, standardizing it, working out where they are or should be, and then hopefully that gets implemented and we can start using controls with a lot more precision than we can currently.

Stephanie: Yeah, that’s exactly right.

Drew: And does open UI attempt to address how controls will look?

Melanie: No, that’s outside of the purview of the open UI efforts. So, we’re looking at, if we have an MVC model of controls looking at the M and the C I suppose you can say.

Stephanie: Just to add to that too, sort of standardizing the way they look, like Melanie said, yeah, that’s not really... When you have different companies like Microsoft or the different browsers, Firefox and Chrome and Microsoft, they are different companies with different design languages as well. So even our default styles I think are going to be reflective of the company or the browser. So.

Drew: I think that’s ideal from sort of a development point of view, because if the browser vendors have to implement this new spec, it’s been agreed on, they’re going to implement it. And the first thing they going want do is to use that to style the control themselves to match the language of the browser.

Drew: And any inflexibility or potential problems that might appear down the road for end users are going to appear for the browser developers as they’re implementing that themselves. So it’s a good initial stress test. Can this select box be made to look like it should in edge, made like it should in Chrome and so on.

Melanie: Yeah, I also feel like I’m trying to get all the different browser engines to agree on a style or even just standards group on what this thing should look like would be a... I think that conversation would go on forever, quite frankly.

Drew: And could potentially stifle innovation as well. I think it’s positive that different competing products can compete on the user experience level by bringing their own innovation and hopefully what the specifications will enable us to do is to do that in a way that isn’t going to impact an end user... end web developer who wants to then restyle those controls themselves. It gives everybody the flexibility that they need.

Melanie: Right. Yeah. It’s even just a challenge, even as we’re talking about standardizing the internals of a control, you have to do it in such a way that it could be implemented in a different fashion, or there’s a little bit of room for variety or as you said innovation. So, that is a challenging requirement of this work stream.

Drew: What’s the process of sort of between getting these early ideas? Things that the open UI project might write up. How do we get those to start to become part of a future web specification and then ultimately implemented in browsers. Are we looking at decades of work here? Or, I mean, it’s not going to be a month, is it?

Melanie: I wish. Just kidding, actually, it’s so funny, I was thinking about this the other day, it’s like, as a web developer, your timescale is so much shorter than web standards, it’s like, I would love to have this for this thing that I’m trying to push out next month or whatever, but you actually probably should want us to take a while, because that means that will be very considered in the decisions that the web standards industry makes.

Melanie: So, yeah, I think this is going to be... We’re looking at a couple of years at least to fully go through all the controls. As far as process goes, that’s sort of a little bit of a moving target, the folks who are involved in open UI, some of the chairs and a couple other folks are actually working on a process document for how this sort of works.

Melanie: But I think generally speaking, you can think as open UI as sort of the connective tissue that tells the full story between efforts that might land and what we do, so the living document for HTML or the CSS working group over at the W3C. The open UI group can tell the full story in between these desperate pieces. And then can also provide a maturation ground. So when you’re trying to get work into the HTML spec, that group goes off of PRs, rather than sitting in a room and chatting about it.

Melanie: And so the expectation is the PR should be fairly mature when you make it against that spec. So, perhaps open UI can be the place where you gain that maturity in the idea.

Drew: And the ideas can be thrashed out before they’re then taken onto the next level of being proposed to the actual specification.

Melanie: Yeah, absolutely.

Drew: So how can people get involved in this process to offer feedback? I mean, for example, I know personally I’ve done a lot of content management system development work and that they tend to be very form heavy. And so my individual perspective might be different from somebody who builds online games, and the web has to work for all those use cases. So I guess it’s really important to get lots of points of view into the process. How would people get involved with that?

Stephanie: There’s a couple of different ways that you can go, or you can either get involved in open UI, again, that group is... If you go to open-ui.org I believe, you can find out how to get involved in that and sort of actually be involved in the process of defining control structures and helping us do research, or you could provide feedback on the explainers, so there’s the customizing controls, CY explainer on GitHub under the Microsoft edge explainers repo.

Stephanie: And then also the pop-up explainer that Melanie mentioned. You can open issues or you can just tweet at me or Melanie and there’s some good... I’ve seen some good conversations with the pop-up explainer I think, Melanie’s Twitter feed, so.

Drew: So getting involved in the web platform could be as simple as sending a tweet?

Stephanie: Yes.

Drew: Amazing.

Melanie: We’re all human beings over here so.

Drew: What a time to be alive. So I’ve been learning about the future of HTML controls today. What have you both been learning about lately?

Stephanie: Well, so I’m writing a new talk for dual screen devices and talking about design considerations and I tend to go into the history of, like I’ve done with HTML controls. I like to dive into history and see where we’ve come from and so I’ve been looking at foldable devices and how... There were prototypes in 2008 of actual foldable devices, and so I’ve been diving into that and learning about that for my next talk.

Melanie: I feel like I have too many plates spinning at all times to start learning new things, but in addition to this controls work I’m also focused on the pricey space in the web platform, so very different space actually, which is very interesting. But learning a lot right now about identity and federated off use cases as that relates to privacy.

Melanie: So that’s been super interesting, collaborating with folks who have a lot of depth of expertise there. And outside of the web platform, I don’t know, always doing different stuff. You mentioned doing three arts, I’m taking, Devon Ko’s 3D for Designers course that’s been fun. Learning a little bit of Japanese. So working through my Kanji lessons. So doing fiber arts and then I was like, what if I learn Python? I’m like, no, no, no. I can’t add more things to this list.

Drew: Rein it in. That’s amazing. If you dear listener would like to hear more from our guests, you can find Stephanie on Twitter where she’s @seaotta with an A and her personal site is stephaniestimac.com.

Drew: Melanie can be found on Twitter where she’s @soMelanieSaid, and her website is Melanie-richards.com. And the open UI course is open-ui.org. Thank you both for joining me today. Do you have any parting words?

Stephanie: I have to say I’m excited about the controls work that Melanie is leading, and there’s just some good stuff coming in. So I hope developers get involved and are as excited as we are.

Melanie: Major plus one to that. Thanks so much for having us on today.

Smashing Podcast Episode 34 With Harry Roberts: What’s The State Of Web Performance?

In this episode, we’re talking about Web Performance. What does the performance landscape look like in 2021? I spoke with expert Harry Roberts to find out.

Show Notes

Harry is running a Web Performance Masterclass workshop with Smashing in May 2021. At the time of publishing, big earlybird discounts are still available.

Weekly Update

Transcript

Drew McLellan: He’s an independent Consultant Web Performance Engineer from Leeds in the UK. In his role, he helps some of the world’s largest and most respected organizations deliver faster and more reliable experiences to their customers. He’s an invited Google Developer Expert, a Cloudinary Media Developer Expert, an award-winning developer, and an international speaker. So we know he knows his stuff when it comes to web performance, but did you know he has 14 arms and seven legs? My Smashing friends, please welcome Harry Roberts. Hi Harry, how are you?

Harry Roberts: Hey, I’m smashing thank you very much. Obviously the 14 arms, seven legs... still posing its usual problems. Impossible to buy trousers.

Drew: And bicycles.

Harry: Yeah. Well I have three and a half bicycles.

Drew: So I wanted to talk to you today, not about bicycles unfortunately, although that would be fun in itself. I wanted to talk to you about web performance. It’s a subject that I’m personally really passionate about but it’s one of those areas where I worry, when I take my eye off the ball and get involved in some sort of other work and then come back to doing a bit of performance work, I worry that the knowledge I’m working with goes out of date really quick... Is web performance as fast-moving these days as I perceive?

Harry: This is... I’m not even just saying this to be nice to you, that’s such a good question because I’ve been thinking on this quite a bit lately and I’d say there are two halves of it. One thing I would try and tell clients is that actually it doesn’t move that fast. Predominantly because, and this is the soundbite I always use, you can bet on the browser. Browsers aren’t really allowed to change fundamentally how they work, because, of course, there’s two decades of legacy they have to uphold. So, generally, if you bet on the browser and you know how those internals work, and TCP/IP that’s never changing... So the certain things that are fairly set in stone, which means that best practice will, by and large, always be best practice where the fundamentals are concerned.

Harry: Where it does get more interesting is... The thing I’m seeing more and more is that we’re painting ourselves into corners when it comes to site-speed issues. So we actually create a lot of problems for ourselves. So what that means realistically is performance... it’s the moving goalpost, I suppose. The more the landscape or the topography of the web changes, and the way it’s built and the way we work, we pose ourself new challenges. So the advent of doing a lot more work on the client poses different performance issues than we’d be solving five years ago, but those performance issues still pertain to browser internals which, by and large, haven’t changed in five years. So a lot of it depends... And I’d say there’s definitely two clear sides to it... I encourage my clients lean on the browser, lean on the standards, because they can’t just be changed, the goalposts don’t really move. But, of course, that needs to meld with more modern and, perhaps slightly more interesting, development practices. So you keep your... Well, I was going to say "A foot in both camps" but with my seven feet, I’d have to... four and three.

Drew: You mentioned that the fundamentals don’t change and things like TCP/IP don’t change. One of the things that did change in... I say "recent years", this is actually probably going back a little bit now but, is HTTP in that we had this established protocol HTTP for communicating between clients and servers, and that changed and then we got H2 which is then all binary and different. And that changed a lot of the... It was for performance reasons, it was to take away some of the existing limitations, but that was a change and the way we had to optimize for that protocol changed. Is that now stable? Or is it going to change again, or...

Harry: So one thing that I would like to be learning more about is the latter half of the question, the changing again. I need to be looking more into QUIC and H3 but it’s a bit too far around of the corner to be useful to my clients. When it comes to H2, things have changed quite a lot but I genuinely think H2 is a lot of false promise and I do believe it was rushed over the line, which is remarkable considering H1 was launched... And I mean 1.1, was 1997, so we have a lot of time to work on H2.

Harry: I guess the primary benefit is web developers who understand it or perceive it is unlimited in flight requests now. So rather than six dispatched and/or six in-flight requests at a time, potentially unlimited, infinite. Brings really interesting problems though because... it’s quite hard to describe without visual aids but you’ve still got the same amount of bandwidth available, whether you’re running H1 or H2, the protocol doesn’t make your connection any faster. So it’s quite possible that you could flood the network by requesting 24 files at once, but you don’t have enough bandwidth for that. So you don’t actually get any faster because you can only manage, perhaps, a fraction of that at a time.

Harry: And also what you have to think about is how the files respond. And this is another pro-tip I go through on client workshops et cetera. People will look at an H2 waterfall and they will see that instead of the traditional six dispatch requests they might see 24. Dispatching 24 requests isn’t actually that useful. What is useful is when those responses are returned. And what you’ll notice is that you might dispatch 24 requests, so your left-hand side of your waterfall looks really nice and steep, but they all return in a fairly staggered, sequential manner because you need to limit the amount of bandwidth so you can’t fulfill all response at the same time.

Harry: Well, the other thing is if you were to fulfill all response at the same time, you’d be interleaving responses. So you night get the first 10% of each file and the next 20%... 20% of a JavaScript file is useless. JavaScript isn’t usable until 100% of it has arrived. So what you’ll see is, in actual fact, the way an H2 waterfall manifests itself when you look at the response... It looks a lot more like H1 anyway, it’s a lot more staggered. So, H2, I think it was oversold, or perhaps engineers weren’t led to believe that there are caps on how effective it could be. Because you’ll see people overly sharding their assets and they might have twenty... let’s keep the number 24. Instead of having two big JS files, you might have 24 little bundles. They’ll still return fairly sequentially. They won’t all arrive at the same time because you’ve not magic-ed yourself more bandwidth.

Harry: And the other problem is each request has a constant amount of latency. So let’s say you’re requesting two big files and it’s a hundred millisecond roundtrip and 250 milliseconds downloading, that’s two times 250 milliseconds. If you multiply up to 24 requests, you’ve still got constant latency, which we’ve decided 100 milliseconds, so now you’ve got 2400 milliseconds of latency and 24 times... instead of 250 milliseconds download let’s say its 25 milliseconds download, it’s actually taken longer because the latency stays constant and you just multiply that latency over more requests. So I’ll see clients who will have read that H2 is this magic bullet. They’ll shard... Oh! They couldn’t simplify the development process, we don’t need to do bundling or concatenation et cetera, et cetera. And ultimately it will end up slower because you’ve managed to spread your requests out, which was the promise, but your latency stays constant so you’ve actually just got n times more latency in the browser. Like I said, really hard, probably pointless trying to explain that without visuals, but it’s remarkable how H2 manifests itself compared to what people are hoping it might do.

Drew: Is there still benefit in that sharding process in that, okay, to get the whole lot still takes the same amount of time but by the time you get 100% of the first one 24th back you can start working on it and you can start executing it before the 24th is through.

Harry: Oh, man, another great question. So, absolutely, if things go correctly and it does manifest itself in a more H1 looking response, the idea would be file one returns first, two, three, four, and then they can execute in the order they arrive. So you can actually shorten the aggregate time by assuring that things arrive at the same time. If we have a look at a webpage instead of waterfall, and you notice that requests are interleaved, that’s bad news. Because like I said, 10% of a JavaScript file is useless.

Harry: If the server does its job properly and it sends, sends, sends, sends, send, then it will get faster. And then you’ve got knock-on benefits of your cacheing strategy can be more granular. So really annoying would be you update the font size on your date picker widget. In H1 world you’ve got to cache bust perhaps 200 kilowatts of your site’s wide CSS. Whereas now, you just cache bust datepicker.css. So we’ve got offshoot benefits like that, which are definitely, definitely very valuable.

Drew: I guess, in the scenario where you magically did get all your requests back at once, that would obviously bog down the client potentially, wouldn’t it?

Harry: Yeah, potentially. And then what would actually happen is the client would have to do a load of resource scheduling so what you’d end up with is a waterfall where all your responses return at the same time, then you’d have a fairly large gap between the last response arriving and its ability to execute. So ideally, when we’re talking about JavaScript, you’d want the browser to request them all in the request order, basically the order you defined them in, the server to return them all in the correct order so then the browser can execute them in the correct order. Because, as you say, if they all returned at the same time, you’ve just got a massive JavaScript to run at once but it still needs to be scheduled. So you could have a doubter of up to second between a file arriving and it becoming useful. So, actually, H1... I guess, ideally, what you’re after is H2 request scheduling, H1 style responses, so then things can be made useful as they arrive.

Drew: So you’re basically looking for a response waterfall that looks like you could ski down it.

Harry: Yeah, exactly.

Drew: But you wouldn’t need a parachute.

Harry: Yeah. And it’s a really difficult... I think to say it out loud it sounds really trivial, but given the way H2 was sold, I find it quite... not challenging because that makes my client sound... dumb... but it’s quite a thing to to explain to them... if you think about how H1 works, it wasn’t that bad. And if we get responses that look like that and "Oh yeah, I can see it now". I’ve had to teach performance engineers this before. People who do what I do. I’ve had to teach performance engineers that we don’t mind too much when requests were made, we really care about when responses become useful.

Drew: One of the reasons things seem to move on quite quickly, especially over the last five years, is that performance is a big topic for Google. And when Google puts weight behind something like this then it gains traction. Essentially though, performance is an aspect of user experience, isn’t it?

Harry: Oh, I mean... this is a really good podcast, I was thinking about this half an hour ago, I promise you I was thinking about this half an hour ago. Performance is applied accessibility. You’re guaranteeing or increasing the chances that someone can access your content and I think accessibility is always just... Oh it’s screen readers, right? It’s people without sight. The decisions to build a website rather than an app... the decisions are access more of an audience. So yeah, performance is applied accessibility, which is therefore the user experience. And that user experience could come down to "Could somebody even experience your site" full stop. Or it could be "Was that experience delightful? When I clicked a button, did it respond in a timely manner?". So I 100% agree and I think that’s a lot of the reason why Google are putting weight on it, is because it affects the user experience and if someone’s going to be trusting search results, we want to try and give that person a site that they’re not going to hate.

Drew: And it’s... everything that you think about, all the benefits you think about, user experience, things like increased engagement, it’s definitely true isn’t it? There’s nothing that sends the user away from a site more quickly than a sluggish experience. It’s so frustrating, isn’t it? Using a site where you know that maybe the navigation isn’t that clear and if you click through to a link and you think "Is this what I want? Is it not?" And just the cost of making that click, just waiting, and then you’ve got to click the back button and then that waiting, and it’s just... you give up.

Harry: Yeah, and it makes sense. If you were to nip to the supermarket and you see that it’s absolutely rammed with people, you’ll do the bare minimum. You’re not going to spend a lot of money there, it’s like "Oh I just need milk", in and out. Whereas if it’s a nice experience, you’ve got "Oh, well, while I’m here I’ll see if... Oh, yeah they’ve got this... Oh, I’ll cook this tomorrow night" or whatever. I think still, three decades into the web, even people who build for the web struggle, because it’s intangible. They struggle to really think that what would annoy you in a real store would annoy you online, and it does, and the stats show that it has.

Drew: I think that in the very early days, I’m thinking late 90s, showing my age here, when we were building websites we very much thought about performance but we thought about performance from a point of view that the connections that people were using were so slow. We’re talking about dial-up, modems, over phone lines, 28K, 56K modems, and there was a trend at one point with styling images that every other line of the image would blank out with a solid color to give this... if you can imagine it like looking through a venetian blind at the image. And we did that because it helped with the compression. Because every other line the compression algorithm could-

Harry: Collapse into one pointer.

Drew: Yeah. And so you’ve significantly reduced your image size while still being able to get... And it became a design element. Everybody was doing it. I think maybe Jeffrey Zeldman was one of the first who pioneered that approach. But what we were thinking about there was primarily how quickly could we get things down the wire. Not for user experience, because we weren’t thinking about... I mean I guess it was user experience because we didn’t want people to leave our sites, essentially. But we were thinking about not optimizing things to be really fast but trying to avoid them being really slow, if that makes sense.

Harry: Yeah, yeah.

Drew: And then, I think as speeds like ADSL lines became more prevalent, that we stopped thinking in those terms and started just not thinking about it at all. And now we’re at the situation where we’re using mobile devices and they’ve got constrained connections and perhaps slower CPUs and we’re having to think about it again, but this time in terms of getting an advantage. As well as the user experience side of things, it can have real business benefits in terms of costs and ability to make profit. Hasn’t it?

Harry: Yeah, tremendously. I mean, not sure how to word it. Not shooting myself in the foot here but one thing I do try and stress to clients is that site-speed is going to give you a competitive advantage but it’s only one thing that could give you some competitive advantage. If you’ve got a product no one wants to buy then it doesn’t matter how fast your site is. And equally, if someone genuinely wants the world’s fastest website, you have to delete your images, delete your CSS, delete your JavaScript, and then see how many products you tell, because I guarantee site-speed wasn’t the factor. But studies have shown that there’s huge benefits of being fast, to the order of millions. I’m working with a client as we speak. We worked out for them that if they could render a given page one second faster, or rather their largest content for paint was one second faster, it’s worth 1.8 mil a year, which is... that’s a big number.

Drew: That would almost pay your fee.

Harry: Hey! Yeah, almost. I did say to them "Look, after two years this’ll be all paid off. You’ll be breaking even". I wish. But yeah, does the client-facing aspect... sorry, the customer-facing aspect of if you’ve got an E-Com site, they’re going to spend more money. If you’re a publisher, they’re going to read more of an article or they will view more minutes of content, or whatever you do that is your KPI that you measure. It could be on the Smashing site, it could be they didn’t bounce, they actually click through a few more articles because we made it really easy and fast. And then faster sites are cheaper to run. If you’ve got your cacheing strategy sorted you’re going to keep people away from your servers. If you optimize your assets, anything that does have to come from your server is going to weight a lot less. So much cheaper to run.

Harry: The thing is, there’s a cost in getting there. I think Scott Jehl probably said one of the most... And I heard it from him first, so I’m going to assume he came up with it but the saying is "It’s easy to make a fast website but it’s difficult to make a website fast". And that is just so succinct. Because the reason web perf might get pushed down the list of things to do is because you might be able to say to a client "If I make your site a second faster you’ll make an extra 1.8 mil a year" or it can be "If you just added Apple Pay to your checkout, you’re going to make an extra five mil." So it’s not all about web perf and it isn’t the deciding factor, it is one part of a much bigger strategy, especially for E-Com online. But the evidence is that I’ve measured it firsthand with my retail clients, my E-Com clients. The case for it is right there, you’re absolutely right. It’s competitive advantage, it will make you more money.

Drew: Back in the day, again, I’m harping back to a time past, but people like Steve Souders were some of the first people to really start writing and speaking about web performance. And people like Steve were basically saying "Forget the backend infrastructure, where all the gains to be had are in the browser, in the front end, that’s where everything slow happens." Is that still the case 15 years on?

Harry: Yeah, yeah. He reran the test in between way back then and now, and the gap had actually widened, so it’s actually more costly over the wire. But there is a counter to that, which is if you’ve got really bad backend performance, if you set out of the gate slowly, there’s only so much you can claw back on the front end. I got a client at the moment, their time to first byte is 1.5 seconds. We can never render faster than 1.5 seconds therefore, so that’s going to be a cap. We can still claw time back on the front end but if you’ve got a really, really bad time to first byte, you have got backend slow downs, there’s a limit on how much faster your front end performance efforts could get you. But absolutely.

Harry: That is, however, changing because... Well, no it’s not changing I guess, it’s getting worse. We’re pushing more onto the client. It used to be a case of "Your server is as fast as it is but then after that we’ve got a bunch of question marks." because I hear this all the time "All our users run on WiFi. They’ve all got desktop machines because they all work from our office." Well, no, now they’re all working from home. You don’t get to choose. So, that’s where all the question marks come in which is where the slow downs happen, where you can’t really control it. After that, the fact that now we are tending to put more on the client. By that I mean, entire run times on the client. You’ve moved all your application logic off of a server anyway so your time to first byte should be very, very minimal. It should be a case of sending some bundles from a CDM to my... but you’ve gone from being able to spec to your own servers to hoping that somebody’s not got Netflix running on the same machine they’re trying to view your website on.

Drew: It’s a really good point about the way that we design sites and I think the traditional best practice has always been you should try and cater for all sorts of browsers, all sorts of connection speeds, all sorts of screen sizes, because you don’t know what the user is going to be expecting. And, as you said, you have these scenarios where people say "Oh no we know all our users are on their work-issued desktop machine, they’re running this browser, it’s the latest version, they’re hardwired into the LAN" but then things happen. One of the great benefits of having web apps is that we can do things like distribute our work force suddenly back all to their homes and they can keep working, but that only holds true if the quality of the engineering was such that then somebody who’s spinning up their home machine that might have IE11 on it or whatever, whether the quality of the work is there that actually means that the web fulfills its potential in being a truly accessible medium.

Drew: As you say, there’s this trend to shift more and more stuff into the browser, and, of course, then if the browser is slow, that’s where the slowness happens. You have to wonder "Is this a good trend? Should we be doing this?" I’ve got one site that I particularly think of, noticed that is almost 100% server rendered. There’s very little JavaScript and it is lightning fast. Every time I go to it I think "Oh, this is fast, who wrote this?" And then I realize "Oh yeah, it was me".

Harry: That’s because you’re on localhost, no wonder it feels fast. It’s your dev site.

Drew: Then, my day job, we’re building out our single page application and shifting stuff away from the server because the server’s the bottleneck in that case. Can you just say that it’s more performant to be in the browser? Or more performant to be on the server? Is it just a case of measuring and taking it on a case-by-case basis?

Harry: I think you need to be very, very, very aware of your context and... genuinely I think an error is... narcissism where people think "Oh, my blog deserves to be rendered in someone’s browser. My blog with a bounce rate of 89% needs its own runtime in the browser, because I need subsequent navigations to be fast, I just want to fetch a... basically a diff of the data." No one’s clicking onto your next article anyway, mate, don’t push a runtime down the pipe. So you need to be very aware of your context.

Harry: And I know that... if Jeremy Keith’s listening to this, he’s going to probably put a hit out on me, but there is, I would say, a difference between a website and a web app and the definition of that is very, very murky. But if you’ve got a heavily read and write application, so something where you’re inputting data, manipulating data, et cetera. Basically my site is not a web app, it’s a website, it’s read only, that I would firmly put in the website camp. Something like my accountancy software is a web app, I would say is a web app and I am prepared to suffer a bit of boot time cost, because I know I’ll be there for 20 minutes, an hour, whatever. So you need a bit of context, and again, maybe narcissism’s a bit harsh but you need to have a real "Do we need to make this newspaper a client side application?" No, you don’t. No, you don’t. People have got ad-blocker on, people don’t like commuter newspaper sites anyway. They’re probably not even going to read the article and rant about it on Facebook. Just don’t build something like that as a client rendered application, it’s not suitable.

Harry: So I do think there is definitely a point at which moving more onto the client would help, and that’s when you’ve got less sensitivity to churn. So any com type, for example, I’m doing an audit for a moment for a site who... I think it’s an E-Com site but it’s 100% on the client. You disable JavaScript and you see nothing, just an empty div id="app". E-Com is... you’re very sensitive to any issues. Your checkout flow is even subtly wrong, I’m off somewhere else. It’s too slow, I’m off somewhere else. You don’t have the context where someone’s willing to bed in to that app for a while.

Harry: Photoshop. I pop open Photoshop and I’m quite happy to know that it’s going to take 45 seconds of splash screen because I’m going to be in there for... basically the 45 seconds is worth the 45 minutes. And it’s so hard to define, which is why I really struggle to convince clients "Please don’t do this" because I can’t just say "How long do you think your user’s going to be there for". And you can prox it from... if your bounce rate’s 89% don’t optimize for a second page view. Get that bounce rate down first. I do think there’s definitely a split but what I would say is that most people fall on the wrong side of that line. Most people put stuff in the client that shouldn’t be there. CNN, for example, you cannot read a single headline on the CNN website until it is fully booted a JavaScript application. The only thing server rendered is the header and footer which is the only thing people don’t care about.

Harry: And I feel like that is just... I don’t know how we arrive at that point. It’s never going to be the better option. You deliver a page that is effectively useless which then has to say "Cool, I’ll go fetch what would have been a web app but we’re going to run it in the browser, then I’ll go and ask for a headline, then you can start to... oh, you’re gone." That really, really irks me.

Harry: And it’s no one’s fault, I think it’s the infancy of this kind of JavaScript ecosystem, the hype around it, and also, this is going to sound really harsh but... It’s basically a lot of naïve implementation. Sure, Facebook have invented React and whatever, it works for them. Nine times out of 10 you’re not working at Facebook scale, 95 times out of 100 you’re probably not the smartest Facebook engineers, and that’s really, really cruel and it sounds horrible to say, but you can only get... None of these things are fast by default. You need a very, very elegant implementation of these things to make them correct.

Harry: I was having this discussion with my old... he was a lead engineer on the squad that I was on 10 years ago at Sky. I was talking to him the other day about this and he had to work very hard to make a client rendered app fast, whereas making a server rendered app fast, you don’t need to do anything. You just need to not make it slow again. And I feel like there’s a lot of rose tinted glasses, naivety, marketing... I sound so bleak, we need to move on before I start really losing people here.

Drew: Do you think we have the tendency, as an industry, to focus more on developer experience than user experience sometimes?

Harry: Not as a whole, but I think that problem crops up in a place you’d expect. If you look at the disparity... I don’t know if you’ve seen this but I’m going to presume you have, you seem to very much have your finger on the pulse, the disparity between HTTP archive’s data about what frameworks and JavaScript libraries are used in the wild versus the state of JavaScript survey, if you follow the state of JavaScript survey it would say "Oh yes, 75% of developers are using React" whereas fewer than 5% of sites are using React. So, I feel like, en masse, I don’t think it’s a problem, but I think in the areas you’d expect it, heavy loyalty to one framework for example, developer experience is... evangelized probably ahead of the user. I don’t think developer experience should be overlooked, I mean, everything has a maintenance cost. Your car. There was a decision when it was designed that "Well, if we hide this key, that functionality, from a mechanic, it’s going to take that mechanic a lot longer to fix it, therefore we don’t do things like that". So there does need to be a balance of ergonomics and usability, I think that is important. I think focusing primarily on developer experience is just baffling to me. Don’t optimize for you, optimize for your customer, your customer pays you it’s not the other way around.

Drew: So the online echo chamber isn’t exactly representative of reality when you see everybody saying "Oh you should be using this, you should be doing that" then that’s actually only a very small percentage of people.

Harry: Correct, and that’s a good thing, that’s reassuring. The echo chamber... it’s not healthy to have that kind of monoculture perhaps, if you want to call it that. But also, I feel like... and I’ve seen it in a lot of my own work, a lot of developers... As a consultant, I work with a lot of different companies. A lot of people are doing amazing work in WordPress. And WordPress powers 24% of the web. And I feel like it could be quite easy for a developer like that working in something like WordPress or PHP on the backend, custom code, whatever it is, to feel a bit like "Oh, I guess everyone’s using React and we aren’t" but actually, no. Everyone’s talking about React but you’re still going with the flow, you’re still with the majority. It’s quite reassuring to find the silent majority.

Drew: The trend towards static site generators and then hosting sites entirely on a CDN, sort of JAMstack approach, I guess when we’re talking about those sorts of publishing type sites, rather than software type sites, I guess that’s a really healthy trend, would you think?

Harry: I love that, absolutely. You remember when we used to call SSG "flap file", right?

Drew: Yeah.

Harry: So, I built CSS Wizardry on Jekyll back when Jekyll was called a flap file website. But now we service our generator, huge, huge fan of that. There’s no disadvantage to it really, you pay maybe a slightly larger up front compute cost of pre-compiling the site but then your compute cost is... well, Cloudflare fronts it, right? It’s on a CDN so your application servers are largely shielded from that.

Harry: Anything interactive that does need doing can be done on the client or, if you want to get fancy, what one really nice approach, if you are feeling ambitious, is use Edge Side Includes so you can keep your shopping cart server rendered, but at the edge. You can do stuff like that. Tremendous performance benefits there. Not appropriate for a huge swathe of sites, but, like you say, if we’re thinking publishing... an E-Com site it wouldn’t work, you need realtime stock levels, you need... search that doesn’t just... I don’t know you just need far more functionality. But yeah, I think the Smashing site, great example, my site is an example, much smaller than Smashing but yeah, SSG, flap filers, I’m really fond of it.

Drew: Could it work going deeper into the JAMstack approach of shifting everything into the client and building an E-Commerce site? I think the Smashing E-Commerce site is essentially using JavaScript in the client and server APIs to do the actual functionality as service functions or what have you.

Harry: Yeah. I’ve got to admit, I haven’t done any stuff with serverless. But yeah, that hybrid approach works. Perhaps my E-Commerce example was a bit clunky because you could get a hybrid between statically rendering a lot of the stuff, because most things on an E-Com site don’t really change. You filter what you can do on the client. Search, a little more difficult, stock levels does need to go back to an API somewhere, but yeah you could do a hybrid for a definite, for an E-Com site.

Drew: Okay, so then it’s just down to monitoring all those performance metrics again, really caring about the network, about latency, about all these sorts of things, because you’re then leaning on the network a lot more to fetch all those individual bits of data. It hosts a new set of problems.

Harry: Yeah, I mean you kind of... I wouldn’t say "Robbing Peter to pay Paul" but you are going to have to keep an eye on other things elsewhere. I’ve not got fully to the bottom of it, before anyone tweets it at us, but a client recently moved to an E-Commerce client. I worked with them two years ago and that site was already pretty fast. It was built on... I can’t remember which E-Com platform, it was .net, hosted on IIS, server rendered, obviously, and it was really fast because of that. It was great and we just wanted to maintain, maybe find a couple of hundred milliseconds here and there, but really good. Half way through last year, they moved to client side React for key pages. PP... product details page, product listing page, and stuff just got marketable slower lower, much slower. To the point they got back in touch needing help again.

Harry: And one of the interesting things I spotted when they were putting a case for "We need to actually revert this". I was thinking about all the...what’s slower, obviously it’s slower, how could doing more work ever be faster, blah blah blah. One of their own bullet points in the audit was: based on projections, their yearly hosting costs have gone up by a factor of 10 times. Because all of a sudden they’ve gone from having one application server and a database to having loads of different gateways, loads of different APIs, loads of different microservers they’re calling on. It increased the surface area of their application massively. And the basic reason for this, I’ll tell you exactly why this happened. The developer, it was a very small team, the developer who decided "I’m going to use React because it seems like fun" didn’t do any business analysis. It was never expected of them to actually put forward a case of how much is it going to cost the dude, how much is it going to return, what’s the maintenance cost of this?

Harry: And that’s a thing I come up against really frequently in my work and it’s never the developer’s fault. It’s usually because the business keeps financials away from the engineering team. If your engineers don’t know the cost or value of their work then they’re not informed to make those decisions so this guy was never to know that that was going to be the outcome. But yeah, interestingly, moving to a more microservice-y approach... And this is an outlier, and I’m not going to say that that 10 times figure is typical, it definitely seems atypical, but it’s true that there is at least one incident I’m aware of when moving to this approach, because they just had to use more providers. It 10x’ed their... there’s your 10 times engineer, increased hosting by 10 times.

Drew: I mean, it’s an important point, isn’t it? Before starting out down any particular road with architectural changes and things about doing your research and asking the right questions. If you were going to embark on some big changes, say you’ve got a really old website and you’re going to structure it and you want it to be really fast and you’re making all your technology choices, I mean it pays, doesn’t it, to talk to different people in the business to find out what they want to be doing. What sort of questions should you be asking other people in the business as a web developer or as a performance engineer? Who should you be talking to you and what should you be asking them?

Harry: I’ve got a really annoying answer to the "Who should you be talking to?" And the answer is everyone should be available to you. And it will depend on the kind of business, but you should be able to speak to marketing "Hey, look, we’re using this AB testing tool. How much does that cost as a year and how much do you think it nets as a year?" And that developer should feel comfortable. I’m not saying developers need to change their attitude, what I mean is the company should make the developers able to ask those kind of questions. How much does Optimizely cost as a year? Right, well that seems like a lot, does it make that much in return? Okay, whatever we can make a decision based on that. That’s who you should be talking to and then questions you should ask, it should be things like...

Harry: The amount of companies I work will, they won’t give their own developers to Google Analytics. How are you meant to build a website if you don’t know who you’re building it for? So the question should be... I work a lot with E-Com clients so every developer should things like "What is our average order value? What is our conversion rate? What is our revenue, how much do we make?" These things mean that you can at least understand that "Oh, people spend a lot of money on this website and I’m responsible for a big chunk of that and I need to take that responsibility."

Harry: Beyond that, other things are hard to put into context, so for me, one of things that I, as a consultant, so this is very different to an engineer in the business, I need to know how sensitive you are to performance. So if a client gives me the average order value, monthly traffic, and their conversion rate, I can work out how much 100 milliseconds, 500 a second will save them a year, or return them, just based on those three numbers I can work out roughly "Well a second’s worth 1.8 mil". It’s a lot harder for someone in the business to get all the back information because as a performance engineer it’s second nature to me. But if you can work that kind of stuff out, it unlocks a load of doors. Okay, well if a second’s work this much to us, I need to make sure that I never lose a second and if I can, gain a second back. And that will inform a lot of things going forward. A lot of these developers are kept quite siloed. "Oh well, you don’t need to know about business stuff, just shut up and type".

Drew: I’ve heard you say, it is quite a nice soundbite, that nobody wants a faster website.

Harry: Yeah.

Drew: What do you mean by that?

Harry: Well it kind of comes back to, I think I’ve mentioned it already in the podcast, that if my clients truly wanted the world’s fastest website, they would allow me to go in and delete all their JavaScript, all their CSS, all their images. Give that customer a Times New Roman stack.

Harry: But fast for fast sake is... not chasing the wrong thing but you need to know what fast means to you, because, I see it all the time with clients. There’s a point at which you can stop. You might find that your customer’s only so sensitive to web perf that it might mean that getting a First Contentful Paint from four seconds to two seconds might give you a 10% increase in revenue, but getting from that two to a one, might only give you a 1% increase. It’s still twice as fast, but you get minimal gains. So what I need to do with my clients is work out "How sensitive are you? When can we take our foot off the gas?" And also, like I said, towards the top of the show... You need to have a product that people want to buy.

Harry: If people don’t want to buy your product, it doesn’t matter how quickly you show them it, it’ll just disgust them faster, I guess. Is your checkout flow really, really, really seamless on mobile, for example. So there’s a number of factors. For me, and my clients, it’ll be working out a sweet spot, to also working out "If getting from here to here is going to make you 1.8 mil a year, I can find you that second for a fraction of that cost." If you want me to get you an additional second on top of that, it’s going to get a lot harder. So my cost to you will probably go up, and that won’t be an extra 1.8, because it’s not lineal, you don’t get 1.8 mil for every one second.

Harry: It will tail off at some point. And clients will get to a point where... they’ll still be making gains but it might be a case of your engineering effort doubles, meaning your returns halve, you can still be in the green, hopefully it doesn’t get more expensive and you’re losing money on performance, but there’s a point where you need to slow down. And that’s usually things that I help clients find out because otherwise they will just keep chasing speed, speed, speed and get a bit blinkered.

Drew: Yeah, it is sort of diminishing returns, isn’t it?

Harry: That’s what I was look for-

Drew: Yeah.

Harry: ... diminishing returns, that’s exactly it. Yeah, exactly.

Drew: And in terms of knowing where to focus your effort... Say you’ve got the bulk of your users, 80% of your users are getting a response within two, three seconds, and then you’ve got 20% who may be in the long-tail that might end up with responses five, ten seconds. Is it better to focus on that 80% where the work’s really hard, or is it better to focus on the 20% that’s super slow, where the work might be easier, but it’s only 20%. How do you balance those sorts of things?

Harry: Drew, can you write all podcast questions for everyone else? This is so good. Well, a bit of a shout out to Tim Kadlec, he’s done great talks on this very topic and he calls it "The Long-Tail of Web Performance" so anyone listening who wants to look at that, Tim’s done a lot of good firsthand work there. The 80, 20, let’s just take those as good example figures, by the time you’re dealing with the 80th percentile, you’re definitely in the edge cases. All your crooks and web file data is based around 75th percentile. I think there’s a lot of value investing in that top 20th percentile, the worst 20%. Several reasons for this.

Harry: First thing I’m going to start with is one of the most beautiful, succinct soundbites I’ve ever heard. And the guy who told me it, I can guarantee, did not mean it to be this impactful. I was 15 years old and I was studying product design, GCSE. Finally, a project, it was a bar stool so it was a good sign of things to come. And we were talking about how you design furniture. And my teacher basically said... I don’t know if I should... I’m going to say his name, Mr. Brocklesby.

Harry: He commanded respect but he was one of the lads, we all really liked him. But he was massive in every dimension. Well over six foot tall, but just a big lad. Big, big, big, big man. And he said to us "If you were to design a doorway, would you design it for the average person?" And 15 year old brains are going "Well yeah, if everyone’s roughly 5’9 then yeah" He was like "Well, immediately, Harry can’t use that door." You don’t design for the average person, you design for the extremities because you want it to be useful to the most people. If you designed a chair for the average person, Mr. Brocklesby wasn’t going to fit in it. So he taught me from a really, really age, design to your extremities.

Harry: And where that becomes really interesting in web perf is... If you imagine a ladder, and you pick up the ladder by the bot... Okay I’ve just realized my metaphor might... I’ll stick with it and you can laugh at me afterwards. Imagine a ladder and you lift the ladder up by the bottom rungs. And that’s your worst experiences. You pick the bottom rung in the ladder to lift it up. The whole ladder comes with it, like a rising tide floats all boats. The reason that metaphor doesn’t work is if you pick a ladder up by the top rung, it all lifts as well, it’s a ladder. And the metaphor doesn’t even work if I turn it into a rope ladder, because a rope ladder then, you lift the bottom rung and nothing happens but... my point is, if you can improve experience for your 90th percentile, it’s got to get that up for your 10th percentile, right?

Harry: And this is why I tell clients, they’ll say to me things like "Oh well most of our users are on 4G on iPhones" so like all right, okay, and we start testing 3G on Android, like "No, no, most of our users are iPhones" okay... that means your average user’s going to have a better experience but anyone who isn’t already in the 50th percentile just gets left further behind. So set the bar pretty high for yourself by setting expectations pretty low.

Harry: Sorry, I’ve got a really bad habit of giving really long answers to short questions. But it was a fantastic question and, to try and wrap up, 100% definitely I agree with you that you want to look at that long-tail, you want to look at that... your 80th percentile because if you take all the experiences on the site and look at the median, and you improve the median, that means you’ve made it even better for people who were already quite satisfied. 50% of people being effectively ignored is not the right approach. And yeah, it always comes back to Mr Brocklesby telling me "Don’t design for the average person because then Harry can’t use the door". Oh, for anyone listening, I’m 193 centimeters, so I’m quite lanky, that’s what that is.

Drew: And all those arms and legs.

Harry: Yeah. Here’s another good one as well. My girlfriend recently discovered the accessibility settings in iOS... so everyone has their phone on silent, right? Nobody actually has a phone that actually rings, everyone’s got it on silent. She found that "Oh you know, you can set it so that when you get a message, the flash flashes. And if you tap the back of the phone twice, it’ll do a screenshot." And these are accessibility settings, these are designed for that 95th percentile. Yet she’s like "Oh, this is really useful".

Harry: Same with OXO Good Grips. OXO Good Grips, the kitchen utensils. I’ve got a load of them in the kitchen. They’re designed because the founder’s wife had arthritis and he wanted to make more comfortable utensils. He designed for the 99th percentile, most people don’t have arthritis. But by designing for the 99th percentile, inadvertently, everyone else is like "Oh my God, why can’t all potato peelers be this comfortable?" And I feel like it’s really, really... I like a feel-good or anecdote that I like to wheel out in these sort of scenarios. But yeah, if you optimize for them... Well, a rising tide floats all boats and that therefore optimizes the tail-end of people and you’re going to capture a lot of even happier customers above that.

Drew: Do you have the OXO Good Grips manual hand whisk?

Harry: I don’t. I don’t, is it good?

Drew: Look into it. It’s so good.

Harry: I do have the OXO Good Grips mandolin slicer which took the end of my finger off last week.

Drew: Yeah, I won’t get near one of those.

Harry: Yeah, it’s my own stupid fault.

Drew: Another example from my own experience with catering for that long-tail is that, in the project I’m working on at the moment, that long-tail is right at the end, you’ve got people with the slowest performance, but if it turns out if you look at who those customers are, they’re the most valuable customers to the business-

Harry: Okay.

Drew: ... because they are the biggest organizations with the most amount of data.

Harry: Right.

Drew: And so they’re hitting bottlenecks because they have so much data to display on a page and those pages need to be refactored a little bit to help that use case. So they’re having the slowest experience and they’re, when it comes down to it, paying the most money and making so much more of a difference than all of the people having a really fast experience because they’re free users with a tiny amount of data and it all works nice and it is quick.

Harry: That’s a fascinating dimension, isn’t it? In fact, I had a similar... I had nowhere near the business impact as what you’ve just described, but I worked with a client a couple of years ago, and their CEO got in touch because their site was slow. Like, slow, slow, slow. Really nice guy as well, he’s just a really nice down to earth guy, but he’s mentored, like proper rich. And he’s got the latest iPhone, he can afford that. He’s a multimillionaire, he spends a lot of his time flying between Australia, where he is from, and Estonia, where he is now based.

Harry: And he’s flying first class, course he is. But it means most of his time on his nice, shiny iPhone 12 Pro Max whatever, whatever, is over airplane WiFi, which is terrible. And it was this really amazing juxtaposition where he owns the site and he uses it a lot, it’s a site that he uses. And he was pushing it... I mean easily their richest customer was their CEO. And he’s in this weirdly privileged position where he’s on a worse connection than Joe Public because he’s somewhere above Singapore on a Quantas flight getting champagne poured down his neck, and he’s struggling. And that was a really fascinating insight that... Oh yeah, because you’ve got your 95th percentile can basically can go in either direction.

Drew: Yeah, it’s when you start optimizing for using a site with a glass of champagne in one hand that you think "Maybe we’re starting to lose the way a bit."

Harry: Yeah, exactly.

Drew: We talked a little bit about measurement of performance, and in my own experience with performance work it’s really essential to measure everyhtin.g A so you can identify where problems are but B so that when you actually start tackling something you can tell if you’re making a different and how much of a difference you’re making. How should we be going about measuring the performance of our sites? What tools can we use and where should we start?

Harry: Oh man, another great question. So there’s a range of answers depending on how much time, resources, inclination there is towards fixing site speed. So what I will try and do with client is... Certain off the shelf metrics are really good. Load time, do not care about that anymore. It’s very, very, very... I mean, it’s a good proxy if your load time’s 120 seconds I’m going to guess you don’t have a very fast website, but it’s too obscure and it’s not really customer facing. I actually think vitals are a really good step in the right direction because they do measure user experience but they’re based on technical input. Largest Contentful Paint is a really nice thing to visual but the technical stuff there is unblock your critical path, make sure hero images arrive quickly and make sure your web font strategy is decent. There’s a technical undercurrent to these metrics. Those are really good off the shelf.

Harry: However, if clients have got the time, it’s usually time, because you want to capture the data but you need time to actually capture the data. So what I try and do with clients is let’s go "Look, we can’t work together for the next three months because I’m fully booked. So, what we can do is really quickly set you up with a free trial of Speedcurve, set up some custom metrics" so that means that for a publisher client, a newspaper, I’d be measuring "How quickly was the headline of the article rendered? How quickly was the lead image for the article rendered?" For an E-Commerce client I want to measure, because obviously you’re measuring things like start render passively. As soon as you start using any performance monitoring software, you’re capturing your actual performance metrics for free. So your First Contentful Paint, Largest Contentful, etc. What I really want to capture is things that matter to them as a business.

Harry: So, working with an E-Com client at the moment where we are able to correlate... The faster your start render, what is the probability to an adding to cart. If you can show them a product sooner, they’re more likely to buy it. And this is a lot of effort to set up, this is kind of the stretch goal for clients who are really ambition, but anything that you really want to measure, because like I say, you don’t really want to measure what your Largest Contentful Paint is, you want to measure your revenue and was that influenced by Large Contentful Paint? So the stretch goal, ultimate thing, would be anything you would see as a KPI for that business. It could be, on newspapers, how far down the article did someone scroll? And does that correlate in any way to first input delay? Did people read more articles if CLS was lower? But then before we start doing custom, custom metrics, I honestly think web vitals is a really good place to start and it’s also been quite well normalized. It becomes a... I don’t know what the word is. Lowest common denominator I guess, where everyone in the industry now can discuss performance on this level playing field.

Harry: One problem I’ve got, and I actually need to set up a meeting with the vitals team, is I also really think Lighthouse is great, but CLS is 33% of web vitals. You’ve got LCP, FID, CLS. CLS is 33% of your vitals. Vitals is what normally goes in front of your marketing team, your analytics department, because it pops up in search console, it’s mentioned in context of search results pages, whereas vitals is concerned, you’ve got heavy weighting, 33%, a third of vitals is CLS, it’s only 5% of our Lighthouse score. So what you’re going to get is developers who build around Lighthouse, because it can be integrated into tooling, it’s a lab metric. Vitals is field data, it’s rum.

Harry: So you’ve got this massive disconnect where you’ve got your marketing team saying "CLS is really bad" and developers are thinking "Well it’s 5% of the Lighthouse score that DevTools is giving me, it’s 5% of the score that Lighthouse CLI gives us in CircleCI" or whatever you’re using, yet for the marketing team its 33% of what they care about. So the problem there is a bit of a disconnect because I do think Lighthouse is very valuable, but I don’t know how they reconcile that fairly massive difference where in vitals, CLS is 33% of your score... well, not score because you don’t really have one, and Lighthouse is only 5%, and it’s things like that that still need ironing out before we can make this discussion seamless.

Harry: But, again, long answer to a short question. Vitals is really good. LCP is a good user experience metric which can be boiled down to technical solutions, same with CLS. So I think that’s a really good jump off point. Beyond that, it’s custom metrics. What I try and get my clients to is a point where they don’t really care how fast their site is, they just care that they make more money from yesterday, and if it did is that because it was running fast? If it made less is that because it was running slower? I don’t want them to chase a mystical two second LCP, I want them to chase the optimal LCP. And if that actually turns out to be slower than what you think, then whatever, that’s fine.

Drew: So, for the web developer who’s just interested in... they’ve not got budget to spend on tools like Speedcurve and things, they can obviously run tools like Lighthouse just within their browser, to get some good measurement... Are things like Google Analytics useful for that level?

Harry: They are and they can be made more useful. Analytics, for many years now, has captured rudimentary performance information. And that is going to be DNS time, TCP and TLS, time to first byte, page download time, which is a proxy... well, whatever, just page download time and load time. So fairly clunky metrics. But it’s a good jump off point and normally every project I start with a client, if they don’t have New Relic or Speedcurve or whatever, I’ll just say "Well let me have a look at your analytics" because I can at least proxy the situation from there. And it’s never going to be anywhere near as good as something like Speedcurve or New Relic or Dynatrace or whatever. You can send custom metrics really, really, really easily off to analytics. If anyone listening wants to be able to send... my site for example. I’ve got metrics like "How quickly can you read the heading of one of my articles? At what point was the About page image rendered? At what point was the call to action that implores you to hire me? How soon is that rendered to screen?" Really trivial to capture this data and almost as trivial to send it to analytics. So if anyone wants to view source on my site, scroll down to the closing body tag and find the analytics snippet, you will see just how easy it is for me to capture custom data and send that off to analytics. And, in the analytics UI, you don’t need to do anything. Normally you’d have to set up custom reports and mine the data and make it presentable. These are a first class citizen in Google Analytics. So the moment you start capturing custom analytics, there’s a whole section of the dashboard dedicated to it. There’s no setup, no heavy lifting in GA itself, so it’s really trivial and, if clients are on a real budget or maybe I want to show them the power of custom monitoring, I don’t want to say "Oh yeah, I promise it’ll be really good, can I just have 24 grand for Speedcurve?" I can start by just saying "Look, this is rudimentary. Let’s see the possibilities here, now we can maybe convince you to upgrade to something like Speedcurve."

Drew: I’ve often found that my gut instinct on how fast something should be, or what impact a change should have, can be wrong. I’ll make a change and think I’m making things faster and then I measure it and actually I’ve made things slower. Is that just me being rubbish at web perf?

Harry: Not at all. I’ve got a really pertinent example of this. Preload... a real quick intro for anyone who’s not heard of preload, loading certain assets on the web is inherently very slow and the two primary candidates here are background images in CSS and web fonts, because before you can download a background image, you have to download the HTML, which then downloads the CSS, and then the CSS says "Oh, this div on the homepage needs this background image." So it’s inherently very slow because you’ve got that entire chunk of CSS time in between. With preload, you can put one line in HTML in the head tag that says "Hey, you don’t know it yet but, trust me, you’ll need this image really, really, really soon." So you can put a preload in the HTML which preemptively fires off this download. By the time the CSS needs the background image, it’s like "Oh cool, we’ve already got it, that’s fast." And this is toutered as this web perf Messiah... Here’s the thing, and I promise you, I tweeted this last week and I’ve been proved right twice since. People hear about preload, and the promise it gives, and also it’s very heavily pushed by Lighthouse, in theory, it makes your site faster. People get so married to the idea of preload that even when I can prove it isn’t working, they will not remove it again. Because "No, but Lighthouse said." Now this is one of those things where the theory is sound. If you have to wait for your web font, versus downloading it earlier, you’re going to see stuff faster. The problem is, when you think of how the web actually works, any page you first hit, any brand new domain you hit, you’ve got a finite amount of bandwidth and the browser’s very smart spending that bandwidth correctly. It will look through your HTML really quickly and make a shopping list. Most important thing is CSS, then it’s this jQuery, then it’s this... and then next few things are these, these, and these less priority. As soon as you start loading your HTML with preloads, you’re telling the browser "No, no, no, this isn’t your shopping list anymore, buddy, this is mine. You need to go and get these." That finite amount of bandwidth is still finite but it’s not spent across more assets, so everything gets marginally slower. And I’ve had to boo this twice in the past week, and still people are like "Yeah but no it’s because it’s downloading sooner." No, it’s being requested sooner, but it’s stealing bandwidth from your CSS. You can literally see your web fonts are stealing bandwidth from your CSS. So it’s one of those things where you have to, have to, have to follow the numbers. I’ve done it before on a large scale client. If you’re listening to this, you’ve heard of this client, and I was quite insistent that "No, no, your head tags are in the wrong order because this is how it should be and you need to have them in this order because theoretically it clues in that..." Even in what I was to the client I knew that I was setting myself up for a fool. Because of how browsers work, it has to be faster. So I’m making the ploy, this change... to many millions of people, and it got slower. It got slower. And me sitting there, indignantly insisting "No but, browsers work like this" is useless because it’s not working. And we reverted it and I was like "Sorry! Still going to invoice you for that!" So it’s not you at all.

Drew: Follow these numbers.

Harry: Yeah, exactly. "I actually have to charge you more, because I spent time reverting it, took me longer." But yeah, you’re absolutely right, it’s not you, it’s one of those things where... I have done it a bunch of times on a much smaller scale, where I’ll be like "Well this theoretically must work" and it doesn’t. You’ve just got to follow what happens in the real world. Which is why that monitoring is really important.

Drew: As the landscape changes and technology develops, Google rolls out new technologies that help us make things faster, is there a good way that we can keep up with the changes? Is there any resources that we should be looking at to keep our skills up to date when it comes to web perf?

Harry: To quickly address the whole "Google making"... I know it’s slightly tongue in cheek but I’m going to focus on this. I guess right towards the beginning, bet on the browser. Things like AMP, for example, they’re at best a after thought catch of a solution. There’s no replacement for building a fast site, and the moment you start using things like AMP, you have to hold on to those non-standard standards, the mercy of the AMP team changing their mind. I had a client spend a fortune licensing a font from an AMP allow-listed font provider, then at some point, AMP decided "Oh actually no, that font provided, we’re going to block list them now" So I had a client who’s invested heavily in AMP and this font provider and had to choose "Well, do we undo all the AMP work or do we just waste this very big number a year on the web font" blah, blah, blah. So I’d be very wary of any one... I’m a Google Developer expert but I don’t know of any gagging-order... I can be critical, and I would say... avoid things that are hailed as a one-size-fits-all solution, things like AMP.

Harry: And to dump on someone else for a second, Cloudflare has a thing called Rocket Loader, which is AMP-esque in its endeavor. It’s designed like "Oh just turn this thing on your CDN, it’ll make your site faster." And actually it’s just a replacement for building your site properly in the first place. So... to address that aspect of it, try and remain as independent as possible, know how browsers work, which immediately means that Chrome monoculture, you’re back in Google’s lap, but know how browsers work, stick to some fundamental ideologies. When you’re building a site, look a the page. Whether that’s in Figma, or Sketch, or wherever it is, look at the design and say "Well, that is what a user wants to see first, so I’ll put nothing in the way of that. I won’t lazy load this main image because that’s daft, why would I do that?" So just think about "What would you want the user to be first?" On an E-Com site, it’s going to be that product image, probably nav at the same time, but reviews of the product, Q and A of the product, lazy load that. Tuck that behind JavaScript.

Harry: Certain fundamental ways of working that will serve you right no matter what technology you’re reading up on, which is "Prioritize what your customer prioritizes". Doing more work on that’d be faster, so don’t put things in the way of that, but then more tactical things for people to be aware of, keep abreast of... and again, straight back to Google, but web.dev is proving to be a phenomenal resource for framework agnostic, stack agnostic insights... So if you want to learn about vitals, you want to learn about PWAs, so web.dev’s really great.

Harry: There’s actually very few performance-centric publications. Calibre’s email is, I think its fortnightly perf email is just phenomenal, it’s a really good digest. Keep an eye on the web platform in general, so there’s the Performance Working Group, they’ve got a load of stuff on GitHub proposals. Again, back to Google, but no one knows about this website and its phenomenal: chromestatus.com. It tells you exactly what Chrome’s working on, what the signals are from other browsers, so if you want to see what the work is on priority hints, you can go and get links to all the relevant bug trackers. Chrome Status shows you milestones for each... "This is coming out in MAT8, this was released in ’67" or whatever, that’s a really good thing for quite technical insights.

Harry: But I keep coming back to this thing, and I know I probably sound like "Old man shouts at Cloud" but stick to the basics, nearly every single pound or dollar, euro, I’ve ever earned, has been teaching clients that "You know the browser does this already, right" or "You know that this couldn’t possible be faster" and that sounds really righteous of me... I’ve never made a cent off of selling extra technology. Every bit of money I make is about removing, subtracting. If you find yourself adding things to make your site faster, you’re in the wrong direction.

Harry: Case in point, I’m not going to name... the big advertising/search engine/browser company at all, not going to name them, and I’m not going to name the JavaScript framework, but I’m currently in discussions with a very, very big, very popular JavaScript framework about removing something that’s actively harming, or optionally removing something that would harm the performance of a massive number of websites. And they were like "Oh, we’re going to loop in..." someone from this big company, because they did some research... and it’s like "We need an option to remove this thing because you can see here, and here, and here it’s making this site slower." And their solution was to add more, like "Oh but if you do this as well, then you can sidestep that" and it’s like "No, no, adding more to make a site faster must be the wrong solution. Surely you can see that you’re heading in the wrong direction if it takes more code to end up with a faster site."

Harry: Because it was fast to start with, and everything you add is what makes it slower. And the idea of adding more to make it faster, although... it might manifest itself in a faster website, it’s the wrong way about it. It’s a race to the bottom. Sorry, I’m getting really het up, you can tell I’ve not ranted for a while. So that’s the other thing, if you find yourself adding features to make a site faster, you’re probably heading in the wrong direction, it’s far more effective to make a faster by removing things than it is to add them.

Drew: You’ve put together a video course called "Everything I Have Done to Make CSS Wizardry Fast".

Harry: Yeah!

Drew: It’s a bit different from traditional online video courses, isn’t it?

Harry: It is. I’ll be honest, it’s partly... I don’t want say laziness on my part, but I didn’t want to design a curriculum which had to be very rigid and take you from zero to hero because the time involved in doing that is enormous and time I didn’t know if I would have. So what I wanted to was have ready-to-go material, just screen cast myself talking through it so it doesn’t start off with "Here is a browser and here’s how it works" so you do need to be at least aware of web perf fundamentals, but it’s hacks and pro-tips and real life examples.

Harry: And because I didn’t need to do a full curriculum, I was able to slam the price way down. So it’s not a big 10 hour course that will take you from zero to hero, it’s nip in and out as you see fit. It’s basically just looking at my site which is an excellent playground for things that are unstable or... it’s very low risk for me to experiment there. So I’ve just done video series. It was a ton of fun to record. Just tearing down my own site and talking about "Well this is how this works and here’s how you could use it".

Drew: I think it’s really great how it’s split up into solving different problems. If I want to find out more about optimizing images or whatever, I can think "Right, what does my mate Harry have to say about this?", dip in to the video about images and off I go. It’s really accessible in that way, you don’t have to sit through hours and hours of stuff, you can just go to the bit you want and learn what you need to learn and then get out.

Harry: I think I tried to keep it more... The benefit of not doing a rigid curriculum is you don’t need to watch a certain video first, there’s no intro, it’s just "Go and look around and see what you find interesting" which meant that someone suffering with LTP issues they’re like "Oh well I’ve got to dive into this folder here" or if they’re suffering with CSS problems they can go dive into that folder. Obviously I have no stats, but I imagine there’s a high abandonment rate on courses, purely because you have to trudge through three hours of intro in case you do miss something, and it’s like "Oh, do you know what, I can’t keep doing this every day" and people might just abandon a lot of courses. So my thinking was just dive in, you don’t need to have seen the preceding three hours, you can just go and find whatever you want. And feedback’s been really, really... In fact, what I’ll do is, it doesn’t exist yet, but I’ll do it straight after the call, anybody who uses the discount code SMASHING15, they’ll get 15% off of it.

Drew: So it’s almost like you’ve performance optimized the course itself, because you can just go straight to the bit you want and you don’t have to do all the negotiation and-

Harry: Yeah, unintentional but I’ll take credit for that.

Drew: So, I’ve been learning all about web performance, what have you been learning about lately, Harry?

Harry: Technical stuff... not really. I’ve got a lot on my "to learn" list, so QUIC, H3 sort of stuff I would like to get a bit more working knowledge of that, but I wrote an E-Book during first lockdown in the UK so I learned how to make E-Books which was a ton of fun because they’re just HTML and CSS and I know my way around that so that was a ton of fun. I learnt very rudimentary video editing for the course, and what I liked about those is none of that’s conceptual work. Obviously, learning a programming language, you’ve got to wrestle concepts, whereas learning an E-Book was just workflows and... stuff I’ve never tinkered with before so it was interesting to learn but it didn’t require a change of career, so that was quite nice.

Harry: And then, non technical stuff... I ride a lot of bikes, I fall off a lot of bikes... and because I’ve not traveled at all since last March, nearly a year now, I’ve been doing a lot more cycling and focusing a lot more on... improving that. So I’ve been doing a load of research around power outputs and functional threshold powers, I’m doing a training program at the moment, so constantly, constantly exhausted legs but I’m learning a lot about physiology around cycling. I don’t know why because I’ve got no plans of doing anything with it other than keep riding. It’s been really fascinating. I feel like I’ve been very fortunate during lockdowns, plural, but I’ve managed to stay active. A lot of people will miss out on simple things like a daily commute to the office, a good chance to stretch legs. In the UK, as you’ll know, cycling has been very much championed, so I’ve been tinkering a lot more with learning more about riding bikes from a more physiological aspect which means... don’t know, just being a nerd about something else for a change.

Drew: Is there perhaps not all that much difference between performance optimization on the web and performance optimization in cycling, it’s all marginal gains, right?

Harry: Yeah, exactly. And the amount of graphs I’ve been looking at on the bike... I’ve got power data from the bike, I’ll go out on a ride and come back like "Oh if I had five more watts here but then saved 10 watts there, I could do this, this, and this the fastest ever" and... been a massive anorak about it. But yeah, you’re right. Do you know what, I think you’ve hit upon something really interest there. I think that kind of thing is a good sport/pastime for somebody who is a bit obsessive, who does like chasing numbers. There are things on, I mean you’ll know this but, Strava, you’ve got your KOMs. I bagged 19 of them last year which is, for me, a phenomenal amount. And it’s nearly all from obsessing over available data and looking at "This guy that I’m trying to beat, he was doing 700 watts at this point, if I could get up to 1000 and then tail off" and blah, blah, blah... it’s being obsessive. Nerdy. But you’re right, I guess it’s a similar kind of thing, isn’t it? If you could learn where you afford to tweak things from or squeeze last little drops out...

Drew: And you’ve still got limited bandwidth in both cases. You’ve got limited energy and you’ve got limited network connection.

Harry: Exactly, you can’t just magic some more bandwidth there.

Drew: If you, the listener, would like to hear more from Harry, you can find him on Twitter, where he’s @csswizardty, or go to his website at csswizardry.com where you’ll find some fascinating case studies of his work and find out how to hire him to help solve your performance problems. Harry’s E-Book, that he mentioned, and video course we’ll link up from the show notes. Thanks for joining us today, Harry, do you have any parting words?

Harry: I’m not one for soundbites and motivation quotes but I heard something really, really, really insightful recently. Everyone keeps saying "Oh well we’re all in the same boat" and we’re not. We’re all in the same storm and some people have got better boats than others. Some people are in little dinghies, some people have got mega yachts. Oh, is that a bit dreary to end on... don’t worry about Corona, you’ll be dead soon anyway!

Drew: Keep hold of your oars and you’ll be all right.

Harry: Yeah. I was on a call last night with some web colleagues and we were talking about this and missing each other a lot. The web is, by default, remote, that’s the whole point of the web. But... missing a lot of human connection so, chatting to you for this hour and a bit now has been wonderful, it’s been really nice. I don’t know what my parting words really are meant to be, I should have prepared something, but I just hope everyone’s well, hope everyone’s making what they can out of lockdown and people are keeping busy.

Smashing Podcast Episode 31 With Eve Porcello: What Is GraphQL?

In this episode, we’re talking about GraphQL. What is it, and how does solve some common API problems? I spoke with expert Eve Porcello to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: She’s a software engineer, instructor, author, and co-founder of training and curriculum development company, Moon Highway. Her career started writing technical specifications and creating UX designs for web projects. Since starting Moon Highway in 2012, she’s created video content for egghead.io and LinkedIn Learning, and has co-authored the books Learning React and Learning GraphQL for O’Reilly’s Media.

Drew: She’s also a frequent conference speaker, and has presented at conferences including React Rally, GraphQL Summit, and OSCON. So we know she’s an expert in GraphQL, but did you know she once taught a polar bear to play chess? My smashing friends, please welcome Eve Porcello.

Drew: Hi Eve, how are you?

Eve Porcello: I’m smashing.

Drew: As I mentioned there, you’re very much an educator in things like JavaScript and React, but I wanted to talk to you today about one of your other specialist areas, GraphQL. Many of us will have heard of GraphQL in some capacity, but might not be completely sure what it is, or what it does, and in particular, what sort of problem it solves in the web stack.

Drew: So set the stage for us, if you will, if I’m a front end developer, where does GraphQL slot into the ecosystem and what function does it perform for me?

Eve: Yeah. GraphQL kind of fits between the front end and the backend. It’s kind of living in the middle between the two and gives a lot of benefits to front end developers and back end developers.

Eve: If you’re a front end developer, you can define all of your front ends data requirements. So if you have a big list of React components, for example, you could write a query. And that’s going to define all of the fields that you would need to populate the data for that page.

Eve: Now with the backend piece, it’s really own, because we can collect a lot of data from a lot of different sources. So we have data in REST APIs, and databases, and all these different places. And GraphQL provides us this nice little orchestration layer to really make sense of the chaos of where all of our data is. So it’s a really useful for kind of everybody all over the stack.

Drew: So it’s basically an API based technology, isn’t it? It sits between your front end and your back end and provide some sort of API, is that correct?

Eve: Yeah, that’s exactly right. Exactly.

Drew: I think, over the last decade, the gold standard for APIs has been rest. So if you have a client side app and you need to populate it with data from the backend, you would build a REST API endpoint and you’d query that. So where does that model fall down? And when might we need GraphQL to come in and solve that for us?

Eve: Well, the problem that GraphQL really helps us with, kind of the golden problem, the golden solution, I guess, that GraphQL provides is that with REST we’re over fetching a lot of data. So if I have slash users or slash products, that’s going to give me back all of the data every time I hit route.

Eve: With GraphQL, we can be a little bit pickier about what data we want. So if I only need four fields from an object that has a hundred, I’m going to be able to really pinpoint those fields and not have to load data into, or load all of that data I should say, into your device, because that’s a lot of extra legwork, for your phone especially.

Drew: I’ve seen and worked with REST APIs in the past that have an optional field where you can pass in a list of the data that you want back, or you can augment what comes back with extra things. And so I guess that’s identifying this problem, isn’t it? That’s saying, you don’t always want the same data back every time. So is it that GraphQL formalizes that approach of allowing the front end to specify what the backend is going to return, in terms of data?

Eve: Yeah, exactly. So your query then becomes how you ask, how you filter, how you grasp for any sort of information from anywhere.

Eve: I also think it’s important to note that we don’t have to tear down all of our REST APIs in order to work with GraphQL really successfully. A lot of the most successful implementations of GraphQL I’ve seen out there, it’s wrappers around REST APIs. And the GraphQL query really gives you a way to think about what data you need. And then maybe some of your data comes from our users and products, examples, some of the data comes from rest, some of it comes from a database.

Drew: I guess the familiar scenario is, you might have an endpoint on your website that returns information about a user to display the header. It might give you their username and their avatar. And you cull that on every page and populate the data, but then you find somewhere else in your app you need to display their full name.

Drew: So you add that to the endpoint and it starts returning that. And then you do your account management section, and you need like their mailing address. So that gets returned by that endpoint as well.

Drew: And before you know it, that endpoint is returning a whole heavy payload that costs quite a lot on the backend to put together, and obviously a lot to download.

Drew: And that’s been culled on every single page just to show an avatar. So I guess that’s the sort of problem that grows over time, that was so easy to fall into, particularly in big teams, that GraphQL, it’s on top of that problem. It knows how to solve that, and it’s designed around solving that.

Eve: Exactly. And yeah, I think that whole idea of a GraphQL Schema, I think is a really, it’s kind of less talked about than the query language part of GraphQL. But I really feel like the Schema in particular gives us this nice type system for API.

Eve: So anybody on the team, managers, front end developers, back end developers, anybody who is really dealing with data can come together, coalesce around what data we actually want to serve up on this API, and then everyone knows what that source of truth is, they can go build their own parts of the app based on that.

Eve: So there’s some tricky Schema management things that come up with that too. But as far as moving from microservices back to monoliths, we’re sort of doing that, but getting all of the benefits we like out of microservices still.

Drew: And do I understand correctly that the typical way of setting up a GraphQL system is that you’d have basically one route, which is the endpoint that you send all your queries to so you’re not having to... Often one of the most difficult things is working out what to name, and what the path should be that this particular query should be at. It’s returning users and products, should it be it slash users something, or slash product something?

Drew: With GraphQL you just have one endpoint that you just fire your queries to and you get back an appropriate response.

Eve: Exactly. Yeah. It’s a single endpoint. I guess, you still are dealing with problems of naming because you’re naming everything in the Schema. But as far as, I feel like a lot of companies who have made big bets on microservices, everyone’s like, what endpoints do we have? Where are they? How are they documented? And with GraphQL, we have one place, one kind of dictionary to look up anything that we want to find out about how the API works.

Drew: So, I’m very familiar with other query languages, like SQL is an obvious example of a query language that a lot of web developers will know. And the queries in that take the form of almost like a command. It’s a text string, isn’t it, Select this from that, where, whatever. What format do the queries take with GraphQL?

Eve: It’s still a tech string, but it doesn’t define where that logic comes from. And a lot of the logic is moved back to the server. So the GraphQL server, the GraphQL API is really responsible for saying, "Go get this data from where it is, filter it based on these parameters."

Eve: But in the query language, it’s very field oriented. So we just add fields for anything that we want to retrieve. We can put filters on those queries, of course, too. But I think it’s a little less direct about where that information comes from. A lot of the functionality is built into the server.

Drew: So you can mix and match in a query. You can make a request that brings back lots of different types of data in one request. Is that right?

Eve: Yeah, that’s absolutely right. So you could send a query for as many fields as your server would allow, and bring back all sorts of nested data. But that’s really how it works, we connect different types on fields. So I guess we’ll recycle my users and products idea, but the user might have a products field that returns a list of products. All of those are associated with other types as well. So as deeply nested as we want the query to go, we can.

Drew: So does that mean to retrieve the data for a typical view in your web application that might have all sorts of things going on, that you can just make one request to the backend and get that all in one go without needing to make different queries to different endpoints, because it’s all just one thing?

Eve: Yeah. That’s exactly the whole goal, is just a single query, define every field that you want, and then return it in one response.

Drew: And the queries are Jason based? Is that right?

Eve: ... Turn it in one response.

Drew: And the queries are JSON based, is that right?

Eve: The query itself is a text string, but it typically returns JSON data. So if I have the fields, then my JSON response matches exactly, and so it’s really clear what you’re getting when you send that query, because the data response looks exactly the same.

Drew: A lot of the queries it seems like are for almost like bare objects, like a customer or a product. Is there a way to specify more complex queries where business logic is controlled at the backend? Say I want to get a list of teams for a user, but only where that user is an admin of a team and where the team plan hasn’t expired, and all those sorts of real constraints that we face in everyday web application development. Can that be achieved with GraphQL?

Eve: Absolutely. So that’s the real exciting, powerful thing about GraphQL is, you can move a lot of that logic to the server. If you had a complex query, some really specific type of user that you wanted to get, all you’d need to do in the Schema is say, "Get complicated user", and then on the server, there would be a function where you could write all of the logic in whatever language you wanted to. JavaScript is kind of the most popular GraphQL implementation language, but you don’t have to use that at all. So Python, Go, C++, whatever you want to use, you can build a GraphQL server with that. But yeah, you can define as complex a query as you’d like to.

Drew: And I guess that enables you to encapsulate a lot of business logic then in new types of objects. Is that fair? You know, you set up a complicated user and then you don’t need to think what a complicated user is, but you can just keep using that complicated user and know that the business logic is implemented on that. Is that right?

Eve: That’s exactly right. So I think this is really nice for front end folks because they can start to prototype based on that. And then the backend team could go implement those functions to make that work. And then there’s kind of this shared understanding for what that type actually is and who they are, and, "What are the fields on that type?" And everything can be handled by wherever in the stack GraphQL is working. And that’s why it’s not really a front end or a back end technology. It’s really kind of both, and neither.

Drew: It sounds like it’s sort of formalizing the API and the relationship between front end and backend, so everybody’s getting a predictable interface that is standardized.

Eve: Exactly.

Drew: Which I guess in organizations where the front end and the backend are owned by different teams, which isn’t at all uncommon, I guess this approach also enables changes to be made, say, on the front end, it might require different data, without needing somebody who works on the backend to make the changes that correspond to that. You’ve still got this almost infinitely customizable API without requiring any work to be done to change it if you need new data.

Eve: Yeah, exactly right.

Drew: So is the GraphQL server responsible for formatting the response, or do you need to do that in your server side logic?

Eve: So the GraphQL server defines two things. It defines the Schema itself that lives on the server, and then it defines the resolver functions. Those are functions that go get the data from wherever it is. So if I have a REST API that I’m wrapping with GraphQL, the resolver would fetch from that API, transform the data however it needed to be, and then return it to the client in that function. You can use any sort of database functions you’d like to on that server as well. So if you have data in a bunch of different places, this is a really nice cohesive spot to put all of that data in and to kind of design all the logic around, "Where’s that data coming? How do we want to transform it?"

Drew: The client says, "I want a complex user", the server receives that in a query and could say, "Right, I’m going to look up the complex user resolver." Is that right?

Eve: Mm-hmm (affirmative).

Drew: Which is the function, and then you write your logic that your backend team, or whoever writes the logic inside that function, to do whatever is necessary to return a complex user.

Eve: Yeah, exactly.

Drew: So that could be calling other APIs, it could be querying a database, it could be looking stuff up in cache, or pretty much anything.

Eve: Pretty much anything. And then, as long as that return from the function matches the requirements of the Schema, matches what fields, what types, were returning there, then everything will work nice and harmoniously.

Drew: I guess it gives you a consistent response format across your entire API just by default. You don’t have to design what that looks like. You just get a consistent result.

Eve: Yeah, exactly.

Drew: I think that could be quite a win really, because it can be really difficult to maintain consistency across a big range of API end points, especially in larger teams. Different people are working on different things. Unless you have quite strict governance in place, it can get really complex really quickly, can’t it?

Eve: Yeah, absolutely. And I think that Schema is just such a nice little document to describe everything. You get the automatic benefit of being able to see all of the fields in that Schema whenever you’re trying to send queries to it, because you can send introspection queries and there’s all sorts of nice tools for that, like GraphQL and GraphQL Playground, little tools that you can use to interact with the API’s data.

Eve: But also, if you’ve ever played around with Postman, like to ping a REST API, a lot of those, the documentation doesn’t really exist or it’s tough to find, or things like that. GraphQL really gives you that nice cohesive layer to describe everything that might be part of that API.

Drew: Practically, how do things work on the server side? I mean, I guess you need to run a GraphQL service as part of your infrastructure, but what form does that take? Is it an entire server running on its own port? Or is it just like a library you integrate into your existing Express or Apache or whatever with a route that resolves to that service? How do you implement it?

Eve: Yeah, it’s an actual server. So kind of the most popular GraphQL implementations are Node.js servers. When GraphQL as a spec was released, the team released this reference implementation in JavaScript, kind of a Node server that served as the guidelines for all these other ones who have popped up. But yeah, you can run these servers on their own instances. You can put them on Lambda. So there’s Apollo Server Express, there’s Apollo Server Lambda; all sorts of different types of implementations that you can use to actually run this thing.

Drew: So you mentioned briefly before the concept of a Schema that the server has.

Eve: Yeah.

Drew: That gives you the ability to describe your types more strictly than just, you know, mapping a name to a resolver. There’s more involved there, is there?

Eve: Yeah. There’s a full language. So I’ve referenced the spec and I didn’t describe what it is. GraphQL itself is a spec that describes the query language and the Schema definition language. So it has its own syntax. It has its own rules for defining these types.

Eve: When you’re using the Schema definition language, you basically use all of the features of that language to think about, what are the types that are part of the API? It’s also where you define the queries, the mutations, which are the verbs, like the actions, create account login, things like that. And even GraphQL subscriptions, which are another cool thing, real time GraphQL that you can define right there in the Schema.

Eve: So yeah, the Schema really is super important. And I think that it gives us this nice type enforcement across our full Stack application, because as soon as you start to deviate from those fields and from those types, you start to see errors, which is, in that case, good, because you’re following the rules of the Schema.

Drew: Is there any crossover between that and TypeScript? Is there a sort of synergy between the two there?

Eve: Absolutely. So if you’re a person who talks about GraphQL a lot, sometimes people will tell you that it’s bad, and they’ll come up to you publicly, when you could do that, and talk about how GraphQL is no good. But a lot of times they skip out on the cool stuff you get from types. So as far as synergy with TypeScript goes, absolutely, you can auto-generate types for your front end application using the types from the Schema. So that’s a huge win because you can not only generate it the first time, which gives you great interoperability with your front end application, but also, as things change, you can regenerate types and then build to reflect those changes. So yeah, I think those things fit really nicely together as types start to be kind of the defacto rule.

Eve: ... to be kind of the defacto rule in JavaScript, they fit nicely together.

Drew: It seems to be a sort of ongoing theme with the way that TypeScript has been designed ... that’s not TypeScript, sorry. GraphQL has been designed that there’s a lot of about formalizing the interaction between the front end and the back end. And it’s coming as a solution in between the just creates consistency and a formalization of what so far has been otherwise a fairly scrappy experience with rest for a lot of people. One thing that we always have to keep in mind when writing client-side apps is that the code is subject to inspection and potentially modification. And having an API where the client can just request data could be dangerous. Now, if you can specify what fields you want, maybe that could be dangerous. Where in the sort of the whole stack, would you deal with the authorization of users and making sure that the business rules around your data enforced?

Eve: You would deal with that all on the server. So, that could happen in many different ways. You don’t have to use one off strategy, but your resolvers will handle your authorization. So that could mean wrapping an existing off REST API, like a service like Auth0 or something you’ve built on your own. That could mean interacting with an OAuth, like GitHub or Facebook or Google login, those types of things that involves kind of passing tokens back and forth with resolvers. But oftentimes that will be built directly into the Schema. So the Schema will say, I don’t know, we’ll create a login mutation. And then I send that mutation with my credentials and then on the server, all of those credentials are verified. So the client doesn’t have to worry so much, maybe a little bit of passing tokens and things like that. But most of that is just built into the server.

Drew: So essentially, that doesn’t really change compared to how we’re building rest endpoints at the moment. Rest as a technology, well, it doesn’t really deal with authorization either and we have middleware and things on the server that deals with it. And it’s just the same with GraphQL. You just deal with it. Are there any conventions in GraphQL community for doing that? Are there common approaches or is it all over the place for how people choose to implement it?

Eve: It’s honestly all over the place. I think most times you’ll see folks building off into the Schema and by that I mean, representing those types and authorized users versus regular users building those types into the Schema itself. But you’ll also see a lot of folks using third-party solutions. I mentioned Auth0. A lot of folks will kind of offload their authorization on to companies who are more focused on it, particularly smaller companies, startups, things like that. But you’ll also see bigger companies starting to create solutions for this. So AWS, Amazon has AppSync, which is their flavor of GraphQL, and they have author rolls built directly into AppSync. And that’s kind of cool just to be able to, I don’t know, not have to worry about all of that stuff or at least provide an interface for working with that. So a lot of these ecosystem tools have, I think authorization is such a big topic in GraphQL. They’ve seen kind of the need, the demand for auth solutions and standard approaches to handling auth on the graph.

Drew: I guess there’s hardly a, an implementation out there that doesn’t need some sort of authorization. So yeah, it’s going to be a fairly common requirement. We’re all sort of increasingly building componentized applications, particularly when we’re using things React and View and what have you. And the principle of loose coupling leaves us with lots of components that don’t necessarily know what else is running on the page around them. Is there a danger as a result of that, you could end up with lots of components querying for the same data and making multiple requests? Or is it just an architectural problem in your app that you need to solve for that? Are there sort of well-trodden solutions for dealing with that?

Eve: Well, I think because GraphQL for the most part, not 100% of the solutions, but almost every GraphQL query is sent over HTTP. So if you want to track down where those multiple requests are happening, it’s probably a fairly familiar problem to folks who are using rest data for their applications. So there are some tools like Paulo Client Dev Tools and Urkel Dev Tools for front end developers who are like, "What’s going on? Which queries are on this page?" That gives you really clear insights into what’s happening. There’s kind of several schools of thought with that. Do we create one big, huge query for all of the data for the page? Or do we create smaller queries to load data for different parts of the app? Both as you might imagine, they have their own drawbacks, just because if you have a big query, you’re waiting for more fields.

Eve: If you have smaller queries, there may be collisions between what data you’re requiring. But I think, and not to go off on too much of a tangent, but I’m there already. So the there’s something called the Deferred Directive that’s coming to the GraphQL spec and the Deferred Directive is going to help with kind of secondarily loading content. So let’s say you have some content at the top of the page, the super important content that you want to load first. If you add that to your query and then any subsequent fields get the deferred directive on that. It’s just a little decorator that you would add to a field, that will then say, "All right, load the important data first, then hold up and load the second data second." And it kind of gives you this, it’s the appearance of kind of streaming data to your front end, so that there’s perceived performance, there’s interactivity. People are seeing data right away versus waiting for every single field to load for the page, which yeah, it could be a problem.

Drew: Yeah. I guess that enables you to architect pages where everything that’s ... we don’t like to talk too much about the viewport, but it is everything above the fold, you could prioritize, have that load in and then secondarily load in everything sort of further down. So, we’ve talked a lot about querying data. One of the main jobs of an API is sending new and modified data back to the server for persistence. You mentioned briefly mutations earlier. That’s the terminology that’s GraphQL uses for writing data back to the server?

Eve: Exactly. So any sort of changes we want to make to the data, anything we want to write back to the server, those are mutations, and those are all just like queries, they’re named operations that live on the server. So you can think about what are all the things we want our users to be able to do? Represent those with mutations. And then again on the server, write all the functions that make that stuff work.

Drew: And is that just as simple as querying for data? Calling a mutation is just as easy?

Eve: Yeah. It’s part of the query language. It looks pretty much identical. The only difference is, well, I guess queries take in filters. So mutations taken what looked like filters in the query itself. But those are responsible for actually changing data. An email and a password might get sent with a mutation, and then the server collects that and then uses that to authorize the user.

Drew: So, just as before, you’re creating a resolver on the backend to deal with that and to do whatever needs to be done. One common occurrence when writing data is that you want to commit your changes and then re-query to get the sort of current state of it. Does GraphQL have a good workflow for that?

Eve: It sort of lives in the mutation itself. So, a lot times when creating your Schema you’ll create the mutation operation. I’ll stick with log-in, takes in the email and the password. And the mutation itself returned something. So it could return something as simple as a Boolean, this went well, or this went badly, or it could return an actual type. So oftentimes you’ll see the mutation like the log-in mutation, maybe it returns a user. So you get all the information about the user once they’re logged in. Or you can create a custom object type that gives you that user plus what time the user logged in, and maybe a little more metadata about that transaction in the return object. So again, it’s kind of up to you to design that, but that pattern is really baked into GraphQL.

Drew: This all sounds pretty great, but every technical choice involves trade-offs. What are the downsides of using GraphQL? Are there any scenarios where it’d be a really poor choice?

Eve: I think that the place where a GraphQL might struggle is creating a one-to-one map of-

Eve: ... struggle is creating a one-to-one map of tabular data. So let’s say you have, I don’t know, think a database table with all sorts of different fields and, I don’t know, thousands of fields on a specific type, things like that, that type of data can be represented nicely with GraphQL, but sometimes when you run a process to generate a Schema on that data, you’re left with, in a Schema, the same problems that you had in the database, which is maybe too much data that goes beyond what the client actually requires. So I think those places, they’re potentially problems. I’ve talked to folks who have auto-generated Schemas based on their data and it’s become a million line long Schema or something like that, just thousands and thousands of lines of Schema code. And that’s where it becomes a little tricky, like how useful is this as a human readable document?

Eve: Yeah. So any sort of situation where you’re dealing with a client, it is a really nice fit as far as modeling every different type of data, it becomes a little tricky if your data sources too large.

Drew: So it sounds like anywhere where you’re going to carefully curate the responses in the fields and do it more by hand, you can get really powerful results. But if you’re auto-generating stuff because you’ve just got a massive Schema, then maybe it becomes a little unwieldy.

Eve: Yeah. And I think people are listening and disagreeing with me on that because there are good tools for that as well. But I think kind of the place where GraphQL really shines is that step of abstracting logic to the server, giving front end developers the freedom to define their components or their front ends data requirements, and really managing the Schema as a team.

Drew: Is there anything sort of built into the query language to deal with pagination of results, or is that down to a custom implementation as needed?

Eve: Yeah. Pagination, you would build first into the Schema, so you could define pagination for that. There’s a lot of guidelines that have sort of emerged in the community. A good example to look at if you’re newer to GraphQL or not, I look at this all the time, is the GitHub GraphQL API. They’ve basically recreated their API for v4 of their public facing API using GraphQL. So that’s a good spot to kind of look at how is a actual big company using this at scale. A lot of folks have big APIs running, but they don’t make it public to everybody. So pagination is built into that API really nicely and you can return, I don’t know, the first 50 repositories that you’ve ever created, or you can also use cursor based pagination for returning records based on ideas in your data. So cursor based pagination and kind of positional pagination like first, last records, that’s usually how people approach that, but there’s many techniques.

Drew: Are there any big got yous we should know going into using GraphQL? Say I’m about to deploy a new GraphQL installation for my organization, we’re going to build all our new API endpoints using GraphQL going forward. What should I know? Is there anything lurking in the bushes?

Eve: Lurking in the bushes, always with technology, right? I think one of the things that isn’t built into GraphQL, but can be implemented without too much hassle is API security. So for example, you mentioned if I have a huge query, we talked about this with authorization, but it’s also scary to open up an API where someone could just send a huge nested query, friends of friends, friends of friends, friends of friends, down and down the chain. And then you’re basically allowing people to DDoS you with these huge queries. So there’s things that you can set up on the server to limit query depth and query complexity. You can put queries on a safe list. So maybe your front ends, you know what they all are and it’s not a public API. So you only want to let certain queries come over the wire to you. So I would say before rolling that out, that is definitely a possible got you with the GraphQL.

Drew: You do a lot of instruction and training around GraphQL, and you’ve co-written the O’Reilly ’animal’ book with Alex Banks called Learning GraphQL. But you’ve got something new that you’re launching early in 2021, is that right?

Eve: That’s right. So I have been collaborating with egghead.io to create a full stack GraphQL video course. We’re going to build an API and front end for a summer camp, so everything is summer camp themed. And yeah, we’re just going to get into how to work with Apollo server, Apollo client. We will talk about scaling GraphQL APIs with Apollo Federation. We’ll talk about authorization strategies and all sorts of different things. So it’s just kind of collecting the things that I’ve learned from teaching over the past, I don’t know, three or four years GraphQL and putting it into one spot.

Drew: So it’s a video course that... Is it all just self-directed, you can just work your way through at your own pace?

Eve: Yeah, exactly. So it’s a big hefty course so you can work through it at your own pace. Absolutely.

Drew: Oh, that sounds really good. And it’s graphqlworkshop.com, is that right?

Eve: Graphqlworkshop.com, exactly.

Drew: And I’m looking forward to seeing that released because I think that’s something that I might need. So I’ve been learning all about GraphQL. What have you been learning about lately?

Eve: I’ve also been looking into Rust lately. So I’ve been building a lot of Rust Hello Worlds, and figuring out what that is. I don’t know if I know what that is yet, but I have been having fun tinkering around with it.

Drew: If you dear listener, would like to hear more from Eve, you can find her on Twitter where she’s @eveporcello, and you can find out about her work at moonhighway.com. Her GraphQL workshop, discover your path through the GraphQL wilderness, is coming out early in 2021 and can be found at graphqlworkshop.com. Thanks for joining us today, Eve. Do you have any parting words?

Eve: Parting words, have fun with GraphQL, take the plunge, you’ll enjoy it, and thanks so much for having me. I appreciate it.

Smashing Podcast Episode 30 With Chris Murphy: What Is Product Design?

In this episode, we’re talking about Product Design. What does it mean to be a product owner, and how can you learn the skills required? I spoke to expert Chris Murphy to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a designer, writer, and speaker based in Belfast UK, he’s a teacher and, like many of us, one who’s still on his own learning journey. As a design strategist, he’s worked with companies large and small, driving innovation by drawing on over 25 years of experience working with clients such as Adobe, Electronic Arts, and the BBC. He now mentors startup founders, with a particular focus on purpose-driven businesses. His work is underpinned by his own startup, The School of Design, a community for creatives who are designing, building, and selling products. So we know he’s an expert in helping others to learn, but did you know he was once taught to play the hurdy-gurdy by Dame Helen Mirren? My smashing friends, please welcome Mr. Chris Murphy. Hi, Chris. How are you?

Chris Murphy: I’m smashing.

Drew: As mentioned in the intro, you first and foremost are an educator, a teacher, and your focus and your energy at the moment is being put into a lot of helping design-focused entrepreneurs to be equipped with the skills that they need to build products. It’s a phrase that we hear a lot, but what’s it actually mean to be design-focused?

Chris: It’s really interesting. I had to do a pitch at the end of the Propel program that I was on from January to June. If I just rewind a little bit and talk about Propel, it’s a startup founder program that I was a mentor on two years ago. Honestly, I was so excited to be a mentor, and the teams were great. Over the summer, last summer, I came back in for what they have, an office hours session, and Ian, who was one of my colleagues on the program, his instinctive ... “Well, why are you here?” I said, “Because I think I’m actually going to go on Propel next year,” and they were like, “What,” because they had lined me up to teach on it. I just said, “Look, there was so much excitement in the program, and I just wanted to be part of it.” Plus, I feel that I’ve been teaching for 20 years, and it’s time for a change.

Chris: I also think that education’s going through this massive re-imagination at the minute, partly because of COVID and just partly because there’s a pushback against very high fees in universities. The other thing is, and I’m going to get back to your question in a second, my daughter, I think she’s 21, and she’s in her third year at Glasgow School of Art, and she’s racking up on an awful lot of debt to study jewelry. I think there must be a better way to teach design in a connected age. But coming back to your question, design-focused companies. At the end of my pitch at the end of Propel, I talked about Apple, and I know Apple’s a bit of a tired example. But it was at the time the world’s first two billion dollar company, and everything they do is design-focused. I mean, the hardware is considered, the software is considered, as we’ve seen recently, the chips are considered, everything is considered in terms of how it goes together.

Chris: One of the debates I’ve been having in my head recently, Drew, is this idea of ... Yesterday, I spoke to somebody about product design, and I have a friend who’s on Propel and he is a product designer, as in he was studying physical product design. I said, “That’s really interesting,” and he said, “I think you’re calling these people the wrong thing.” I said, “But” ... Another person on the course, who is a product designer, but she’s what we would call a product designer, someone who’s making digital stuff, and so in my head, I think, “Well, these ideas of these separate disciplines are kind of ludicrous these days,” because you can’t really have a product, a physical product, let’s take this laptop here, without some software on it. You can’t have the software and the laptop working together without getting that laptop into our hands, so we then have to go to a shop to buy that. That’s an experience, and that’s been designed as well.

Chris: So if we take just this computer that we’re using to record this conversation, design is involved every step of the way. It’s involved in the processes that are used to mill out the aluminum that all the stuff goes into. It’s involved in Big Sur, which is the operating system that’s running on it. It’s involved with going to the Apple Store to replace my computer the other day, and it’s not like the Apple Store anymore, but it’s being designed as an experience that’s designed for COVID. So everything is designed, everything, or I suppose a fairer way to put it is everything can be designed but not everything necessarily is designed. I think that that’s what I’m interested in. Design can touch lots of things.

Drew: So to be design-focused would mean to make sure to design every little bit of the process that you can or to care about designing more of the bits of the process than a company that isn’t as designed-focused?

Chris: Yeah, I love that. I love that idea of designing more of it because if we step back and we look at the entire process ... And I think designers are quite good at this. Designers are quite good at going into a business and maybe we’re asked to solve this problem over here. I don’t know about other people, but the way I tend to do that when I’m doing work as a consultant is I tend to go in and I’ve been asked to look at this problem, problem X, and I’ll spend a couple of days looking at that, and then I’ll come back and say, “Look, I can totally help you with problem X and we’ll get that sorted, but I really think a more pressing issue is this thing over here. Let’s take a look at that.” Because I am so terrible at business, I usually say things like, “I’ll do that for free, and then I’ll help you with this problem over here,” because I’m really interested in all of the parts of the experience.

Chris: A lot of companies just don’t really look at ... They might be design-focused companies, but perhaps they haven’t considered how they, let’s take an example, package up their products and send them out. For me, when I look at that as an experience ... Because one of the things that we’re doing at The School of Design is a thing called designer tools, which is basically these sketchbooks, of which I have thousands, thousands sitting just over here, these bands that go round them which you put your pens in, and a system I use to keep everything organized in my sketchbooks. We’re selling all of that stuff, but I’m not just putting those sketchbooks into a box. I’m putting them in with lots of little things, like badges and stickers and little notes and all of that kind of stuff, because when that arrives at someone’s house, I want them to open that and have an experience. I don’t want them just to open it and have three sketchbooks. I want them to be thinking, “Whoa, that’s a nice experience,” because I think that that will make a deeper connection with that person. I don’t want to use the word customer. I think I prefer to use the word friend who paid me some money for something.

Drew: So you mentioned Apple there, and despite being, as you say, a slightly tired example, I still think they’re an excellent example. I don’t think it matters that people have mentioned them before because they are such a great example. Are there any canonical examples in the more digital space of companies that do this particularly well, this design-focused approach?

Chris: Look, I don’t want to use another hackneyed example, but I think GOV.UK are doing an amazing job. I don’t think they’re a company, but I think what GOV.UK have done through the digital cabinet office or whatever that’s called and thinking about the processes of government and how people access services, what’s interesting to me is that has had an impact on lots of other companies. So if we look at ... The Co-op is a good example of a company company. A friend of mine, Charles Burdett, who made Workshop Tactics ... I don’t know if you know Workshop Tactic. They’re these really, really great cards, Workshop Tactics. I think it’s workshoptactics.com. If you want to run workshops, they’re brilliant for that. But Charles used to work for the Co-op and was a consult ... He’s working as a consultant there just now, I think, and they’re very good at designing all of the different aspects of the business, including, I think, visualizing how we might shop in the future.

Chris: If you want to go into the Co-op, I have a Co-op just down the street, and if I want to go into the Co-op today, what I quite like to do because of COVID is walk around with my phone and scan things as I put them just straight in my bag and then just leave the shop. I don’t particularly want to talk to anybody because usually I’m listening to a podcast. I mean, I do talk to a lot of people in the Co-op, like there’s Anna and there’s a few people in there who are my friends in the sense that it’s my local shop. But there’s always staff I don’t know, and on those days I just want to get in, get out as quick as possible. If we add COVID on top of that as a potential life-threatening issue, I really want to get in there and get out as quickly as possible with a minimum of fuss and with a minimum of connection with other people as well. That current experience is bringing us to a bottleneck, which is a checkpoint, or not a checkpoint, that sounds very Northern Ireland-

Drew: Checkout.

Chris: ... a till, a checkout, thank you, and that’s a bottleneck. Even with the things on the floor that say, “Maintain two meter distance,” et cetera, people never ... They’re so busy that they never really notice those little signs on the ground. That process could be redesigned in a much, much better way. I think there’s scope there and potential to think about how design impacts everything.

Drew: Thinking in terms of individual founder businesses, entrepreneurial businesses, does it follow that if an individual is design-focused themselves that the product that they make will be that way? Is a product really an extension of the person who designed it?

Chris: I think that’s a really good question, Drew, and I think that the answer to it is it depends. I think it depends on that person and it depends on the scale of the company. If you take a look at Hiut Denim, and I use Hiut a lot in my teaching, it’s a really good example of a company that’s doing one thing well, and that’s their sort of strapline jeans. I think if you look at David’s previous ... David and Claire, because they’re a partnership. If you look at David Hieatt and Clare Hieatt’s previous company, which was Howies, that company had grown so big, there were so many people involved. Once scale starts to creep in, it starts to become very difficult to keep an eye on all of the little touchpoints that matter in the customer journey. I think it’s really telling that when they left Howies, because Howies had been bought by ... It’s complicated. Go read it on the Internet. But it was Timberland, and Timberland was bought, and there’s all this story.

Chris: I think it’s really interesting that what they’re focused on now is jeans. That’s it. They’re telling an amazingly good story around jeans. They’re also packaging everything really, really well, and the jeans are like a vehicle for stories, really. Also, the jeans are ... And this is something I think, Drew, is going to become more important as we come out the other end of COVID, which I hope we come out the other end of. Everyone who’s making those jeans is being paid a proper wage. One of the problems I have at the minute when I look at the world is not everybody is being paid a proper wage and I find that a little bit concerning, as someone ... Look, I’m 51, my son is 25, 24, 25, something like that. It’s terrible. I should know all this stuff. He’s a wedding photographer. He has been a wedding photographer for a year and a bit. His business is completely decimated because no one’s really getting married at the minute because it’s just difficult. He has no salary because he didn’t have enough self-employed books to get the support.

Chris: He’s fallen through the cracks, and there’s a lot of other people who’ve fallen through the cracks. I would argue that’s a design problem, that we need to look at that as a design problem. But if I also look at that wider issue of COVID and the government and all of these things without getting too political, I read an article in the Guardian yesterday about Matt Hancock’s neighbor, and anyone who’s listening who’s not from the UK, Matt Hancock is the Health Secretary. His neighbor, who was running a business, was texting him and asking for advice about, “How do I supply products for this COVID thing?” There’s an awful lot of rumblings around the chumocracy, is what the papers call it, friends of friends of government ministers who seem to be getting jobs because they know the right people.

Chris: I get this sense that we’re going to come to the other end of this and see this ... Individuals see that, and they think, “Well, where is this money going, and are people being paid properly? What’s the price of this one pound t-shirt from shop X?” I don’t want to mention any brands. But everything has to be paid for, and everything that’s made, people have to be paid to make it. I think people are increasingly interested in are people being paid fairly.

Drew: One thing you mentioned in there was design touchpoints, which by a design touchpoint, you mean anything where the customer, if we can use that term, comes into contact with your product or business? Is that what a touchpoint is?

Chris: Yeah, I hired a placement student this year, which is really unusual because I’ve been teaching at Belfast School of Art for 20 years and I don’t think a member of staff has ever hired a student who’s going on a placement year. But I kind of knew I was leaving, even though nobody else did, so I hired a placement student to help me. I think the last diagram she drew for me was touchpoints because I constantly have conversations with people who say, “What is that?” They’ve never heard that term before. In a sense, that really is what The School of Design is about. It’s teaching you all the things that nobody taught you in art school, basically. So, yes, it’s about building products, but it’s also about just covering gaps in knowledge.

Chris: But touchpoints are everything. They’re from how you answer the phone, which increasingly is not really something that we do, it’s maybe the tone of voice of your email or the tone of voice of your social media messaging or how you write a blog post. There’s so many different ways you come into contact with people, and all of those ways have to be designed.

Drew: So things like microcopy and all of the communications, the tone of voice, the-

Chris: 100%. One of the things that Jasmine, my placement student, has been working on for me is an illustration system for The School of Design so that when she comes to the end of her placement with me, which, at the minute, is looking like about December sometime, but when I embark on The School of Design properly from the first of January, I have everything so that we have visual aesthetic that is considered. If you think back to some of the articles I’ve written for Smashing Magazine on UX design, I’ve always designed those illustrations for those articles with the smashing red, and I’ve always thought, “Well, these are part of the series for Smashing Magazine.” I’ve done some stuff for Smashing in Adobe, and I think, “Well, we should try to make these illustrations on brand,” for want of a better word, because that’s where they’re going to end up, right?

Chris: What was interesting to me, that if we think back to those articles, Adobe published them on the Adobe blog, and I could instantly tell that they were Smashing because they had that color, and you could see looking down the page, some were by me and some were by other people, but you could see, “Oh, that was from Smashing Magazine.” I was stoked for ... I’m so biased because I think Smashing Magazine is doing an amazing job.

Drew: Thank you very much. Yeah, you often hear people talk about entrepreneurial business saying that, “Oh, it all starts with an idea.” I’m not really sure that’s true, personally. I think, to me, the products that really make it and are successful often start with a problem.

Chris: Yeah, I knew you were going to say that. Yeah.

Drew: Or a constraint or a limitation. It always starts with a struggle, and it probably carries on that way as well. Do you agree with that?

Chris: I do, I do. I think that most products ... I mean, if we think of products, they probably fall into two categories. One is problem-solving, like I have an issue and, oh, look, I have this issue and there doesn’t appear to be anyone solving it in a particularly delightful way. Perhaps someone is solving that problem but maybe not in a delightful way, and so we can bring delight to the party, and we can bring delight to the table. I think we should be thinking about that full-stop for everything. So one category is that I have a problem. But I think another category is just delight. We buy a lot of things for no other reason than they bring joy into our lives. I think everybody has probably got something that they bought that they could get a cheaper version of this thing, but they bought this thing because it brings product.

Chris: I have an example behind me, which is this shoe. I have these shoes in two sizes. Unfortunately for people who are listening to this podcast, you can’t see the shoe. It’s a Camper shoe. All my shoes are Camper shoes. I fell in love with Camper a few years ago. It’s a really good story. Portugal, I think, is the company. I only buy the Pelotas shoes, which have got the balls on the feet and on the soles, and they have a story behind that as well inspired by footballs, I think. This is a Camper Kvadrat. I don’t know how you pronounce Kvadrat. It’s like K-V-A-D-R-A-A-T or something, and it’s a textile company. I bought this in a size 10 because that’s my usual size, and I also have it in a size 11 because it’s such a stiff fabric, it’s really tight. So I had to buy another one, and so these are kind of like an ornament sitting on this bookcase behind me.

Chris: Now, I could buy these Camper shoes, and I think they probably cost me about 90 pounds or something. Now, I don’t need to buy those shoes for 90 pounds. I could probably go and get a decent pair of shoes for 20 pounds. But they just bring a bit of joy into my life. When I put the shoes on, they’re bright blue, and people usually say, “Whoa, where’d you get your shoes?” So they’re a conversation starter. They’re not just a shoe. So that’s another half. I think if we think of those products as being in those two categories, problem-solving and delight-bringing, ideally, we want a mixture of the two, we want problem-solving and delight-bringing. But I’d say probably 70% are problem-solving and about 30% are no other reason than joy.

Drew: You mentioned the story behind a product. How important is it to have a sort of origin story behind your products?

Chris: I think it’s really important. I think that people are hungering for stories now. I think if we think back to the overlong section where I was criticizing the government, which you might want to edit, I think stories are important. I have a whole deck, it’s on Notist as well, which is called Product Storytelling, and it looks at the story behind Hiut Denim, but it also looks at the story behind Field Notes, which are somewhere behind me on that bookcase. Field Notes are a really good example of this. If you go to the Field Notes website, and you click on any of the printed products, they will tell you crazy details like, “Thanks to these three people who invented the staple,” and, “This particular printing press is called a such and such and such and such,” and, “It’s printed with these Pantone Hoya inks,” and, “The paper is this, that, and the next thing.” If you’re spending $9.95 on three tiny notebooks, the story’s kind of important because you could probably just pop down to your local stationer’s and get a much cheaper set of notebooks.

Chris: But you’re not really buying notebooks, you’re buying a story there. I think that Field Notes are a really good example of that because they’ve taken something which could easily be a commodity and it could easily be something that you buy based upon the price and they’ve turned that into something that is a story and that you’re buying not just because it serves a purpose, it’s useful to put in your pocket and take notes. Just, it’s something that brings a smile to your face. On one end of the spectrum, they have the standard brown field notes, which are kind of the commodity end, and even those aren’t really a commodity. Then, on the other end, they have their editions, where they’re trying different print finishes and they maybe are inserting maps.

Chris: There’s a huge amount of Field Notes influencing this, the designer tool sketchbooks that we’re working on for The School of Design because Andy McMillan, who folks may know for Build Conference and XOXO, he is the person who printed all of these sketchbooks. When he moved to Portland, I bought them off him, or I bought some of them because we used to share a building and he was one floor down and my studio was above him. I bought a box off him, and I started to use the sketchbooks, and I always used to put my ... I’d do them in a particular way. I’d put a postcard on the cover so I can tell that’s the current sketchbook, and then I have a table of contents on the inside and so on and so forth.

Chris: When he was selling them, he had a shop called Draft Tools or Draft Supply. It was Draft Supply Co. You can see it on the Wayback Machine. He said sketchbooks shouldn’t be celebrated. They should just be cheap. It’s the ideas that should be celebrated. I agree with him, but I kind of wrote something recently where I said, “But why can’t the sketchbooks be celebrated as well?” When he got them printed ... I wish I could show you, Drew. There’s literally boxes of these everywhere. They’re printed by a company called Oddi, O-D-D-I, and I remember Andy saying to me that he’d had them printed by Oddi, and I was like, “Why did you get them printed by Oddi? They print books, and they’re probably an expensive place to get notebooks made.” But, for me, I looked at the paper and the print and the binding, and it’s just there’s a story there, and Field Notes have done a really good job of telling that story, and they’re very successful as a consequence.

Drew: So is it about creating an emotional connection with the customer on whatever level?

Chris: 100%. And this is one of the things, one of the many things, that I am trying to cover in The School of Design. I’m just writing that down frantically in motion. Because a lot of the purchases that we make today are driven by emotion, not necessarily by rational decisions. When the M1 computer came out, oh, two weeks ago, coming back to my son, the photographer, he is working on a very old computer with the screen hanging off and I happen to have a spare, old-ish MacBook Pro, I said to him, “Okay, you can take this, and it would improve your life considerably.” But at the same time, I was like, “But maybe you should get that M1,” because I had been completely seduced by the visuals and the storytelling and the chip and the memory and all of that kind of stuff. After about 10 minutes of talking to him about this, I was like, “Maybe you should be getting this computer that I have and I should be getting that M1."

Chris: Then, after I rationally thought about it the next day, I thought, “I don’t need an M1 computer. There’s nothing wrong with this one. I bought it last year.” But that’s a really good example of emotion getting the better of you. You think to yourself, “Oh,” and you get carried away. I’m sure we’ve all been in a shop where we’ve bought something and we didn’t really need it, but we bought it on a credit card, and then maybe when the credit card bill comes in, we think, “Why did I buy that X?” That’s a good example of emotion and not rational thinking. I think a lot of this isn’t taught in design school. I’m really struggling with what The School of Design is, but it’s definitely this, right? It’s psychology, it’s touchpoints, it’s customer journeys, it’s emotional responses versus rational responses, it’s mental models. It’s all of the things that nobody really mentioned to you when you were at art school but you really need to know in order to work as a designer now.

Drew: I think having that sort of story behind a product is something that Apple does particularly well. I think they do it so consistently and have been doing it for so long now that perhaps people don’t even notice that it’s happening, but everybody listens to it. They can say, as you were mentioning earlier, “This new product has been milled from a single piece of aluminum,” and they’re telling that story. On a practical level, we don’t care how it’s been manufactured. They can use whatever manufacturing process works best for the end product. But they sell it to you on that, this is the care that’s gone into it, this is the process, we did this research, we found that this was the ... Then you see the unboxings on YouTube and the reviews, and they’re all, “Ah, did you know this was milled from a single piece of aluminum?” Those stories really sink in and give people an attachment to the product more than if it was just a utilitarian tool.

Chris: 100%. Because I’m leaving Belfast School of Art, at the moment, I’m bringing home boxes and boxes of stuff. One of my boxes, I don’t think it’s here, I think it might still be in the university, is called the experience, and it’s a cardboard box full of stuff that’s to do with this whole topic. There’s a lot of stuff from Howies, including a box of Clipper tea that came with a bag I bought. I was like, “Why are you putting that tea in,” and they said, “We always put a box of Clipper tea in with everything you buy.” I was like, “Right, okay,” fascinating for me.

Chris: But one of the other things, which I don’t have anymore, as a lecturer I used to do about 10 or 15 years ago where I had an Apple computer box in one hand and a Dell computer box in the other hand. The Dell box was a brown cardboard box, silkscreen-printed, pretty utilitarian and not very exciting. The Macintosh box was just the opposite. My story with the students was always like, “If you’ve just bought a computer that was 1500 pounds, this unboxing experience over here is telling you every step of the way you’ve made the right choice. The Dell box, on the other hand, wasn’t really doing anything. It was just getting it from A to B without getting scratched.” I think that that’s a real missed opportunity.

Chris: Packaging is something that’s often overlooked, and, actually, if you go and look at ... There’s some great books on Japanese packaging that we could all learn from in a Western culture. There’s a really good book called How to Wrap Five Eggs, and there’s another book called How to Wrap Five More Eggs. They’re both about the Japanese obsession with wrapping. They take an object, and they wrap that in tissue, which is considered, and they then put that in a bag, which is considered. They then maybe wrap that up and tape it together, which is considered, and then they put it in something else. Every step of the way is like a layering process that makes you just feel amazing, and all you’re unwrapping is an egg. It’s incredible.

Drew: Does communicating all these sorts of details and thinking about all these little touchpoints ... Obviously, it works for big businesses, mega-corps like Apple who’ve got lots of money to spend at it. Can it work for very small companies, too? You mentioned Hiut Denim. They’re just a small company, aren’t they?

Chris: I love the way you said mega-corp because it feels like it’s out of a film from the future, and they probably colonize planets as well. Yes, I think it works almost better for smaller businesses. I would argue that if you’re a smaller business, you have a real advantage. Let’s say I’m a mega-corp and I’m sending out my stuff. It’s very difficult for me as the CEO of mega-corp to hand-write a note for every single customer because the business is just too big. Then if I write a note and then try and sign it, well, maybe we could scale it a bit, right? But then what happens is you write a note and then you actually print the signature. It’s no longer actually signed. Then people like me who are cynical go like this and they hold it up to the light and they go, “Oh, that’s not signed.” That’s actually now having the opposite effect, in that it’s looking like it’s personal but it’s definitely not personal. Most businesses don’t think about any of this kind of stuff, but I can’t be alone in feeling that way.

Chris: But, on the other hand, if I’m a small business and I open my package, who’s a good example of this? Counter-Print Books. Don’t go to the website, it’s counter-print.co.uk, I think. Just don’t go to that website. You’re going to spend a fortune on books. But Richard Baird who publishes Logo Archive, which is a fantastic little zine, every issue of Logo Archive that I have had from Counter-Print Books has a little message from ... I think her name is Celine, and it always says, “Enjoy your zine, Christopher,” and she says thank you. I’m just like, “Wow, I’m so stoked.” I took a photo of that recently, which I’ll tweet when this comes out. I’ve got all the thank you notes.

Chris: I was teaching a group of crafts people about two or three months ago, and one of the other crafts people on the call, because I was teaching and they were all muted, I could see that she was wetting herself laughing. I was like, “Why are you ... Have I done something?” I’m thinking, “Is there something behind me?” I said to her, “Angela, why are you laughing?” She said, “I’ve also got all these notes as well.” I was just like, “Oh my goodness.” I thought maybe I was the only person who kept these. But I said to her, “It would feel like sacrilege if someone’s written you this little note to just crumple it up and throw it in the bin,” because it feels like that connection has been made with you across time and space. You can do that as a small business. You have advantages as a small business that big businesses don’t.

Drew: It’s almost like giving it a sense of provenance, isn’t it, like if you went to a local restaurant that has its own kitchen garden and grows its veg and sources its meat from local farms? It’s giving that feel of connection.

Chris: I wish I could show you. I’m opening up noti.st.mrmurphy and I’m going to go and find Paint a Product Picture. And Notist is so nice, so slide nine from Paint a Product Picture, which I’ll give to you and you can maybe put in the show notes, is a screenshot of the Apple Dictionary of the word provenance, “The place of origin or earliest known history of something, the beginning of something’s existence, something’s origin.” In my notes beside the slides in the slide view, the tall slide view, which is fantastic, “In an era of cheaply manufactured goods, customers are eager to know the provenance of your product.” That’s a good example of the differentiation you can have as a small business versus a large business.

Chris: The bigger a business gets, the more people there are in the business, the more there are people in middle layers of management who come along and say, “That thing that we’ve had made by this seamstress in Cardigan Bay, I think” ... If we come back to Hiut Denim, they call those people grandmasters. To you and me, they’re ... I don’t think you’d call them tailors because tailor to me evokes a Savile Row kind of image, like a suit that’s tailored to you. What they probably are are seamstresses or people with a sewing machine, and Hiut Denim call them grandmasters. But the bigger the company gets, the more this middle layer of management starts to say things like, “Look, we’re paying all these people in Wales 10 pound an hour basically to stitch up these jeans. What if we got those made in Bangladesh or somewhere cheaper, where the cost is less expensive and the cost of living is less expensive and there perhaps are less factory condition checks, et cetera? We could save a ton of money, and we could make more profit."

Chris: That’s the slippery slope, and when that happens, the provenance suddenly disappears. People care about that kind of thing now. I think coming out the other end of COVID, I think people will remember ... There were certain companies when COVID started, I remember in the UK, that were ... If you were an essential business selling food, you could stay open, but if you weren’t an essential business, you had to close. There were certain companies like Sports Direct who were saying, “We are an essential business.” There was a backlash in the public saying, “In what way?” It was kind of like, “Because people need to do sports while this is all happening.” I think that those kinds of things, people have long memories.

Drew: As a product owner, how important is it to rigidly stick to that vision that you had when you started things up? I think of companies like Basecamp, which was formerly 37signals, and founder Jason Fried there as always marching to the beat of his own drum in terms of what the product should and shouldn’t be. That’s quite often in the face of customers who are saying, “We will pay extra if we can have these features,” and the answer has always been, “No, that’s not what we’re about.” Is that a key to success, or is that just one path that someone might choose?

Chris: It’s a bit of both, I think. All my answers are always it depends. I think here’s a good example which is closer to home. Over the years, I’ve asked you to make changes to Notist where I’ve said, “I’m an educator. I don’t particularly want to make up fake conferences so I can share my slides.” But your product is really designed for speakers at conferences. I’ve almost come to a form of ... I’ve asked you to make changes to your product many times as a customer, and you’ve decided not to do that, and that’s entirely your right to say that because it’s your product. I think that there’s a place for having a vision and not immediately bowing to the needs of one customer.

Chris: It’s like yesterday, I was thinking about The School of Design and where we’re going. I wasn’t sure if the word designers was an important part of it for the customers, or was creatives a better word? I was having this debate with my other brain in my head, and I was like, “Actually, I think it’s designers.” But the reason I had used the word creatives was because one of the people who’s taking a course with me at the minute is not a designer. He’s a developer, and he said, “I think if you used the word creatives, I would feel part of it. But if you use the word designers, I wouldn’t feel part of it.” So I was almost going to change the whole pitch for the business because of the sake of one person, which, when I thought about it rationally a couple of days later, I thought, “That’s insane,” right? It’s called The School of Design. It’s all about design. You can be a non-designer and you can come into The School of Design, that’s totally cool, but I’m not going to change the language for that one person.

Chris: I think that comes back to what I was saying about Notist earlier. You have a vision, your product is working really well for that vision, and you’re sticking to it. I think that that’s a good thing. The flip side of that, if we think about 37signals, Jason Fried, et cetera, they are very strong-minded. They know what they want to do, and they also know what they don’t want to do. One of the problems with getting stuck in that way of thinking is that you can miss innovations. You can be so focused on this is what the thing is that customers really need something and just don’t do it, I think, because you feel so dogmatic. When we launched Get Invited, our ticketing platform, which is struggling because ticketing in the middle of COVID is a problem, our vision at the beginning was let’s not be Eventbrite. Let’s not put so much stuff on the page. Let’s just keep it simple.

Chris: When I briefed Kyle and David, my two co-founders, who were students when we built the business, it’s incredible, I said to them, “Look, above all, we must never lose sight of the fact that these pages for the events need to look beautiful. So we have stop people, normal customers, from messing up the pages by doing design.” And you know what? Actually, we were wrong. Overwhelmingly, people came to me and said, “Is there any way I can change the color scheme here because it just doesn’t fit my brand?” At the beginning, I was kind of really ... “Nope, forget it.” People were saying, “Could we put our logo on it,” and I was saying, “Absolutely not because it’s going to ruin the design.” Once we had hundreds of people coming and saying that they wanted to change the color or they wanted to add their logo or could they add more than 140 words to a description, we had to listen to the overwhelming evidence that perhaps we were being a bit too narrow-minded and we needed to flex a bit. So it’s that balance between sticking to your vision and not getting stuck in a cul-de-sac.

Drew: And how do you weigh into that the fact there might be competitive products or services in the marketplace that might do things that you don’t do or have features that you don’t have? There’s obviously a temptation there to start matching all the competitors feature for feature.

Chris: I think matching competitors feature for feature is a slippery slope because as soon as you do one, then you suddenly start feeling you have to do another. Before you know it, you’ve lost track of your original vision. If we come back to the Notist example, the thing I was describing to you was probably a different product. It’s probably the guts of Notist but batched as a tool for speakers who are not events, they just make a lot of decks, they make a lot of slide decks, and that’s a different product. So there’s opportunity there in the sense that you could use the same code base to make something different with a different brand and a different audience and a different target, et cetera. But perhaps if you did this thing and this thing and this thing, then suddenly your thing’s lost its identity.

Chris: Coming back to Get Invited, the example, we were very careful to ... If 100 people ask for X and we sit back and look at it rationally and think, “Okay, maybe we should buckle here and we should give them this thing because it’s affecting people’s willingness to take up the product,” so that was something. But it’s the slippery slope. I think you want to be you. You don’t want to be a smorgasbord of your competitors.

Drew: I suppose there’s a balance there between building a very narrow band, focused solutions for a specific need, versus building something that could fit a number of uses, I guess, to use a metaphor, a bit like a garlic crusher and a chef’s knife. The garlic crusher gets the job done with zero effort, but it only does that one thing, and the chef’s knife can also mince garlic, but it can do a thousand other things at once, but it requires a bit of skill to learn and to use. So, in terms of products, is there a way to balance that up? Do you go down a very focused, easy path and then duplicate it if you want to grow?

Chris: I think for me, at the beginning of the product journey, it’s really important to have focus. It’s really important to think, “Okay, well, who are my customers? What are they going to spend, and how am I going to look after them to the best of my abilities?” I think you could sell something that appeals to everybody and as such appeals to nobody. For me, at the beginning of the journey, it’s really important to focus down and think, “These are the core people.” It feels bizarre to me, but we’re nearly in December. I’ve been working on The School of Design in a kind of beta form for 11 months. I still don’t really know what it is. When I started the journey in January, my audience was definitely students. It was like, “This is cheaper to learn UX and UI using what was then called Design Track. It’s an alternative to university education, and it’s students.” The more I’ve been working on it, the more I think it’s not students, it’s actually professionals who are in the middle of their career and there’s just a lot of things about design they need to know. But I haven’t said, “Okay, I’m now going to include those people.” What I’ve actually said is, “This is the wrong audience and this is the right audience, and these people, I am not going to waste any time over."

Chris: I think that, at the beginning of your journey, if you try to be a knife ... This is going to be so cool with this metaphor here because people are not going to understand us if they come right into this bit of the podcast. At the beginning of your journey, if you try to be a knife, you’re being all things to all people, and I think it’s better to be a garlic crusher at the start and then over time add more things, as you scale slowly. So, for me, what’s really important, what are we trying to do and can we get a group of people to be really happy with what we’re doing and also pay us some money in the process because, otherwise, this is just a hobby. Once we’ve got those people happy, can we start to expand a little bit but not just in a massive way where then we’ll lose focus and we’ll become a knife? But at some point in the future, it might be worth considering becoming a knife because a garlic crusher at that point is perhaps too limiting.

Drew: You mentioned finding the right audience. It’s obviously important to find a market and work out what that market should be and tailor the product to fit that market. Is that something that the program at The School of Design addresses? Is that something that it equips people with?

Chris: 100%. I think that one of the things that we’re looking at is definitely audience. Who’s the audience for this thing? One of the modules that I was ... I mean, I don’t even know if we have modules, actually, if I’m honest. But, certainly, one of the things that I will be teaching is a thing I call venture testing. I talked about this in a workshop I was doing on Wednesday for startups in the Northwest, up in Derry, Londonderry, Derry. Covering all the bases here, Derry for one audience and Londonderry for a different audience, that’s a big city in the Northwest. I was talking about this process called venture testing. For me, it’s like build a smoke test page, use Facebook and Instagram to drive traffic to that smoke test page, and if there is interest and there are sign-ups, great, keep working on it. If there is no interest and there are no sign-ups, then either you’re driving the wrong traffic to the page, in which case, modify and change, but if no one is signing up for anything, then it’s time to close and move onto the next thing.

Chris: So I talked about a workshop that I’d launched with a friend of mine on the Propel program, and we had one sign-up. I kicked off the talk on Wednesday with, “This was a success.” Most people are looking at you thinking, “But you only had one sign-up.” Then I’m showing the structure of the course that I was going to have to write and saying, “One person is not worth writing all of this content and making all of these screencasts, so this has saved me a massive amount of time.” It’s really important not to get deluded with your own ... “I really believe this product’s going to be amazing,” and you don’t really check with anybody else, and you’re like, “This is going to be” ... That’s how the Segway kind of happened. The Segway kind of didn’t really turn into what the Segway guy thought it was going to be. It’s now a tours around Berlin type product. It’s not the future transportation.

Drew: On a practical level, what sort of format does The School of Design take? Do you know yet? Is that still up in the air?

Chris: Yeah. I literally have absolutely no idea. What I’m doing ... Well, two or three people I have to say are massive. First of all, the team on Propel have been amazing. Secondly, Ben. There’s a particular guy, Ben Allensi, on Propel who’s been really great. He’s young, he’s early 20s, and he has a startup. He really inspires me because he’s young and he’s got a lot of commitment and passion. Another guy, Mehall, as well, he’s 19, and he, with a friend, has made over 40 grand. He’s a first-year student at Ulster University, I’m amazed, and he’s making a product that connects to satellites for farmers. It’s incredible. Another friend, Al Parra, who’s been helping me with my website, which has been the slowest website build known to man or woman or any other gender. It’s been very, very slow, and that’s because I haven’t really been sure what I’m doing.

Chris: I think the biggest clue I got was signing up for Anne-Laure Le Cunff’s Ness Labs. Ness Labs is amazing. About two weeks ago, I got an email from Anne-Laure, who’s a friend of mine, saying, “Welcome to ... The course starts on Monday.” My immediate reaction was, “Have I signed up for a course that I can’t remember?” It wasn’t. It was more a case of if you’re a member of Ness Labs, you get access to these course. That, for me, was a real turning point because at that point, Drew, I realized that up until now I was selling workshops and with the workshop, you got access to a community. I then realized that what Anne-Laure was doing was selling a community that gave you access to workshops. That’s the same thing, but different. I think that that’s the biggest clue I have in terms of where I’m going.

Chris: It’s a community. It’s not a community you can join right now because I’m still working on it, and there is a very small community of around 30, 40 people who are on our Slack who are all helping each other, and they’re super, super early beta people. So it’s a community, and then my feeling is that if you’re in the community, you just get access to learning. The best way to explain it, if I pull up my Notion ... I have a library in Notion, which is free, and it’s library.theschoolofdesign.com, and it’s essentially everything I’ve learned and everything I’ve taught. But there is a book called Hello: A Practical Guide to Building an Email Newsletter That Works, and it’s part of the series of books that I envisage that I’ll be working on over the next year or so. There’s three ways to read the book, and I think this explains The School of Design.

Chris: Way number one is read it from first page to the last page in that order, right, just pick it up and read it. Way number two is just dip into it, okay, just read bits. Way number three is don’t read it. I realize that that sounds a little bit like, “What?” So I’ve written here, when I say don’t read it, I don’t mean ignore it. A lot of people just don’t have time to read at the minute. They’re too busy rushing around. So I’m going to be taking the books and the learning materials and saying, “Join me on Thursday evening at 7:00, and we will run through the contents of that book.” Then, if you want to go and read certain aspects and go into more depth, you just go and get that book, and it’s free, and it’s in the library, and you have access to it.

Chris: So what I see The School of Design being is a community of designers who know they need to know more, that they haven’t learned everything there is to know, and I think that I’m going to probably get into trouble by saying this, but I think that membership price is probably quite low. I think it’s something like 60 pounds a year or something. All my friends have told me that’s far too low. But I think that the community, it should be open to as many people as possible, and, to me, that’s more important than making money. Somehow or another, Drew, I have to earn enough money to pay my bills in order to just help as many people as I can. That is essentially my vision.

Chris: Essentially, my vision is that The School of Design is like a master’s course but it doesn’t cost what a master’s course would cost. Because if you went to do a master’s course in London or something, it would be 10,000 pounds. I think that in The School of Design, there probably are some courses that are more premium that you can do, but the majority of stuff is just being part of a community. I don’t know about you, but I think communities are going to be big as we move forward. I think that places like Smashing’s community and The School of Design community and Anne-Laure’s Ness Labs, people are hungry for that, especially in this world where we’re not really connected to people. So that, for me, is really exciting.

Drew: It is very exciting. You don’t refer to students as students, do you, in The School of Design? You have another term that you use.

Chris: Yeah, I was calling them founders because that was informed by the Propel program. Founders was the word I was using a while back. I’m not 100% sure if it’s still the right word because I’m not necessarily sure that everybody in The School of Design is a founder. I think that some of them want to build their own businesses, but some of them just want to do a better job of building businesses for other people. I’m torn at the minute, Drew. Last week, I was like, “It’s for people who want to build their own products,” and, yeah, it’s definitely for those people, but they might be a subset. That’s because I was having a conversation with somebody recently who works at Booking.com. I’m helping this particular person with some mentoring, and he doesn’t want to leave Booking.com. He’s very happy, but he knows that there are certain things that he wants to learn to enhance his current understanding, and he’s been out of art school for probably about eight or nine years. He just is at that point where he feels like there’s a few more things he’d like to learn but maybe doesn’t have 10 grand to go and do a master’s.

Drew: I guess it comes back, like you were saying, about Hiut calling their workers grandmasters, it highlights the importance of the choice of language in our products.

Chris: 100%. And I probably would still lean towards founders than students because, to me, students has so many connotations. Students, to me, is the wrong word. I know that. Also, I’ve written two books on language, The Craft of Words with Nicklas, my partner at the time. So we’ve got The Craft of Words, Part One, which is on macrocopy, and The Craft of Words, Part Two, which is on microcopy. We should put a link in in the show notes. But language is so important. How you choose to describe things affects how people perceive things. Language is another part of The School of Design.

Chris: One of the things that I’m doing at the minute is looking at the library, which has some rather ambiguous section titles, like Life First, Work Second, and I’m like, “God, that’s awful. Why don’t I just call it Process or something?” But there are sections in the library like Marketing, Branding. Pricing is another one. There are sections in the library that will still be there. Productivity is another one that I’m adding, in terms of how can you be mindful but be productive as well, and Mental Health or Mindfulness is another one because, to me, living a life intentionally and not just autopiloting through your life is important, and living a life with purpose is important as well. But maybe I’ve just got old and I started to realize these things.

Drew: Is the program focused on founders who are making digital products or the founder who’s ... Would they feel just as at home if they were making shoes?

Chris: Yeah, I think for me it’s products. I would remove digital because I was talking to Cara, my wife, about this yesterday. She’s a silversmith. For me, that distinction isn’t really there. So if we think back to when we were talking about Apple earlier in the conversation, there’s the service design aspect, there’s the physical product design aspect, there’s the software aspect, all of these things we need to know. I don’t think that one designer can do all of those things, but, for me, one of the things we used to start the master’s off with was this idea of a t-shaped person. Tim Brown from IDEO talks about this. You’re really good at a thing, but you understand the other things as well. So I think that the kinds of people who are joining The School of Design are t-shaped people. They’re really good at something, but they understand how to work with other people who are good at their thing, too.

Chris: We have a section of the library which I’m working on, I’m going to be launching next year, which is called Beacons, which are examples of companies that we can learn from. In my Notist decks, it’s noti.st, N-O-T-I, dot, S-T, slash, mrmurphy, there are a number of the beacons are in there. Hiut Denim is one. Field Notes is another. Ustwo Games is ... I’ve been talking to Mills at Ustwo Games, who’s super, super interesting, Mills, amazing. There’s a ... Blok Knives is another one, Benjamin Edmunds. What’s interesting to me is quite a lot of them are not digital products. They’re physical products. We can learn by just looking at all of the landscape of stuff, that consumers give you money in return for you to give them, as we’ve said earlier, solutions to their problems and joy. How do we as designers build those kinds of things? I think we’re good at doing solutions to your problems, sometimes we’re missing joy, and sometimes maybe we could a bit more work into just joy and no solutions to problems.

Chris: But we can learn as designers of products digitally from physical products as well. For me, if you look back to the Bauhaus at the turn of, well, not really at the turn of, but the beginnings of the 20th century, you have a lot of people, Walter Pierce, Johannes Itten, Walter Kandinsky, who are ... They don’t have ... They’re not like, “Oh, I” ... Mies van der Rohe is doing chairs, but he’s also designing buildings, and he’s also designing textiles. At no point, did anyone say, “Oh, no, mate, you can’t do that because you’re a chair guy.” If you look at Charles and Ray Eames, which is more than Charles Eames, it’s Ray Eames as well, and Ray always gets way overlooked, which I think is wrong, the Eames partnership were making films, they were designing chairs, they were ... These people, to me, are like mega-mega-beacons. So we can learn from Dieter Rams. We can learn from Charles and Ray Eames. We can learn from the Bauhaus. We can learn from the Ulm School. If I suppose the only way I can describe The School of Design is that it’s like a master’s education minus the master’s price tag, it’s basically all the stuff I used to teach on my master’s at Belfast School of Art but for a fraction of the price.

Drew: So you’re launching at the beginning of January?

Chris: First of January, yeah.

Drew: What does that launch look like?

Chris: On the first of December, I’m just going to start my blog properly at theschoolofdesign.com. And I’ve got a mailing list, which I’m going to start properly sending emails out and things like that. It’s been busy for me because I’ve been teaching for the last semester. But from the first of January, probably inviting more people into the Slack and then finding our way forwards, lots more customer conversations. What’s really important to me, Drew, is not opening the doors to all and sundry with something I haven’t thought through. I would’ve thought by now that I would’ve got it finished because I’ve spent the last year thinking about this, but it’s been through so many iterations that I’m still learning. What I would say is you can access the library right now, it’s at library.theschoolofdesign.com, and there’s a lot of stuff in there.

Chris: That, for me, is not going anywhere anytime soon. But I see some of those sections being turned into mini-lectures or workshops. It’s just like, “Do you feel like you need a shot of creative injection energy in your arm? Show up on Thursday evening at 6:00, and we’ll do a session on something this week, marketing or product storytelling or mental models.” I’m sure most designers, they don’t need to turn up to all of them to get their money’s worth. They just need to show up to a handful. The other thing I think we’ll probably be doing on the first of January is sharing the first season of speakers. We have this idea of seasons, like a Netflix type thing. So Mills from Ustwo has said he’ll do a talk for us. We’ve a few other interesting people who we’ve lined up.

Chris: That first season is called ... Oh my word, what is it called? I can’t remember. It’s something about the fact that the world has changed. It’s to do with what is tomorrow with COVID. Basically, we just get people to come and they ... They had a thing on Propel called Founder Firesides, which was amazing. I loved it because you would show up and someone would be beaming in from somewhere in the world and Chris, who is the person who ran Propel, would just ask them a bunch of questions and then we as people on the course could ask some questions, too. I don’t know if anyone in Smashing community knows Farnam Street. Farnam Street do something similar. They have monthly AMAs, and they get really interesting people. They ask the community if there’s anything you want to ask this person, what would you ask them? I just see there as being an opportunity to build a community of people who want to learn together.

Drew: It all sounds really exciting, and I look forward to following it as it all happens and seeing what comes of it. It sounds like a great opportunity for those who wish to continue their design education or maybe start their design education.

Chris: Well, start as well. Start as well. There’s an awful lot of people that I’ve been teaching on Propel over the last couple of years who maybe when they started did not really know much about design. By the time I’d finished with them, you’re running a few sessions, they were picking up pens, they were sketching interfaces, they were a bit more design-aware. I think we all need to be design-aware as we move forward. We’ve talked about a lot of it just now, which is great. Awesome.

Drew: I’ve been learning all about product design. What have you been learning about lately, Chris?

Chris: What I’ve been learning about is Facebook advertising. Facebook gets a really bad rap, but I have this idea in the venture testing module, which is what I call traffic beating. It’s terrible. I’m going to pull it up here because I can read it off here. So you’ve built your smoke test page, okay? You’ve got your product described. What I’ve written here in beating traffic, “If you’re unfamiliar with the world of grouse shooting, the idea of beating might be new to you. Here’s a description from the National Organization of Beaters. A beater flushes birds, pheasants or grouse, from cover, driving them in the direction of the guns. In this peculiarly British metaphor, the birds are your customers, and the guns are your smoke test page.” I’m really interested in how do we get people to see the page that we’ve built to describe the product, how do we find the right people, and how do we get them pushed over to here?

Chris: Facebook is one way, but Reddit ads and Google ads ... I think that designers moving forward need to have some of the skills that startup founders have, which is startup founders are trying to achieve a lot on usually not very much money, certainly, the model of startup thinking we have on this side of the Atlantic. In the San Francisco, Silicon Valley kind of world, it’s like, “Don’t worry about customers. Here’s 100 billion dollars, and good luck.” That’s a completely crazy way of running a startup if you’re in the UK. If you’re in the UK or somewhere that’s not Silicon Valley, it’s like you build things, you try them. If people are interested, you do more of it. If they’re not, you move onto the next thing. So that’s what I’ve been learning about. It’s like how do I get more people to see the things that I’m testing?

Drew: If you, dear listener, would like to hear more from Chris, you can follow him on Twitter, where he’s @fehler, that’s F-E-H-L-E-R, and you can find The School of Design online at theschoolofdesign.com. Thanks for joining us today, Chris. Did you have any parting words?

Chris: Yeah, my parting words would be just start. If you have an idea, just start, right? Don’t build it in your head and make it really, really complicated. Until this year, I used to do that. I used to think, “Oh” ... if you look at my Tiny Books, which was my previous thing, tinybooks.com, it was so big in my head. There was going to be a book about this, a book about something else, a book about this, and then there was going to be a smaller book about this and even smaller book called a Comet about something else. I had this huge solar system in my head, and the one thing I did this year was embrace an everything is a prototype mentality. Everything I am doing is a prototype. So if something works, great. What did I learn from it? If something doesn’t work, great. I still learned something from it.

Chris: My advice, my parting words, would be if you have an amazing idea, just start because I’ve met so many people in the last 30-something years who have an amazing idea and when I say, “Can I see the homepage or do you have anything done,” it’s still in their sketchbook. I’d rather see it out there on the web or somewhere. So start, one word, simple.

Smashing Podcast Episode 29 With Leslie Cohn-Wein: How Does Netlify Dogfood The Jamstack?

In this episode, we’re asking what it looks like to dogfood the Jamstack at Netlify. Can you deploy an entire app to a CDN? Drew McLellan talks to Netlify Staff Engineer Leslie Cohn-Wein to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: She’s an award winning frontend specialist originally from Austin, but now living in Dallas, Texas, via a stint in New York city. During that time working for agencies, she built sites for clients, such as Nintendo, WorldPride, and Jerry Seinfeld. She’s now a staff frontend engineer at Netlify, where amongst other things, she works at building out the application customers use to manage their service and deployments. So, we know she’s an accomplished frontend engineer, but did you know, when living in New York city, she served as an assistant chili cook-off judge three years in a row. And that one’s actually true. My smashing friends, please welcome Leslie Cohn-Wein. Hi, Leslie. How are you?

Leslie Cohn-Wein: I’m smashing.

Drew: I wanted to talk to you today about how Netlify sort of eats its own dog food, to use that charming expression, when it comes to building on the Jamstack. I should put this in context a little bit by saying that up until a few months ago, we worked together on the same team at Netlify. And when I got there, the development process was actually really foreign to me, even after 20 years as a developer. I thought it was just really fascinating and well worth exploring a bit, with a wider audience. I should probably point out that we’re talking about this because it makes a genuinely interesting case study and it’s not a sponsored big ad for Netlify. Everyone should check out Vercel. But I think there’s a lot of valuable things that can be learned from discussing it, particularly from a Jamstack point of view. Because Netlify is a really big proponent of the Jamstack approach and the service is sort of offered to the customer and is built around that idea of building Jamstack projects. But the service is also built using those principles itself. Isn’t it?

Leslie: It is, yeah. A lot of people sort of think of that Jamstack architecture as static sites, but we’re really dogfooding what it means to build a Jamstack app with the Netlify frontend. Because it’s a React app that is a full Jamstack app that we deploy Netlify on Netlify so... Yeah, we’re really trying it out and pushing the limits of what’s possible.

Drew: I think there’s sometimes this idea that Jamstack is great for just static sites, as you say, and the API aspect comes in if you want to send a form to an email address and you can just do something easy like that, but you can possibly build a whole web app that way. But, you are doing that aren’t you?

Leslie: Yeah, absolutely. Our app, talking specifically about what you see you if you login at app.netlify.com, is powered by... we’ve got an internal REST API, but the frontend, like I said, is pure Jamstack. So, we have our own build step, we watch the app as it builds in the app, and we deploy on our own system.

Drew: So, when there are a backend process involved, and there’s always going to be some sort of level of backend processes, you know, persisting data or, in Netlify’s case, starting off with a deployment or what have you, that backend just kind of gets built as a series of APIs that can then be consumed by the frontend?

Leslie: Yeah, so there’s a couple of different models of how you can make this work. In most cases, in our app, we use client-side fetching with React, right? So, we serve sort of a static shell of the app and then we fetch the user’s information from our internal REST API at the request time. Jamstack is interesting because there’s some things you can pre-build, and we try and rely on that when we can. And then when we’re talking about some of the more dynamic data, we’ll use that client-side fetching in order to make sure that we’re pulling in the freshest data.

Drew: I think it surprised me, when I started working on the app, just how much is being achieved in the frontend, particularly when it comes to interacting with external APIs and things. I know that when Netlify interacts with your Git provider, so it goes to GitHub and gets a list of list of repos, that’s all happening between your browser and GitHub. And apart from maybe the... going through a server-less function that’s putting some secrets on the request or something lightweight like that, most of that is just happening in a Jamstack-y sort of way. It’s not going through a Netlify sort of core backend infrastructure. So, that’s quite fascinating. That really is going so much further beyond just a static site with a few API calls to do little things. That’s that real core functionality, isn’t it, that’s being implemented in the browser?

Leslie: Absolutely. It really pushes, I think, that concept of what a frontend developer engineer is, right? And it’s something that pushes me, as a frontend engineer to be better and to think more about those sorts of... the API layer, which is not something that I’ve traditionally have been as close to. I work more in UI and colors and design systems, and so it really... I actually have found that working on a Jamstack app at scale, has pushed me to be a better developer.

Drew: Being a frontend developer isn’t knowing CSS back to front, although that’s part of it. It is not knowing HTML back to front, but though that’s part of it. It’s also straying into this territory that was traditionally the preserve of a backend engineer, which is quite interesting. Does Netlify use new server-side rendering for-

Leslie: Not that I’m aware of.

Drew: So, it’s all just literally done, as you say, you serve a shell, and then it gets populated with requests back to different API end points to sort of populate it all.

Leslie: Exactly.

Drew: And you say it’s a React app?

Leslie: Yes. Yes. React. We use React Redux right now, and right now we’re PostCSS, but we’re experimenting with our CSS architecture as well.

Drew: Aren’t we all? So, you build the app in React and then you deploy it on Netlify?

Leslie: Yes. Maybe my favorite part of that whole process is the magic of Deploy Previews, which we get through Netlify. So, what happens is, you’ll... you’re working in GitHub, you push up your PR. So, you open up your PR in GitHub, and that is going to automatically create a build of your Deploy Preview of the app. So, we actually use Deploy Previews of the app itself to test out, to make sure everything is working the way it should. We run our tests. That’s what we use to manually verify during code review. So, we have sort of all of that continuous deployment set up right from GitHub.

Leslie: And then one of the other cool things that we have set up is that we actually have a couple of different Netlify sites that are pulling from the same repository where our app lives. So, we have both our app, we’ve got an instance of Storybook that has sort of our UI components for the app. So, we have both our app itself, we’ve got the Storybook UI components, and we have basically a Netlify site that shows our Storybook UI. And then we also have a third site that runs a webpack bundle analyzer. So, it’s a visual UI that gives you a tree map, visualization of all of the apps bundles, and we can sort of gauge their size, and it’s just a reminder for us to double-check sort of. As every deploy of the app goes out, we can check and make sure we’re not doing anything weird with our bundle size there. So, all three of those sites get generated in one Pull Request of the app. So, you’ll get links to preview, your Deploy Previews essentially, of both the app Storybook and to that app profile for us to check through.

Drew: And with the Deploy Previews, that essentially kind of becomes your staging environment, does it?

Leslie: Exactly. We don’t really run a traditional staging environment, because we really trust that our Deploy Previews are essentially what is going to go live when we hit that merge button and kick off the official build of our main branch in our main app. So, I love that we can rely on Deploy Previews as the staging environment. We really trust that it’s going to match production. We’re building it with all of the production variables, everything that... environment variables, all of that stuff gets built in the Deploy Preview. So, it’s pretty much like a no worry situation. As long as your Deploy Preview is working, you know that the app is going to work as well.

Drew: And I guess, as an organization, if your Deploy Preview isn’t matching what gets put live, then that’s a service issue that Netlify wants to resolve. So, it actually works out quite nicely from that point of view. So, you’ve reviewed a Deploy Preview, everything looks great, the PR gets merged. What happens then?

Leslie: So, because Netlify runs all of our continuous deployment, essentially we have it all hooked up so that any merge into our main branch will automatically kick off an official production deploy with the app. So, typically if you’re the developer who has merged your own PR, you’ll pop into the actual... you have to make sure, double check your tabs, because if you have a Deploy Preview of the app open and the app, you got to make sure... you usually want to follow along in the real app. So, you got to check your tab. But, yeah, in the app, you usually go in, you can watch the build logs for that merge that you just kicked off, so it’s all automatic. And then as soon as those build logs complete, and the site is live, all you have to do is refresh your browser window and you’ll see whatever you had just deployed, should be updated in the app.

Drew: And let’s say you catch a problem once it’s gone live, what do you do then?

Leslie: That’s a very good question. And maybe one of my favorite things about using Netlify even before I worked at Netlify, this was like a little bit of magic to me, because Netlify has sort of baked in, what we call, rollbacks. So, essentially every deploy on Netlify... because we’re using this Jamstack architecture, every deploy is atomic. So, what that means is you have this full history of every sort of deploy you’ve ever made on a site, and you can instantly roll back to any one of those. So, if we accidentally deploy a bug or something is broken, the first thing that we usually do is we actually stop that continuous integration. So, we’ll go in and it’s just one button in the Netlify UI that you say, "Stop auto publishing," and what that will do is it stops that connection with GitHub. So, if my teammate is suddenly also merging their PR, we’re not going to re-introduce the bug, nothing like that is going to happen.

Leslie: So, we stop all those auto deployments. And then all I have to do is go back into my deploys list and find the last working deploy, hit one more button that says, "Publish this one," and it goes live. So, what that does, is it takes that pressure off to be able to really go back, look at the code, figure out what actually happened. Sometimes that means doing a Git revert on your main branch and getting the main branch back where it needed to be. And sometimes it’s a hot fix or you go off on a branch and you get it fixed and you don’t really even need to worry about reverting in Git. And then, when you’re ready to go back, you make sure everything’s working on your Deploy Preview of the app, and you can just reset all that stuff back up. So, as soon as you start those auto deployments, you’re basically back in business.

Drew: So, I’ve spotted a problem here.

Leslie: Uh oh.

Drew: You’re using Netlify to deploy changes to the Netlify app. What if the bug that you’ve deployed stops you rolling back? What do you do then?

Leslie: I have nightmares. No. Actually, we have a couple of ways that could handle that. So, if we take down the app and we can’t use the UI to go through this process, our Deploy Previews actually run against our production API. So, what that means is, even if the app isn’t working, we still have those atomic deploys. So, if you have a link from GitHub, perhaps from an old or recent PR, and you have that Deploy Preview URL, you could actually access the Deploy Preview of the app and make whatever change you need, go back and publish an older deploy from the Deploy Preview. And it’s still hitting our production API, so that will still affect the app, and then that will bring the app back up. It’s like sort of exploding brain emoji there, but it’s one way to do it. We could also publish an older deploy from some of our backend systems. We could get our backend engineers to publish that for us. Or you can always use Git to revert and try and push that up, but it’s a little bit scary because you can’t watch what you’re doing.

Drew: I guess you just need a very clear mind to manage that situation.

Leslie: Yeah.

Drew: But it’s totally recoverable from, it sounds like it.

Leslie: Yeah. Well, and once you’ve published your working deploy, all the pressure’s off. That’s really the nicest part. And I found this working in agencies as well. Being able to roll back was really a lifesaver to... It also makes you less worried about publishing new changes. If you break something, it takes a second to roll it back, which fits very nicely with the sort of move quickly and get things out model.

Drew: Definitely. I think typically this sort of whole workflow works best when you’re dealing with really small changes. I mean, ideally you want to create a branch, implement a small change, raise a PR, and then get that merged back as quickly as possible. Which obviously works fine for tweaks and bug fixes and little things, but it doesn’t work so well for major feature work when that feature might take weeks or maybe even months from it starting to it being ready to deploy. How do you manage that sort of process?

Leslie: Yeah, that’s a great question. So, we’ve recently started using feature flags a little bit more. Before I go talk a little bit more about how we do that, I’ll talk about what we used to do. So, before we were using feature flags, I think everyone’s sort of familiar with the idea of the long running feature branch. We all sort of hate them, right? But we would work on our smaller PRs. We would merge each of those individually, after code review, into this longer running feature branch. So, you would just basically have all of your new feature in one place, you could have one Deploy Preview that you can test that new feature with. Sometimes this model sort of required coordinated deployments across other teams. So, when we were ready to say, "Okay, this feature branch, we’re ready to merge it and get it live," occasionally that meant, "Okay, you got to make sure backend’s already deployed their change," so whatever API work that we’re doing in our feature is ready to go. If there are docs on our doc site that need to go live at the same time as the feature, you sort of have to coordinate and hit the buttons at the same time.

Leslie: This model is... it worked for us, but you’re right, that it wasn’t maybe the smoothest. It’s actually sort of funny, our co-founder and CEO at Netlify, Matt Biilmann, actually launched our analytics feature using this process onstage at Jamstack Conf London last year. So, he used our lock deploys feature to basically take the Deploy Preview of the new feature of analytics and publish it live on stage. So, that was pretty cool.

Leslie: But, like you said, it’s... you have a little less confidence. Everything is still sort of hidden in this Pull Request. It becomes a bit unwieldy. Someone has to approve that final Pull Request that usually is quite large. That’s a little overwhelming. So, nowadays we’re mostly using feature flags. We use a service called LaunchDarkly, which lets us basically wrap our new feature UI with these flags, so that we can keep continuously merging code, even if the UI isn’t something we want customers to see. So, you just make sure in the production environment that your feature flag is off, we can deploy the code, merge it, and no one... assuming that you’re a general user, you’re not going to see that new UI.

Drew: So, a feature flag is basically just like a switch in the code that says, "If this feature is enabled, use this new code, otherwise use this old code."

Leslie: Exactly.

Drew: Does that mean that you get sort of a messy code base with all these forks in place? How do you deal with that?

Leslie: Yeah, I think that’s... anyone who uses feature flags probably is used to this sort of battle of when do you clean up the feature flags? How long do you leave them there? We’ve sort of landed on about two weeks after a major feature gets released, is we have reminders. Luckily, LaunchDarkly actually recently set up a feature that will notify Slack. So, you can hook it up with Slack, and it’ll just tell you, "Hey, your feature flag has been... You’ve been live in production for two weeks. It’s about time to go make sure you clean up your flag in the code."

Leslie: So, we do try and, and clean it up pretty quickly, but it is, in that time in between, it is nice to know the flag is still there. Even if you’ve released the feature, it means that again, with one click, you can go in and toggle that flag back off it there is a bug, if there is something that pops up. So, we like to leave them in for a little bit, just while the feature is really baking, while people are getting used to it, to make sure there aren’t any major issues. But then we do try and go back into the code and it is a bit of cleanup, so it’s not an ideal process, but usually removing the flag doesn’t take very long, you’re just deleting a couple of lines of code.

Drew: So, I guess the simplest approach to implementing a feature flag could just be a... like a config variable in your app that says, "This feature is on or off," but then you, you need some way to make sure that it’s on for the right people and off for the right people. And I guess that’s where a service like LaunchDarkly comes in, because it takes that... I mean, it takes basically what is switching on and off a variable to an extreme level, doesn’t it?

Leslie: Yes. Yes. That’s exactly it. So, there are ways we could have, even without LaunchDarkly, basically set up a config variable ourselves that we sort of manage on our end. One of the things I love about LaunchDarkly is that there are different environments. So, what we can do is essentially turn on a feature flag for our Deploy Previews. So, anyone who’s viewing internally at Netlify, a Deploy Preview of the app can have access to the new feature, can test it out, but then again, as soon as it goes live in production, that flag is off. So, there’s very little... again, you sort of have to check your tab and make sure you’re aware of sort of what segment you’re in, because you don’t want to surprise yourself and think you’ve launched something that you didn’t, you have to be a little bit careful there. But, in general, it works quite well, and LaunchDarkly lets you also do these selective rollouts. So, you can roll out a feature to some percentage of your code base or to a specific user segment, people with a specific type of plan or a specific type of user. So, it allows you a lot more control over who you’re sort of releasing to.

Drew: Yeah. That can be really powerful, I guess, particularly with new features or features that you might be expecting to resolve an issue. Maybe you’re enhancing a feature to make it more understandable, you can maybe try it with 10% of the users and see if they’re experiencing the same problems and...

Leslie: Exactly. It’s a great way to get feedback as well, yeah.

Drew: I guess using LaunchDarkly in this way, rather than rolling your own solution, is kind of another aspect of the Jamstack approach, isn’t it? It is just using an API that gives you this functionality without having to worry about how you implement that yourselves and how to develop that and how to maintain it and keep that so that you can just outsource it, say, "Right, we’re going to use this API and everything else is taken care of."

Leslie: Yep. Yep, exactly.

Drew: So, this approach enables you to be committing small bits of new features to production essentially, but they’re just sort of hidden behind the flag. And then when everything is ready to go, you can just flip the flag and you can quickly switch it back again if something goes wrong.

Leslie: Yep, exactly. It makes our launches a little bit less exciting. It used to be you’re pressing these big buttons and there’s all this code that’s getting merged and you’re watching your build logs and it’s this moment of anticipation. And now it’s you hop on a Zoom call, you click one button, and it’s live.

Drew: Yeah. I think the last feature launch, I worked on an Netlify, we used this approach. And it had been weeks of work for a whole team of people, and we got on a Zoom call to coordinate the release, and everyone confirmed that their parts were ready. And then I flipped the feature flag and turned it on for all users, and that was it.

Leslie: Done.

Drew: And it was over in a few minutes and it was really anticlimactic.

Leslie: Yeah, it’s sort of sad.

Drew: There was no sweaty palms, there was nothing, which of course is exactly what you want, isn’t it? That’s how you know you’ve got a robust process, if turning something on for everybody is just not a big deal.

Leslie: Exactly. And if you got to roll it back, again, it’s just that simple, it’s that one click. It relieves some of that pressure, anxiety.

Drew: So, presumably, I mean, not all changes are going to be just frontend changes. Sometimes there are going to be backend changes, and presumably they have their own feature flags as well in most backend systems. So, you mentioned docs as well. Is there a way to coordinate all of this together? Does everybody just flip their flags at the same time? Or how does that work?

Leslie: Yeah. So, this is an area that we’re sort of actively working on across the teams right now at Netlify, is working towards a solution that would allow us to perhaps tie everything to one single flag in LaunchDarkly, that all of our systems are using, all of our code bases are using. So, in an ideal world, we would be able to flip a flag and say, "Okay, this is toggling on the new API end point that is also being consumed on the frontend with this new UI that is wrapped in a feature flag, as well as this portion of the doc site, that has new information about this new feature." And you flip that one flag in it impacts all of those repositories. We’re not quite there yet. We’re working through that, but I’m excited to see sort of if we’re able to get all of that coordinated and working.

Drew: Netlify, as a service is very much sort of tailored to building sites in this way. Does the work that you and your team are doing using the product, actually influenced the product development at all?

Leslie: I’d say that it definitely does. Everyone always says you are not your user, which I think is true most of the time, except sometimes when you are your user. Which is funny at Netlify because I think most of the people on the frontend team in particular, are people who have used Netlify before as a product. And certainly because we’re using Netlify to deploy Netlify we run into the same challenges that I think some of our users do. So, in some ways, if we run into a problem, we’ll try and bring it up to the rest of the company. We’ll mention it in an engineering call or we’ll pull in our CTO and say, "Hey, this is something that we’re struggling with. Is there something we could build into the product that would make this easier for us and for all of our users who are deploying similar things that we are?" So, it’s sort of a unique position to be in, but it’s fun to see how the product roadmap gets developed.

Drew: I guess there’s probably few people out there using Netlify quite as intensively as Netlify does itself.

Leslie: Yeah. Yeah. I think that’s about right. I stare at Netlify both when I’m building it and when I’m deploying it, so I’m pretty familiar with it.

Drew: And then at the weekend you work on a side project and you find yourself back in Netlify again.

Leslie: Yeah. That’s actually very true. Yeah. Yes. yes, indeed.

Drew: Do you have any examples of like how the product direction has been influenced at all by the work that the team’s done?

Leslie: Yeah. So, we’ve pretty recently launched a new sort of landing dashboard for the app that we’re calling The Team Overview. So, it used to be when you logged into Netlify you’d land on the site’s page, which would just basically be a long list of your sites. And we wanted to give people a little bit more of a mission control area where they can sort of see a lot of important information at a glance, get access to things that are going to be most useful to them. And so, that was a new feature that we built. In the initial iteration, we’re trying to get it out quickly, we have a little card on that UI that links to your latest builds. It shows you any build across your whole team, should show up in that card.

Leslie: And at first, we actually hadn’t linked those up to the build... the display log itself. So, it was just a list where you could check it out. You could click into the builds page to get a sort of similar view. But I was actually working on something over the weekend, a personal site, and I had this team overview turned on and I was annoyed because I realized I logged into Netlify and I wanted to go check out this build that was happening of my project, and I couldn’t just click on it and get right to it. I had to click into the builds page and then click again. So, the next day at work, I went in and added that change and linked up those builds because it was bothering me. So, that was one example of sort of just realizing by using the product, that there was a very small opportunity to improve it. And we took that.

Leslie: But we do have some other examples, too. Probably a little bit more impactful. One is that we sort of added this form detection feature. So, a little bit of background, if you’re not familiar, Netlify forms is a feature in Netlify that lets you build a frontend form. And Netlify sort of does all the backend work of managing submissions. It’s sort of like your database for your form that you’ve built on your frontend. It means you don’t have to write any server-side code or a whole lot of extra JavaScript to manage form submissions. Really any site that you deployed to Netlify, as your build is happening, our build bots are parsing your site’s HTML at deploy time to basically detect if you’ve got a Netlify form that Netlify needs to pay attention to and manage. And this form detection, the build bot’s looking for that, is enabled by default.

Leslie: But what that means is that, as you can imagine, that eats up a little bit of your build time because the bots have to go and look for this extra step. So, the Netlify app itself, actually, we’re not using, we don’t have any Netlify forms on the app right now. So, this is a step that basically is adding a little bit to our build time, but it doesn’t necessarily need to happen. So, Netlify actually built a new feature that allows any user to disable that form detection. What that means is you can turn that setting off in your site settings, the build bots realize that there’s nothing they need to look for, so you save that little bit of extra processing time in the builds.

Drew: I guess that’s great in terms of productivity, because things just complete a little bit quicker.

Leslie: Exactly.

Drew: But also, as a metered service, enables you to get more out of the sort of allowances that you’ve got.

Leslie: Yep. Exactly. And so, this was something that we also heard from some of our users and customers, and it was something we sort of noticed as well. It was, "Well, we don’t need this extra step in our own product. So, is there a way, something we could give to all of our users to make everyone’s life a little easier, make everyone’s build a little faster if they’re not using this feature?"

Drew: Is there a danger... I mean, you say that you’re not your user, but with Netlify you often are your user. Is there a danger that, with the intensity that you use the product, that you might overlook the sort of users who are only using it very lightly and everything might get too complex and too advanced, and it’d just become very difficult to get started with?

Leslie: That’s that’s a great question. We also have really built out our user research function at Netlify and our data science function, and I think, overall we trust them a lot more than my anecdotal experience using and deploying the app. But I think all of that data sort of comes together to allow us to get a better picture of who’s using Netlify, what type of user are we speaking to? There are people with different types of needs. We’ve got folks on our starter teams who are managing blogs and personal sites, and we’ve got huge enterprises as well, who are launching big marketing campaigns and big web apps, not so dissimilar from Netlify itself. So, it’s exciting to sort of see the user base grow and to think about all these use cases and to figure out how we can cater to all of those users. And certainly using more of our research functionality to lean on understanding who those users are, not just our internal experience.

Drew: Tell me, Leslie, about the screenshot service that Netlify has in place? Because I found that really interesting.

Leslie: Yeah. In the UI we have... when you deploy a site on Netlify, in the UI, we have a little screenshot that shows you typically what the homepage of the site you felt looks like. It’s actually funny we brought this up, because I was listening to Chris Coyier his episode on Serverless not so long ago, and he was talking about how they do screenshots in CodePen as well, which is actually not so dissimilar to how Netlify does it. But basically we run Puppeteer to capture that screenshot of the user site, and the way that it’s all run is that it’s set up with a Netlify function. So, this is again, an example of us dogfooding our own product. So, essentially we use this end point that is a Netlify function inside our own app to return the URL of that image of the screenshot, that then we can serve that up in the app.

Drew: So Netlify functions are Netlify’s implementation of a Serverless function, aren’t they? Where you basically just drop a JavaScript file into a designated folder as part of your source, and then that becomes available to be executed as a cloud function.

Leslie: Yes, exactly.

Drew: Super smart, isn’t it?

Leslie: Yeah. It’s brilliant. This is one of those areas where it really pushes me as a frontend engineer to really be more of this JavaScript or Serverless engineer, and think a little bit more about how you’re basically writing like an internal API end point for yourself when you create one of these Serverless functions. So, it’s exciting because there’s so much you can do, but that can make it a little intimidating also because there’s so much you can do.

Drew: I sort of find it funny how it’s like... that’s seemingly a core piece of functionality for Netlify, displaying images alongside your site of what it looks like, yet, it’s just implemented with another Netlify feature. And you wonder how far you go before it all disappears in on itself in a big cloud of smoke.

Leslie: Yeah. Yeah.

Drew: This sounds like a really nice way to be working, and a very modern way to we’re working, but it can’t be without its challenges, can it?

Leslie: Absolutely not. I think I’ve spoken a little bit about what it means sort of as a frontend engineer pushing into sort of some new areas just for me to be thinking about in terms of Serverless and how can we leverage this in the product? I think for me, mastering that sort of back of the frontend side has been an exciting challenge, but certainly there’s a lot to learn there. An example of that in our app right now, is that we use Cypress for end-to-end testing of some of the critical flows in our app, and right now we have that set up so that the Cypress end-to-end tests are running on our Deploy Previews in Pull Requests using a GitHub action. So, we use the GitHub action to run those Cyprus tests against the Deploy Previews of the app.

Leslie: Which is really cool, but there’s probably a better way to do this than actually using a GitHub action. I actually think that we could use a Netlify Serverless function because those can be triggered on certain events, like a deploy succeeded event. So, there’s an opportunity there for us to actually leverage again, Netlify, a little bit more, instead of relying on some of these other tools that maybe we’re more familiar with or more comfortable using. So, in terms of challenges, I think it’s opening our minds to what this sort of new model of development allows us to do and trying to leverage it.

Drew: Yes, there’s so many different ways on there to... with the tooling that’s available, to be able to attack a particular problem. At Smashing, we probably shouldn’t say there’s more than one way to skin a cat.

Leslie: Yikes.

Drew: What’s interesting about the workflow as well, is that it’s really intensively Git based, which I think suits... it’s really developer friendly, isn’t it? As a frontend engineer, something that’s Git based kind of just feels like home. So, is that all great or are there any problems that come in with that?

Leslie: I think as a developer Git is wonderful. I think in general it solves big, big problems and I’m very happy to have it. But, because we rely on it so heavily and as our internal team has grown as well, you end up having the same problems that Git has when you’re talking about Netlify in this workflow, right? So, you end up with a bug on your main branch, yes, it’s really easy to roll back the app itself, we talked through what that looks like, and then go in the code and fix it. But what if someone else on your team is working from a broken version of that main branch? Everyone’s going to have to rebase, everyone’s going to have to communicate, or at least be aware of what happened. And so, it’s not so much a Jamstack problem or a Netlify problem, but more of just the age old, how do you coordinate on a team of human beings and how do you use the technology to do that properly?

Drew: And of course, as you add more tools and infrastructure in around what you’re doing, then you’ve got the problem of everything taking a long time to run. I mean, you mentioned Cypress is one thing. I know Cypress is a real headache with the amount of time those end-to-end tests can take to run. Is there other challenges around that growing build time?

Leslie: Yeah, I think that’s one of the other things that Jamstack... You’re introducing this build time, which for developers is not great. I always try and think about it as what I sort of eat up in that build time, my users are saving in the performance of what they’re getting. So, I always try to keep that in mind when I’m frustrated about how long something is taking to build, but certainly I think that’s an area of opportunity and a challenge, is figuring out how to keep those build times fast, how to make sure that we can deploy as quickly as possible. Some of it is this sort of tension between wanting to run all your tests, wanting to make sure that you don’t deploy a build if a test fails, but at the same time, then you’ve got to run all those tests.

Leslie: So, it’s this constant sort of back and forth between wanting to keep the build times fast, while also making sure that you feel like you’re doing your due diligence before you actually deploy something. And we’re playing around with some ideas here as well about potentially moving our Cypress tests to be running against production and having some alerting setup that would let us know after the fact, if something had failed. Which is sort of an interesting model, too. So yeah, stay tuned.

Drew: I certainly know that, yes, the dangers of growing build times, just from a developer point of view, from productivity point of view, that if something takes too long to run, you context switch, you start working on something else, and then it just... you lose all the momentum, and maybe you forget to go back and find out whether the build succeeded because you’re then so far into the next task.

Leslie: Yeah, definitely.

Drew: So, I guess this isn’t the ultimate workflow as it stands at the moment. There must be further we can take it. What sort of opportunities might lie ahead for this way of working?

Leslie: Yeah. So, I think for me, and Netlify in particular, is sort of the thought of collaboration for larger teams. I mean, I know a lot of developers are sort of... have used Netlify for side projects and other things that they’re working on, on their own, but thinking about how it can be leveraged on larger teams, like mine. As we get larger and we’re growing, more of us are in the app, more of us are using Netlify to deploy our own services, and so everything from even more robust audit logs so that you can go and see who changed this site setting, or who was the last person to deploy something. I think having the ability to organize your sites within your Netlify dashboard, even knowing... assigning someone to a build is sort of an interesting idea to me. Could that be helpful if I knew that my teammate had worked on this build, but then I realized they had to roll it back? And maybe I’m just aware of who’s managing that process could be a really useful thing within Netlify itself.

Leslie: And one thing that I’ve seen sort of thrown around a little bit is perhaps the ability to link to a specific log line in build log. So, for debugging, if you have your build log of your Deploy Preview, and there’s an error that got thrown, either from Netlify or from your own code, it’d be nice to be able to link directly to that log line. So, that’s sort of a fun, small improvement that I’ve been thinking about a bit. And that’s not even to say we have some new features at Netlify as well, that are pretty exciting. Edge handlers and background functions. I’m still trying to wrap my head around what they all do and exactly how they work, but I know that edge handlers are going to give us the opportunity to do some things with localized content, which could be... have some interesting implications for features we could build in the Netlify app as well.

Drew: Yeah, it’s really exciting. I think there are all sorts of people within the Jamstack community who are pushing this the whole thing forward. But I think Netlify, as a service, is one that is really behind it and doing exciting things. And, as I say, I didn’t want this to be a big ad for Netlify, but I think you and I both really love the service, so it is exciting to talk about isn’t it? If listeners want to get more engaged with learning how to build Jamstack sites or want to get more into this ecosystem, is there a good place to go to learn this stuff?

Leslie: I feel like it’s exploding right now. I would certainly point you to the Netlify blog. We try and post some tips and tricks there and announce new features as well. I would give a shout out too, to Learn With Jason. My coworker, Jason Lengstorf does sort of a live stream show, and he does cover... he covers a range of topics, but does some Jamstack specific ones as well. And it’s a fun hour of live coding and picking that out. Twitter, I think, is huge, too. So check out Jamstack hashtag.

Drew: Good advice. So, we’ve been learning all about how Netlify builds Netlify on Netlify. What have you been learning about, Leslie?

Leslie: Oh, that’s always a big question. I mentioned Cypress before, we’ve been working through some of our processes around exactly how we want to run our end-to-end tests, and so I would say that, in general, I’ve been thinking a lot about that workflow. So, less about the technology itself, but more about what workflows exist for end-to-end testing on the frontend, and what makes sense sort of in this Jamstack model. So, that’s been a fun sort of side tangent. And then, on the CSS side of things, we talked a bit about CSS architecture, and I’m starting to get my hands dirty with Tailwind, which has been a fun and exciting and lots to learn and lots of class names to memorize and... Yeah.

Drew: That’s exciting stuff. If you, dear listener, would like to hear more from Leslie, you can find her on Twitter where she’s @lesliecdubs, and her personal site is leslie.dev. Thanks for joining us today, Leslie, did you have any parting words?

Leslie: Have a great day?

Smashing Podcast Episode 28 With David Darnes: What Is Eleventy?

In this episode of The Smashing Podcast, we’re talking about Eleventy. What is it and how does it fit into your Jamstack workflow? I spoke to David Darnes to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a freelance designer, front-end developer, and writer based in Bristol, U.K. With over 11 years professional experience, he’s built up skills in design, UI development, and front-end development, working with names such as Ghost, Stackbit and BaseKit. In his spare time, he also shares his knowledge by writing articles and contributing to open source projects such as Anchor CMS and the Alembic theme for Jekyll. So we know he knows his way around web technologies. But did you know he once crossed the Sahara on the back of tortoise while reciting the complete works of Shakespeare? My Smashing friends, please welcome, David Darnes. Hi Dave, how are you?

David Darnes: I’m smashing, thank you for asking.

Drew: I know you not only as a friend from the local tech scene here in the wonderful city of Bristol, where we both live, but as someone with a rich background working with different types of publishing tools. We mentioned your experience contributing to Anchor CMS, you recently did a load of work with Ghost, you’ve worked on things for Jekyll, but you’re also somebody who’s really embedded in the JAMstack space. You’ve worked with Stackbit and I’ve seen projects you’ve done around Netlify integrations and right there at the intersection of JAMstack and publishing tools, we’ve got Static Site Generator. It’s no surprise that this is something that’s relevant to your interests.

Drew: I wanted to talk to you a bit about Static Site Generator that seems to be taking the space by storm, or I’d like to think maybe it’s a quiet, reserved takeover, but that is Eleventy. It seems to be everywhere. Where’s it sprung up from?

David: I’m not going to be the oracle of knowledge on the origins of it or anything, but it’s a labor of love, I would describe, from Zach Leatherman. It didn’t catch my eye until maybe a couple of years ago, but it’s in the same realm as Jekyll. Jekyll is a longstanding Static Site Generator which predates JAMstack as a concept anyway. JAMstack being JavaScript, APIs, and Markup to signify the JAM. Recently someone said, "Yeah, but Jekyll doesn’t fit into that JAMstack thing, because it’s not JavaScript." I was like, "Oh, that’s a good point."

David: Eleventy does use JavaScript and more than just accurately being a definition of JAMstack, it’s also a very speedy and much more, I would say, approachable Static Site Generator over Jekyll. However, it does have the similarities of Jekyll, with the templating language and the structure, albeit more flexible. I think that’s a pretty good description of Eleventy itself, I would say.

Drew: You mentioned things like Jekyll, which is implemented in Ruby, is it?

David: Yes.

Drew: And we’ve got Hugo in Go, there’s Gatsby which is a React Stack, but Eleventy is just pretty much plain JavaScript, isn’t it?

David: Yeah. I think that’s one of the features, I would say. One of the features is that you can write regular JavaScript in there. I do that all the time when I struck up at Eleventy project, I write a bit of no JavaScript in the configuration file. If I want to source from an API or get the Fetch API and sling it about and try and work out, I sync a way until I get something to come back to me. One of the things I need to be better at is working out how that stuff works.

Drew: That means that Eleventy fits in really neatly into existing JAMstack tooling. If you’re already building those projects, adopting Eleventy into it is going to be quite a natural fit?

David: I would definitely say so. I would say that it fits it... It may be too hard to say this, but I feel like it fits it to a T. I feel that that is quite the definition of a part of a JAMstack tool set. I’m going to say that like JAMstack, that would include other things. So an API could be a CMS of some kind that you’re using Eleventy to source that content from, but definitely I’d say Eleventy fits into that realm.

David: It also fits to somebody who wants to get somewhere precisely rather than... I was thinking of Synology earlier today is, there’s a lot of frameworks that will be like a flight to somewhere. So you fly to like Glasgow, but you want to go to Edinburgh. You want to be somewhere specific. You want to be in a specific town. A big framework would fly you there and then you would have to spend time getting taxis and meandering to exactly what you need.

David: Eleventy is much more like a precise journey to that almost exact location. You will have to do a little bit more work. You might not be able to get a flight straight over there, but it’s going to get you economically to that point more precisely. I think the analogy needs ironing out, but I think it has a substance.

Drew: You must have worked with other Static Site Generator. Obviously, we mentioned Jekyll. What’s your experience been in the past with other similar systems?

David: I’ve used Gatsby as part of a framework, a part of a live project to quite large site. So I’ve used Jekyll and I have used... I’ve tried Next.js and I’ve tried create some out and Nuxt as well. I should probably say Nuxt and Next, like at the same time, really, because they have similarities. Of course, they would because they’re looking at each other essentially, but they are both very good. I enjoy those ones the most out of the ones that are a bit more like JavaScript intense. I had a lot of fun using them albeit briefly.

David: I think Gatsby and Jekyll would be the ones that I’ve used the strongest in live projects. I would like to use Hugo, because I hear it is extremely fast, like generating stuff. That would be really cool to try out.

Drew: Yes, that seems to be one of the attributes of Go as a language because there seems to be incredibly efficient and performance out on that all important build step. Do we need another Static Site Generator? Are we reinventing the wheel again and again and again? What does Eleventy do that’s different from all these others? Why on earth would we entertain learning yet another?

David: That’s a great question. With a lot of Static Site Generators, why do we need another in the space? As with many like open source projects, there’s some that are built with the intention to be an open source project there and off. Some of them do really well and some of them not so much. You can tell that there was a little bit of a not hollow incentive, but like the goals of the project didn’t have focus.

David: From what I’ve read and heard is that Zach created this because he needed to build this tooling and it came to be like perfect for his needs. That need is actually a need of a lot of other people. So it fit into that realm. I think that’s how that came to be.

David: There are a lot of Static Site Generators bubbling up and servicing. I liked the variety because the variety means that people who have done... You never know, there’s people out there that just doing Go. They don’t know any JavaScript, they don’t know anything else. If they know Go, then Hugo might be right for them.

David: For like Eleventy, I felt like I know that the typical JavaScript, HTML, and CSS, and that seems very comfortable to me. That’s my safe space. Eleventy fits that area for me really well more so than Jekyll did, I have to say. Like Jekyll, the plugins are a little bit cumbersome to work with. I think Eleventy brings something a little bit more what I was hoping for as a Static Site Generator.

David: It’s a little bit more vanilla in terms of its structure over things like Jekyll. Yeah, I’d say it’s not perfect. I understand that there’re issues with it... Or not issues, but things that people would like out of it, but it doesn’t quite achieve that. But I think it’s got an ND appeal to it. I think that’s why it’s growing fairly quickly.

Drew: You make an important point about matching the technologies that you’re already using. If you’re building something Go, you might use Hugo as a Static Site Generator because it’s just going to be the tool set that you’re familiar with. If you’re building stuff using React, then you might choose Gatsby because that’s all React.

David: Exactly. Yeah.

Drew: Having something that is just doing a straightforward JavaScript and just neatly drops into that ecosystem. If you’re writing JavaScript all day, then you’re going to feel right at home and you’re going to be more productive in using it.

David: Yeah.

Drew: The basic job of a Static Site Generator is to take a bunch of content, which is usually been authored outside of the tool later in... SSGs don’t deal with altering the content. They accept it from somewhere, often that Markdown files, isn’t it?

David: Yes.

Drew: They then go through some templating and turn that into a set of HTML pages. It doesn’t always have to be just Markdown files so does it to these things work with?

David: No, I would say Markdown has become the default API for content on a lot of Static Site Generator. Some of them you can, out of the box, not use Markdown or there can’t be compatible with Markdown, but 99% of the time, Markdown files are content source. However, I find, personally, Eleventy to be really compatible with external CMS. CMS is that have an API of some kind.

David: As you mentioned before, I worked at Ghost and Ghost has a headless option. It could be used in an entirely headless CMS, which means I can pull all the content out of my Ghost installation and feed that directly to Eleventy and construct all the content and API is inside of the templating language to just render pages, render content, render pretty much anything, like get the images out there as well.

David: There’re all ways to pull through content. There’s lots of different CMSs out there, even more so than how many stacks are generators and those CMSs can be pulled into Eleventy pretty comfortably. I wouldn’t say easily, you need a little bit of JavaScript knowledge, of course. But it’s very typical, I would say, to pull in that content using the Fetch API or some JavaScript API that the ecosystem has.

David: Again, Ghost has its own like JavaScript API that you can use to pull the content through. So yeah, you could use all sorts of CMS. Again, you could use WordPress.

Drew: Yes, because that has a headless mode now, doesn’t it? I guess you could use any CMS that has an API that lets you retrieve content from it?

David: Yeah. You could even use them together. You could use a combination of them. It almost kind of you going back into a, not a monolith project, but you’re using lots of services to pull them together to use them as their strongest parts and then, products and pages and posts and they could be all sourced from all sorts of places.

Drew: Yeah, so you could have marketing team maintaining a blog in Ghost or in WordPress and you could have some technical documentation being written just in modern files and you can mix and match any of these just a case of how you put that, build step together inside Eleventy. How do you feed the content into Eleventy? You don’t have to write out Markdown files and point it at it. There’s certainly a more sophisticated way than that.

David: For the Markdown files, conveniently, Eleventy will just take those Markdown files. It will see it and go, "Well, let’s mark down," and it’ll start working HTML out of that one. Whereas for an API, to begin with, you would use probably something like node-fetch to pull through that content from an API endpoint, you’d get back like a big blob of like JSON, for which then you can turn that into a JavaScript object and all of those little endpoints and bits of data.

David: Then for example, if it’s posts or pages, that is effectively a collection of things, a collection of blog posts or a collection of pages. Inside of Eleventy, there is a concept of collections. What you can do is in the main Eleventy JavaScript file is say, "Hey, these posts are a collection and I want to treat them like a collection. So please, add them to Eleventy’s internals, and let me iterate through them using the default template in language," and Eleventy is none jokes, but you can use all sorts of different templates in languages in there. Then you can start iterating them over them with a full loop of some kind, and then you can construct pages out of those.

David: It does require a little bit of knowledge and you have to dig around in the documentation. Thankfully, on top of the documentation, there are lots of people that are creating lots of open source projects for which you can cheekily copy and paste a few bits, if you’re like me, but probably read it a little bit to understand what’s going on. But there’s lots of resources out there.

David: The collections thing, I think, is a really powerful tool because when I’ve been using it, I can pull in a collection from anywhere that’s like an array. So the square brackets, you pull it through, you start creating collections and I’m starting to creating like single pages. So like single post pages or single regular pages or product pages. I’m rendering all of those single HTML files and creating collection list views so I can click through to those pages. Suddenly, your site map is now being constructed in not very many moves. It’s very powerful.

Drew: It seems to strike something of a balance using it in that way with content sourced from a CMS. It strikes a balance between the robustness and speed of a static site and having a nice to work with content editing suite of tools that less technical people in an organization, who may be altering content, would be more comfortable using.

David: Yes.

Drew: It’s a quite an interesting option to be able to do that, to be able to pull in different sources of data. I guess that would really suit people as well, who are working with legacy systems as long as they can get to it with an API of some sort, as long as they can make some issue to be requesting. Even if that’s in RSS or whatever, that would all be workable with.

Drew: You talked a little bit there about templating and the fact that Eleventy has different templating engine options. Historically, lots of systems can be quite opinionated about which templating language that they use. Often actually, a lot of the functionality that you have within SSG comes from the templating engine. Eleventy isn’t particularly opinionated to do that?

David: No, I have to say it’s as close as unopinionated as you could get. A bit of a personal view, but I struggled to see any framework or anything that can be unopinionated because, in order to create something, you have to have an opinion on how you want to do something. It’s kind of oxymoron. I’m sure people could correct me on that.

David: But yeah, you can switch to whatever templating language you feel most comfortable with. We were just talking about languages that you are comfortable with. Eleventy appeals to that in a sense with what templating languages use inside your HTML, or heck even your CSS, if you want. For me, I just went straight to the nunjucks because nunjucks is the default templating language inside of Eleventy.

David: That means I can use the dot HTML extension and leave it as it is. Now, I’m just going to confuse people even more and say, you can name that however you want. Anyway, you can have real fun with it. But you can use handlebars. I think you can just use regular JavaScript templating and iterate through it like that. Handlebars quite popular, Liquid as well. I can’t think of all of them off the top of my head, but if you set it all up in the configuration, you can just pick however you want it.

David: I’d say, I’m a real big fan of just templating languages in general. It wasn’t too long ago when I found out that you could use twig inside of WordPress and that blew my mind. I was like, "Oh, thank goodness. I don’t have to handle a for loop inside of PHP." Again, I think something a little bit more comfortable and understandable, more readable as well. Yeah, Eleventy has lots of different templating options and it should appeal to people who are comfortable with those different ones.

Drew: Yeah. Just looking at the documentation for Eleventy that it’s not just a case of, there is a default templating language. If you’re really determined, you can switch it out with something else. There is a great big list of options that you can choose from. You mentioned Liquid, Handlebars, mustache, JavaScript, template literals, just HTML, and all sorts. Ones that I recognize, EJS, Haml, Pug, who knows.

David: Pug?

Drew: Pug.

David: Yes.

Drew: I’m presuming that’s still a templating language

David: Yeh, I think it used to be called Jade, didn’t it? Then they renamed it because something else was called Jade. So they had to change the name or vice versa.

Drew: There we go, Pug. That’s quite fun. The community around open source tools can be really important content in setting the tone for what it’s like to learn and to get help when you need it. You mentioned that there were a people building stuff. What’s the community like around Eleventy?

David: All I can answer is from my personal point of view. Other experiences it could vary and I would want to strengthen that community, but I’ve found it to be really strong and really welcoming and encouraging. People are really keen to like want people to have a go with stuff because for a lot of people, Eleventy could be that little extra step from taking a single "flat HTML file" and turning it into something more rich.

David: It could be somebody that, "Oh, I have this HTML file and this is my portfolio site. I want to put my GitHub projects on there, but how do I keep it in sync with my GitHub account?" Well, API pull it through with Eleventy and people are creating example projects of that all the time. There’s lots of different blog templates and there’s lots of people working hard to give people starting points for it, whether it be really quite intense and complex starters. Write down to something really base level.

David: Well, in my opinion, base level. Things like for doing CSS compiling and like really low level stuff to sort out your JavaScript bundles and things like that, right up to, you want to get all the best scores at your lighthouse and you want to have like image resizing and you want all of those powerful tooling and you want to just hit a button and get started with it. They might hit like that deploy to Netlify button probably, and have a site running within a few minutes.

David: So yeah, back to the community part... I got veered off then, but yeah, I would say the community is really strong and encouraging. I’d like to think Zach’s attitude towards the community is permutating into the rest of it. He has a good heart, I would say.

Drew: I’d agree with that. You mentioned starting points and things, there seems to be quite an ecosystem of different sorts templates and starting points and things with Eleventy. Is it all based on just publishing blog type stuff, or is there anything more advanced in there?

David: I would be inclined to say that probably is probably too many blog template starters. I think that’s a symptom of a lot of Static Site Generators. I think Gatsby suffers from that quite hard. There’s a lot of the blog template starters, which is useful and everything, but there’s a lot of dev bloggers who can do all sorts and start from wherever they want. There’s lots of starting points for them to get going with things and they can get involved with code as much as they like.

David: It would be nice to see some more variation in the community. Like maybe some more e-commerce ones and some more starting points from people who are creating real life projects. You could accuse me as well of making starters that are very much for blogging and things like that. I could probably help in that sense to make more e-commerce starters and things like that. But I’ve seen quite a lot of them.

David: There’s a performance blog template starter at that I’ve been working with, and that is very powerful, but again, that’s a blog templating starter. I think there’s a lot out there, but there’s quite a few are focused on blogging and portfolios to flight that it’d be good to see more wider market. This is how WordPress came to be, WeCommerce and all of that sense where it does all sorts of different things and it’s used on a very commercial level.

David: Maybe when 1.0 of Eleventy drops, some gear change will happen. Don’t quote me on that.

Drew: That’s an interesting point actually, because Eleventy has been out for quite a while now, but it’s still 0.11 of the moment.

David: Yes.

Drew: Is there any inkling that one might be on the horizon or is that an academic at this point?

David: I follows Zach on Twitter and I see some tweets every of flirtatious idea of 1.0 dropping. That is one of the things that makes me a bit reserved to use it on like commercial projects, because, when I see 1.0 applied to a project, I see that the developers or the people that are on the project think it’s good enough to be 1.0.

David: So if Zach puts 1.0 on it, he thinks it’s good enough to be used in a commercial sense. That’s how I see it. That doesn’t stop me from using it for all different projects out there, but it just gives me a little bit of reservation and yeah, it almost sounds like I’m being a detriment to saying it’s a bad thing of Eleventy. I think we’re just waiting for 1.02 to land so we can use that as a bit more of official thing and bring it up in client meetings to say, "Oh, there’s this thing called Eleventy. It’s a stable project. It’s for commercial use. It’s something we can use."

David: That is to say there has been a React dependency once in a while that wasn’t version 0.1, and yet we still used it on like live stuff because he was like, "That’s the only way I’ve seen anyone else do it."

Drew: I guess that’s the convention is net with semantic versioning that while some things at zero point, whatever, the API could just change all the time. It’s almost like every release could be like emerging version.

David: Yes.

Drew: In practice, probably, Eleventy I think is one of those that is much more stable than that. Perhaps what we’re actually experiencing here is more like version one point whatever, with enough by one error.

David: Yes. That’s more the case.

Drew: But, in terms of structuring projects, and this might take us a little bit away from Eleventy in particular, but it does apply. There are different ways you can build your tool chain with Static Site Generator. You can do things like run Eleventy locally, generate a whole load of HTML files. You can commit those HTML files to a rebound and publish that.

Drew: If you’re using a hosting provider that has the capability to run a build process, you just commit your source content and then have that build process run up on your hosting. How do you typically do that? Are there pros and cons of doing it either way?

David: That’s a good question actually, because one of the cons... If people are already listening, who already used a lot of Static Site Generator, they’ll probably know about platforms like Netlify and Vercel that do the build processing automatically. Any change to the code base will mean that a rebuild will happen.

David: I was about to say one of the drawbacks to that is that the process just disappears into the realm of hosting and the deployment system. Now, I can watch that build process happen, but the client can’t watch that because, it’ll be like the matrix is they won’t see blonde and brunette and stuff like that. They’ll just see a lot of like characters happening and they might understand some of the wording, but really they want to see the change. They want to see, aka, a preview of something happening.

David: There is a detriment to that as opposed to having almost a build process locally to them that automatically regenerates that. There are CMSs out there that can do that and there’s also Static Site Generator that can do that as well and build that process in. I believe Next.js has a preview option, which means that you can pull the API content straight through and see it immediately.

David: There is a drawback to that, but I would say there’s more of a drawback to doing it, the manual method of rebuilding it locally, and then pushing up your directory of HTML, CSS, and JavaScript, and just slinging a big blob of it at SFTP server. That is to say that I have done it. I have had to do it for certain reasons. I do remember using Sage to host stuff and that’s the state co-hosting platform, but it didn’t have a deployment light build process. I don’t think it has either now.

David: So what I would do is build it and then throw it at Sage and just host it there, which was really useful for prototype development. So I would be building stuff with JAMstack principles and creating prototypes with that, build it, throw it up to a Sage domain and then share it with my team and share it with like QA people to understand what’s going on.

David: There are pros and cons, I guess there are different purposes. The manual process is good for people who are in the code. I wanted you to understand, I wanted to keep an eye on everything and control the dials more. Then the build process or having it all automatically done with things like Netlify and Vercel means that they can automate the whole thing. Not only that use things like build hooks to automatically regenerate the sites when the client makes content change on something like WordPress.

David: The content change happens and then a build process has begun on Netlify and it will rebuild the entire site. For example, like Eleventy will rebuild and the new content will appear there.

Drew: I guess, doing it the manual way gives you the ability if you are pulling in content from systems that might just exist on a private network, or might not have APIs that are publicly accessible. That need to be then done offline, wouldn’t it?

David: Yes.

Drew: You couldn’t do that in the cloud if those APIs weren’t available?

David: No, that is true. You probably have local credentials that you would only be able to access from your machine. That was a good point. I guess, that’s a bit more of a layer of security and the publishing processes is a bit more officialized. I wouldn’t be surprised that larger platforms, like, I could see things like The Guardian, as something that needs to go published.

David: Having a single published button seems a little bit too powerful and having like a publishing process that gets approved by developers and editors because the site is so reliant on the web, there would be content, people were working together to get that up there. So, yeah, that is a good point.

Drew: One of attributes of Static Site Generator that have caused me to migrate projects to different platforms in the past has been the speed of that build step. The time it takes to process all your content into HTML pages. How does Eleventy fare on that front? Is it quick? Is it slow?

David: I would say it is one of the quickest, definitely one of the fastest. It’s hugely faster than Jekyll. I’m sorry, Jekyll. I love you. But I’ve got a project somewhere that is 10 minutes to rebuild, and it’s not a particularly large amount of content. You’ll see the difference if you’re coming from Jekyll. By the way, if I haven’t made it clear, if you’re coming from Jekyll and you want to look at something newer, I definitely suggest looking at Eleventy as your next Static Site Generator. But it’s not the fastest.

David: I would say Hugo is the fastest running on Go. Eleventy is based on JavaScript. So it’s only going to be as fast as JavaScript itself. I guess the familiarity of JavaScript is how it would beat it in terms of like Hugo, there’s a bit more of a smaller community with Hugo. That’s how you would trumpet in that sense, but on pure speed, Eleventy is just behind it.

David: But I think that’s a nice place to be in, to be one of the fastest. I know other Static Site Generators and generative tools or frameworks out there much slower in processing a large amount of content. If you’re looking for something that generates documentation, as you would know, documentation sheets can be massive and Eleventy would happily digest that and turn into a site.

Drew: Ingest, I think?

David: Ingest, yes.

Drew: Ingest, yeah. I guess, JavaScript is a good place to be. It’s a good bet to make. If you’re looking for speed, because in terms of the ecosystem, there’s a lot of effort all the time in improving the engines and making it run faster because so many people are depending on JavaScript so much these days.

Drew: You mentioned large sets of content. Sometimes you see things like while sorts was publishing tools, but Static Site Generator CMSs that provide a really good demo of workflow and speed and everything when they’ve just got 20 build posts in them. Then as the content in a volume grows over time, they just get completely bogged down and they don’t scale and they don’t respond linearly to large amounts of content. Have you got any experience with big content sets in Eleventy or know if people have been working that way with it?

David: That’s a great question because I haven’t actually used it myself with large content sets. But I do know that there are fast quotes of build times for thousands of pages at at a time. I would caveat in that saying, and I don’t know how contrived those pages are. There could be just a couple of paragraphs or something like that, nothing too complex.

David: I would say that, in my experience, I’ve used Gatsby and other generative tools that I have large content sets. I would say Eleventy leads it in the dust, quite measurably, which is the same to things like Gatsby that fall behind because they’re doing so much other stuff going on. One of the great things about Eleventy is that, if you have a project that just has some HTML files in it, it’ll do it. It’ll just go through them and it will just output it and do its thing.

David: You can be very low level, you can be very high level with it. Whereas on a Gatsby project, the benefit is having all of those features and tooling in there, but it’s also a detriment as well. You’ve already slow because you’re doing all of these magical things and now I’ve got to undo it. Again, it’s that starting point that you want to go with. But I would say it’s very fast. I would need citation needed for actual build examples.

Drew: But what’s the documentation like with Eleventy? Is it pretty comprehensive?

David: I find it all right to navigate. I understand I’ve seen a few comments about people having trouble getting around the documentation and I see their gripes. I’m not the source on like the best documentation there is. But as part of my job, I do a lot of content for documentation sites. I’ve done it for Ghost and I did it for Anchor CMS and I did it for BaseKit as well, like building out the template and documentation there.

David: In comparison, I think it still requires a little bit of navigating and a little bit of understanding of how Eleventy works itself before you get around and find your way around. I personally have had struggles where I’m going, "Where is this? I’ve seen this before on this page and it is there."

David: There is lots of content and there are lots of references to external projects and examples and articles and all different things. So there’s lots out there. But I think the documentation just needs a little bit of improvement and things. That’s not directed at Zach because it’s an open source project. The documentation is there for everybody to contribute to, myself included.

David: Everybody can improve that over time, especially with a community like that, I could see that documentation really shining. But I would say, it’s there. All the documentation is there for you to use, but it does require a little bit of navigating.

Drew: I think that it’s a fairly common problem as never documentation that everybody thinks in different ways and would expect to find things in different ways. So it’s almost impossible to structure a set of documentation that’s going to be perfect for everyone. You have to choose which shape it’s going to be. I hope it will work well from most of the people and will be acceptable to those who look at the problem in the other way.

David: Definitely.

Drew: Is there a sort of an ideal project that would be suited to Eleventy, like down to the ground? If somebody came to you and said, "I’ve got this type of project," and you think, "Yes, Eleventy is the solution for that." What is that type of project?

David: I think one of the best types of projects for Eleventy is a front of house website. A front of house website would be the... A lot of people call it like the .com, the site that people go to, to find out about a company or a product or something like that. The contract example would be the contact page, about us page, and home page and all the classics.

David: But definitely a front of house website, possibly the documentation and the blog, as well as you grow that site, Eleventy will grow with that. You can add your blog being sourced from wherever. You can have your documentation, again, being sourced from somewhere else. I’m about to do a few projects that are with Eleventy and using it on front of house sites, but I think it’s a really ideal use for it.

David: That is to say, it’s not that it can’t do those other things. You could do a PWA, like an entire application, whether if you want to. But for me, like that front of house websites, like promotional sites that show people, companies like services, and you do like a nice pricing page and stuff like that, you can source all that content there. I think that those types of sites are really good candidates for Eleventy.

Drew: What would be the best way of somebody to get started with Eleventy? What should they do if they think it sounds good? Where do they go?

David: I guess they would go to Eleventy, whichever way it’s spelled, 11ty.dev. I would definitely go there and check that out. I would also hit up a few articles. I know that there is Eleventy From Scratch by Andy Bell. That is a good content source. That’s a premium course for you to learn Eleventy.

David: I would also check out, I think there’s a few others. I need to strike them out. Can we put those in the show notes or something that would be-

Drew: Yes, definitely. Yeah.

David: I’ll find the ones that I’ve been looking at.

Drew: Fantastic. You mentioned that you’ve got some projects coming up that you’d be using Eleventy. You’ve recently gone freelance, haven’t you? What projects and work are you hoping to take on?

David: Is this my opportunity to plug?

Drew: It is.

David: Thank you, Drew. Thank you. So yes, I have recently become full freelance and my intentions are to work on frontend development and documentation and content, as well as a piece of design. I do have some design background. Some, I have a degree, but what do degrees mean now? So yes, it’s a myriad of those three areas.

David: I do quite a lot of front end development with Eleventy and Jekyll and I’ve done a fair bit of WordPress and things like that. Lots of different front end projects, and I will stretch to the full stack characteristics if needs be, as a lot of devs end up doing under there, whether they want to or not.

David: I do that and I do documentation for content. So content for documentation, I should say, quite a loving experience with different site builders and building out the documentation for that.

David: I’ve also done a lot of articles for various different platforms. I’ve written for Touch Plus and I’ve written for Siteleaf, which is another headless CMS for Jekyll. That’s a pretty good CMS. I have actually, in the past, done some video courses. It’s been been a little while. It’s the origin of this microphone is doing a few video to video courses and stuff like that, which is really cool. That kind of stuff that’s what I’m trying to do.

Drew: That’s great. Exciting times. I’ve been learning all about Eleventy. What have you been learning about lately, Dave?

David: Oh, well, I’ll be honest. I’ve been learning a bit of Eleventy as well. I’m not there yet. Like I said, I’m not the fountain of knowledge on it. But it’s great to just jump into... I’m working with Eleventy and I find something that I want to know more about and I jump into the docks. It’s interesting how many little tips and tricks are in there. I really enjoy that.

David: I’ve been learning. Yeah, I’ve been trying to get my head around Hugo is the template in language, quite different, but it’s quite cool. It’s quite cool. I like it and I want to learn more of that. I’ve also been doing a bit more about build plugins for Netlify. I did a build plugin, which means that you can add stuff into the build process on Netlify as platform. That’s quite cool. I’ve been learning a bit more of that.

David: I’ve been learning a bit more node and well, I guess I’ve been learning how to make coffee as well. I’m a bit coffee obsessed. So in my spare time, I try and learn how the best way to do it. Then I sip it and I go, "Hmm, that tastes like coffee. I must have done it right." I’m quite proud of myself because I’ve got to the step where I don’t need to add sugar to my own coffee. So it tastes okay. Before I was doing it so badly I had add sugar to mask the bad bits.

Drew: Amazing. If you, dear listener, would like to hear more from Dave, you can find him on Twitter, where he’s @daviddarnes and his personal website. You can see his work and hire him to work on your projects. It’s at D-A-R-N.es. Thanks for joining us today, Dave. Do you have any parting words?

David: All I say is, thank you Drew for inviting me onto the show and please feel free to tweet me about all sorts of stuff. Please, correct me if I said anything wrong. I love to learn. Thank you.

Smashing Podcast Episode 27 With Stefan Baumgartner: What Is TypeScript?

We’re talking about TypeScript. What is it, and how can it help us write better JavaScript? I spoke to expert Stefan Baumgartner to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a web developer and web lover based in Linz, Austria. Currently working at web performance company Dynatrace, he writes, speaks and organizes events all about software development and web technologies. Lately he’s the author of the book TypeScript in 50 Lessons, published this autumn by Smashing. So we know he’s an expert in TypeScript, but did you know he can juggle up to eight fiery weasels whilst blindfolded on a unicycle? My Smashing friends, please welcome Stefan Baumgartner. Hi, Stefan. How are you?

Stefan Baumgartner: Hi. I’m smashing. I didn’t that about me, so that’s very interesting.

Drew: It’s amazing what people find out about themselves on this podcast.

Stefan: Absolutely.

Drew: So, I wanted to talk to you today about TypeScript.

Stefan: Yes.

Drew: It’s the subject of your new book, so clearly it’s something you’ve spent a lot of time getting to really know in depth.

Stefan: Yes, absolutely.

Drew: For those who have not used TypeScript before, so might not be familiar with what it is, how would you describe TypeScript, and what problem is it actually solving for us?

Stefan: It’s a very good question. So, there are many ways of approaching TypeScript and one way that I like most, and also the way that I like to describe in my book, is as a tooling layer on top of JavaScript. JavaScript is a wonderful language, but it has its quirks. There’s some parts that can have multiple meanings. You have dynamic typing, which means that while you can have different types like number or string or an object based on the position where they are in your code, and there’s lots of implicit knowledge when you work, especially with the technologies or with Node.js, That you have to know about some interfaces that you use from APIs, function signatures, etc.

Stefan: And TypeScript tries to give you a type system around all that, to give you this information. So, it tries to figure out which types you set when assigning variable. It tells you which function signatures expect which well use at which position, and which return objects that you get that you can then access and modify and work with.

Stefan: And this was, back in the day when TypeScript was created, that’s now about 80 years ago, the prime goal of the TypeScript team to create this tooling layer, in form of an additional language. So, to take all the risk from JavaScript and then on top they create their own kind of meta language that allows you to define types for your functions, your objects, whatever there is. And this also means that every JavaScript code is TypeScript code, which also means that you can get started right away. If you know JavaScript, you’re basically a TypeScript developer as well. And you just take what you need to get more and more information about your code.

Drew: So, TypeScript is almost like imposing a sort of bunch of more strict rules about how we write JavaScript in order to make code more reliable? Is that...

Stefan: Yes, yes, this is exactly what it is. So, the strictness is totally up to you. So you can tell TypeScript how strict you want to have it. But their goal is to catch as much errors, or as much possible errors, that there can be. Like oh well this value could be null, so better do a check if this value you exists or it can be undefined. Or, at this position I don’t exactly know if it’s a string or a number so check if it’s type of string, check if it’s type of number.

Stefan: So TypeScript knows more, or can give you more information about the class of failures that you’re dealing with. And right now, the main goals of TypeScript are to catch as many errors as there are. So they spent a lot of time in providing more tools for you to declare your types and to declare the strict rules for you to figure out if there’s any error in your code that you might have a problem with in the long run.

Drew: So, I mean, really to get back to basics when we talk about types in a programing language, which obviously TypeScript is all about types, we have strictly type languages and weakly type languages and JavaScript is weakly typed, isn’t it? What do we actually mean when we say something is weakly typed?

Stefan: There’s weakly typed, and another word for that is also dynamically typed, which means that you don’t always have to know which type your variables or your constants have. So, the moment you assign a variable, let’s say var fu or let fu with a number once you forget something, the cross-credentials say fu is now of type number, it’s a number and I can’t do number operations on top of it, like addition, multiplication, subtractions and all those kinds of things. If you assign it a string then it’s a string.

Stefan: And, in JavaScript, you have the possibility to override it with the value of an entirely different class, entirely different type. So, you can, say at one point in time it’s 1, 2, 3, 4, at another point in time it’s a string like, "Hello world, Stefan," or "fussy cat" or something like that. And this can cause for couple of errors because what if you expect your variable fu at some point in time to be a string and then you do string operation on top of it like two uppercase, two lowercase. Or if you expect a number and you want to edit to something, then you could do result, which you don’t expect.

Stefan: And, with TypeScript, you can explicitly set the types or you can tell TypeScript to infer a type from an assignment. So the moment you assign one to free, TypeScript knows, Hey, this is number, and throughout your whole code, throughout every user through, it will think it’s a number and it will tell you if you do something that is not allowed with numbers. So, yeah. And this is the difference between a statically or strongly typed language, where you say, okay, once it has the type it has to be of the type and the type can’t change afterwards. In the weakly or dynamically typed language where the type just depends on where you are in your code and it can change, especially at run times or during the execution of the code, which can cause a ton of problems if you don’t pay attention.

Drew: So, yes, there’s that whole class of error, isn’t there, where you, as a developer, think that a variable contains a certain type of value and actually when it comes to that point in the code and that’s executed, for whatever reason it’s something different. And TypeScript is adding that enforcement of types on top of JavaScript to sort of give us that extra level of checks and reliability to it, to get rid of that type of bug.

Stefan: Exactly. The best example is for, for example, at the string two, with the number two, and you get 22 as a string, at the number two vice-versa and you get the number four. So, it’s apparently the same operation, but just if you swap the number in the string you get two totally different results. And TypeScript pays attention that it don’t have errors like that. And the one biggest rule that it sets like, so once you do an assignment, it has to be of that type, and the type can’t change.

Drew: So, TypeScript doesn’t actually get run by the browser, does it? Or by node or whatever run time you’re using, it presumably gets compiled down somehow to JavaScript?

Stefan: Yes. So you, there are two ways of working with TypeScript. One way is just exactly what you said, you write the TypeScript code, especially with this typing meta language that you use, and then you have a compile step where TypeScript erases all the types and spits out regular JavaScript code. And TypeScript is also transpiled so you can, say if you write more than the JavaScript, you can compile it down to something that I-11, if you have to support it, can work with. That’s one way.

Stefan: The other way is, and this is an interesting way which I like a lot and which people are using actually, you write regular JavaScript and then you add type declarations in a separate file, and refer to it by adding JSDoc comments in your code. And TypeScript can read this comment information, this documentation information, maps it to the types you created in separate file, and can give you the same tooling, the same information that you would get if you write in this transpiled, compiled way.

Drew: Okay, so then, that way you just keep your standard JavaScript, but the tooling that you’re using around it knows to reference the sort of side car file that has all the definitions of what the types are.

Stefan: Exactly.

Drew: Type checking is one thing, but surely that’s the sort of thing we can, we don’t need a new language to do. That sort of analysis we could just have running in a code editor in a VS Code or whatever for example. Does TypeScript add things that take us beyond just what you could do in a code editor?

Stefan: The biggest advantage that you get is actually from code editors. One funny thing is that if you work with Virtual Studio Code and you write regular JavaScript, what you’re really doing is writing TypeScript because Virtual Studio Code has built in TypeScript a checker and analyser that gives you, that tries to figure out as much information as possible and gives this information back to the editor and has a close relationship to the editor into TypeScript. In particular, especially since you mentioned VS Code. VS code was their first project to work with TypeScript. Back in the day, where it was called Strada or Project Strada, where all the developers figured out how to actually create a language like that.

Stefan: So, editors and language are very, very much connected and you get the best benefit if you’re working with modern day editor. And thanks to the TypeScript team this doesn’t have to be VS Code. It can be basically any editor. So the proactive blankets for almost any editor out there that supports a so-called language protocol. There also getting it for all the other programming language, feedback and editor feedback, and analyzing information.

Stefan: So, yeah. This is actually the main use-case for that. And, of course, if you have bigger projects and you used to compile stepped version of TypeScript, having some sort of continuous integration, continuous delivery, where you constantly check if your project makes sense, you’re creating bundles that you should begin, this is also a part of TypeScript plays a huge role because with every commit to a GitHub repo or something you can do type checks and see if there might be an error slipped in that should be taken care of.

Drew: So, I guess there’s a level that your code editor can do automatically. Like you said that Visual Studio Code does by just analyzing it as your writing JavaScript, but then when you’re using these, when you’re declaring types specifically or adding these JSDoc comments that’s what takes it a step beyond that. That’s where you’re actually, it’s defined as more of a language on top of JavaScript.

Stefan: Yep. The cool thing is TypeScript is, in the way it’s designed, that it tries to get as much information out of your JavaScript as possible without you doing anything. So, if it sees a number in the wild it knows that this type is going to be number. Or if you have a function signature and you say you have a default value like the way you add a tax to a price and you see it as standard way you add a tax is 0.2. So if you add this in the function signature TypeScript already knows at this point I expect you to pass number and not something else.

Stefan: Also, if you return an object or if you write a JavaScript class, TypeScript can figure out what the well use are, what the types of your fields should be. And this works for actually quite a lot of use cases. So you have lots of scenarios where this is totally sufficient and you don’t need anything else. But when you do, this is now your part to strengthen TypeScript with additional type information that you provide. So, let’s say you want to create a type article which should have a number, a description, a price. You have different types for that. And then you create a compound or object type and once you declare this type and you know that your object should be of this type, TypeScript knows which values and which fields to expect.

Stefan: And one thing that’s particularly interesting here is that TypeScript is one of the few and certainly the most popular type system that works with structural typing, which means that as long as the shape properties and types of those properties is the same as the object that you pass along or the object that you get from somebody else, it will say it’s okay. You don’t have to have the exact name, it just needs to have the exact structure. So if you have a type called book which happens to have name, description, and price and you have a type called video which happens to have name, description, and price, those types are compatible with each other.

Drew: Okay, so that means we can sort of define customer types that make sense in terms of the project and the objects that our project is trying to model and then use TypeScript to enforce the shape of those.

Stefan: Yep.

Drew: So if we’ve got a product that has a price property that’s an integer in sense or what have you, then TypeScript will enforce that for us and if we pass in something that’s not a product or doesn’t have a price or whatever, that’s when we start getting our errors. Can you then go sort of step beyond that if you had like a cart type that had an array of products inside it? Can you enforce all the way that level?

Stefan: Yep. Yeah, exactly. You can enforce that as well. There you enter also a class of types which is already goes into very advanced topics which is generic types. So, the array type is a generic type. It tells you an array has certain interest so you can index them. It has a certain properties like length or map or for each, but the well use inside this array are defined by a so called generic. So you can say you have an array of number, you have an array of string, you have an array of articles.

Stefan: And then if you do array.map then you get, inside this map function, you get the type again like a string, number, article, whatever you pass along. And with generics you can do a lot of things. So this is where the type system really tries to make sense out of all the possible cases people encounter in JavaScript frameworks. So you have, especially in JavaScript you have so many functions that can mean so much. Like, okay the first argument is now a string, the second argument has to be an object, or if the first argument is a number, the second argument has to be a string. You’ve seen that in the wild in countless, countless libraries that you use.

Stefan: And, for this kind of scenario TypeScript also has structures in generic types and conditional types where you can have checks if this is one class of types do this, if this is another class of types do that, which really tries to figure out most of the scenarios that you find in day to day JavaScript code.

Stefan: So, and this is actually where the fun starts. The thing like creating object types, creating regular types like number, string, etc., or creating function types that’s one thing. But if you try to model a very complex behavior just within the type system, this can get very, how do I say it, mind boggling. Yeah, I guess mind boggling is the right word. This can be very mind boggling, but also a lot of fun.

Stefan: And this is where I kind of got my, found my call to work more with TypeScript because I just found out that I could do so many that I see in, not only in my code but in the code for my colleagues and code that I find online, to make more sense out of it and to be prepared for future scenarios. So, I mostly write types in TypeScript because I know that at some point in time I have to revisit code and I want to know what I’ve been thinking back when I originally wrote it.

Drew: Where is in your project that you would define these types? Because presumably you want them to be reusable all around your project. Where do you define them?

Stefan: So, I usually define them very close to the code that I actually write. So, when I write TypeScript I write in TypeScript first. So I transpile, I usually have a compile slip anyway of, maybe because I’m doing React and I need to transpile JSX, or because the project is so big that I want to do extra checks. So there’s a built chain anyway. Either I need to bundle or I need to transpile, so I’m writing regular TypeScript, not JavaScript with this JSDoc extensions. And there I try to keep the types very close to the objects that I declare.

Stefan: If there’s a type that is used throughout the whole project, I’m not only expecting the type, but also the objects or the functions for that objects. So this is some way of splitting and moving files and types around. There’s a very rare case where I also have one of those global type finishing files next to me, which is if my app has to deal with something that’s in the environment where I run it, be it either node or browser or whatever, where some global ideas or global concepts are that I want to carry in my program and hold. And this is actually a pretty standard set up.

Stefan: So you have your TypeScript files on one side, you have couple of type definition files on the other side, and then TypeScript tries to figure out everything, if it makes sense and if it’s possible to do and hopefully that’s the case.

Drew: Yes, I think we’re all very sort of used to having a build step, combilation step, in our work flows these days, aren’t we? With whether it’s running Babble or dealing with JSX and React or Web Pack and what have you so...

Stefan: Absolutely.

Drew: I guess adding TypeScript into there is just another small step in the process and quite easy to do.

Stefan: Yeah. So it’s, on one side TypeScript is a great extension, especially if you have a Babble set up running. So they provide an interface where you can do TypeScript type checks, even though your whole application is transpiled with Babble. TypeScript also has a lot of tools so it can be the only transpiler that you need. So it can transpile JSX, it can transpile down to Equiscript 5, Equiscript 3. The only thing that it doesn’t do anymore is bundling. So if you want to have bundled up application you need to take another tool like Roll Up or Web Pack or whatnot.

Drew: One of the features that I liked in newer versions of PHP, back when I was writing a lot of PHP, they brought in the ability to declare the types of each argument that a function was expecting. TypeScript does the same thing, right? You can say the first argument should be a number, the second argument should be a string-

Stefan: Yes.

Drew: ... and then the tool sets going to catch that if you try and pass the wrong thing in.

Stefan: Exactly.

Drew: In a lot of sort of real world cases I find that I have function arguments or variables that would be of a given type, but there might also be null. Is that something that TypeScript allows for?

Stefan: Yep, yep. So, this is where you enter the wonderful world of Union types and this is the big chapter in my book in the middle where we go from beginner concepts to advanced concepts. Where we realize that you don’t, not only have different classed of types like numbers, string, or several object types, but you can combine them. So you can say, this argument can be of type of string, of type number, or of type null or of type undefined, or for some object type. And with that your arguments, especially function arguments become much, much more varied.

Stefan: So if you can for one thing say, if this function argument does not have null in its unit type, then you’re not allowed to pass null. And you can make sure that inside this function, this way you is never null. If it can happen that it’s null, you add pipe to pipe operator null to it, and suddenly you have to check if it’s null or if it isn’t. Which makes it very, very interesting. So, especially the case of null checks and having undefined values. This is something that you happened to have in TypeScript all the time, or in JavaScript all the time.

Stefan: And with this one little addition, like make sure you check for your null-ish values and if you don’t allow null-ish values they can’t be null. This erases a whole clause of errors that you would otherwise encounter. And this is also one lesson in my book where I just talk about this one compile of next trick null checks and what it means for your work and what you suddenly have to do. And at some point you realize, okay it’s much more tedious to add pipe null to every possible case where it could be null, instead of just for one time in one place of your code, check if it’s actually null and then just continue with what you did. So, that’s a very nice way of working with null and undefined values.

Drew: A lot of sort of more formal languages, OO type languages, have classes and give you the ability to define a class interface to be able to say if it’s a class that uses this interface it needs to have these methods, it needs to behave like this. Is that something that TypeScript gives us?

Stefan: Yeah, absolutely. So this is very much related to the history of TypeScript. TypeScript, when it got first released, you know it was eight years ago we weren’t talking about Equiscript 6 there, we weren’t talking about native Equiscript classes, we spoke mostly about objects and functions. There was no modern system so it was a very different type of JavaScript eight years ago than we have today. And eight years ago, the TypeScript team introduced lot of features from other program languages like Java, C#, like classes, interfaces, extra classes, name spaces, to create some sort of structural or structured programming tools that make it possible for you to lay out your code entirely different than you’re used to.

Stefan: But over the years, lots of those concepts found there way into JavaScript, especially classes. So, they had to revisit lots of that concepts again and made it much, much more aligned to the way JavaScript is right now. So you still have classes, you still have interfaces, but TypeScript classes are just the same JavaScript classes. And TypeScript interfaces are like compound type or composite types where you have just list of properties. They can be function properties or string properties or mass object properties, and interfaces and type declarations are, in the most parts, just the same.

Stefan: You also can implement, you know the implements keep it exist, you can implement an interface, you can implement a type. There are, just in some rare cases, effective to some rare cases there are totally the same. So, yes they exist, but they mean something different than your used to from other programming languages. And this is also something where I’d say people who come from other programming languages have to look out for things like that because they can be false friends. Where you, they think, Okay, oh this just works just like in Java or this works just like NC Sharp, where in turn it’s just borrowed language or it’s just the same names for concepts that are nuanced and somewhat different than to what you would expect.

Drew: It can be a real sort of mental hurdle to jump over, isn’t it?

Stefan: Absolutely.

Drew: If you’re familiar with a name meaning one sort of thing and now it means something else.

Stefan: Yep.

Drew: It can be quite difficult to reset how you think about those things. So, it sounds like TypeScript has some sort of really advanced features that help us who are working really hard in JavaScript all day. Is it just for us super nerds or can people who less familiar with JavaScript, is it useful for the more, the beginner or the intermediate as well?

Stefan: Yeah, I’d say both. So one of the nice things about TypeScript is it’s creditable. So you just use as much of TypeScript as you want to use. So if you learn JavaScript, you get some additional tooling that gently tells you, Hey, there might be some properties that you want to select. Like if you call document .queries elect it already tells you, no queries elect exists and it gives you some hint on what to expect as an argument without throwing a single error and without you needing to do anything with those red streak lines that you get in your editor.

Stefan: And for that already TypeScript can do a lot of things. So this basic tool aspect of it can help beginners just as much as people who are more familiar with JavaScript and then have been in JavaScript for a very, very long time. But as you progress you can buy into more and more and more concepts as long as it’s reasonable for you to do. So I’m always a strong proponent of not having to use every feature a programing language gives you, but just the features that you actually need and TypeScript is perfect for that because it has a ton of features from the history that we spoke about where it tried to introduce concepts that haven’t been in JavaScript. And now from all those concepts that try to make the most sense out of all the JavaScript code that there is outside, you can take whatever you need and whatever you like from that.

Stefan: And this is, I guess, what makes TypeScript so special. When I started working with TypeScript, like seriously working working with TypeScript, the things that it most was like having a react component and being super happy that if I press control space that I get all the name of the properties my function component would expect. So this alone helped me a lot and it did nothing else but using this feature for a very, very, very long time. And then I started, in some sort of library code that I created for my colleagues or for people who I work with, creating a type core set around my function so people who use my code know better what I meant when I wrote those particular functions. And there I go all in. I’m very deep, deep down the type system rabbit hole.

Drew: Yeah, I mean that’s interesting. In the last episode of this podcast I talked to Natalia from Vue JS all about Vue 3 and one of the big changes they’d made in Vue 3 was that it was rewritten using TypeScript. How important is it for libraries and frameworks to adopt TypeScript? What benefit is that actually providing those who are working with the library and not on the library code itself?

Stefan: So, I think for one part you get a lot of implicit documentation. Especially if you import Vue or React, React is kind of a mixed bag, but if you import Vue or Preact for that matter, Preact is also written in TypeScript. People who use your framework immediately have some information about all the functions and all the objects that they get without you needing to look up anything and you get some extra checks if what you’re doing is the right thing to do.

Stefan: So that’s a lot of implicit documentation for all the users of those libraries that you get, basically for free, if you start writing in TypeScript anyway. So every project that is written in TypeScript gets, produces all this extra information for free. I guess as a team, as a library author, it makes contributions a lot, lot easier for the same documenting reasons. It also makes checks a lot easier because there’s a whole class of errors that you can catch in the type system that you, that would take ages to catch in tests. That’s why nobody writes test for that, especially if this is of a certain type, kind of tests.

Stefan: And yeah, and then you of course get all the benefits that you would get if you used TypeScript in any other project are catching errors before they happen. And one thing that I have to mention here is, especially Preact because Preact tries to do the kind of thing that write JavaScript code, and add additional types on the side, which gives them a low barrier of entry for people who want to contribute because they don’t have to figure out how the type system works or how type script works because they’re just like JavaScript code. But they, as library authors, get the additional benefits of having type checks, of seeing if this works the way it is intended, and I think this is for lots of projects. Especially Open Source projects really the best way to go.So, I strongly advocate for the idea of having JavaScript types on the sides because it can help people so, so much for basically not a lot of investment on your part.

Drew: Increasingly, we’re seeing sort of whole organizations moving to JavaScript as their sort of language of choice, both in the front end where it’s an obvious choice, but in the back end of their products and systems. Would you consider TypeScript something that sort of larger teams and larger organizations would really benefit from? More than individuals?

Stefan: So, I’m currently in the same transition. So we have lots of Java NC Plus developers who are going to write a lot of JavaScript in the future and you know what, TypeScript can be some sort of guide for those carry areas of new program languages. JavaScript has a lot of quirks, a lot of history and a lot of prejudices if you come from a different programing language. So TypeScript can be a guide because there’s some concepts that you’re familiar with it in the type system.

Stefan: But also, I think, especially when you have lots of people working in the same hole base or lots of people who need to work with each other, this can be an additional layer of guidance in your project where you don’t have any bad surprises in the end. So, of course technology doesn’t solve any communication problems. This is not what TypeScript is intended for, but it can lower, it can make lot more room for the right discussion then, if you don’t have to talk about what do you expect from me in your code, but rather what should your code do or what should your library do.

Stefan: And, I always say that if you ever write code for other people or if you write code with lots of people or if you just write code for yourself, you have to revisit the next day, consider TypeScript because it might help you in the long run. And this is not just an investment for the next project of next week, but more for one who say, Okay, especially if long lasting projects for month, two, or years. Definitely offer that. You’re never going to know what you’ve been thinking of when you wrote the little piece of code one year ago, but types can give you a hint of what you meant.

Drew: One thing I think that stopped me looking too closely at TypeScript in the past is I sort of remember things like Coffee Script that were a sort of new Syntacs that sort of transpired down and I kind of thought that TypeScript was another one of those, but it’s really not, is it? It’s plain JavaScript with some extra things layered on top.

Stefan: Yeah, so this is something that the team also strengths a lot. It’s fundamentally not a new language. So, it could look like that if you look at examples from 80 years ago, this was also part, just like you too. I was avoiding for such long time, firstly because of Coffee Script, second because of tons of JavaScript developers telling me that this is Java 4 or this is JavaScript for child developers, like and now finally get all those tools that I know from years and years of writing Java and I don’t want to change the ways I write, I just want to have the same tools but drawing in a different environment and this scared me and I didn’t want to have to do anything with it. And it took me, I guess about six years or so until I tried it again.

Stefan: Especially after watching some videos of TypeScript’s creator Anders Hejlsberg who spoke exclusively about the tooling aspects and about this is JavaScript. So, I met him twice in Seattle and when he went into interview sessions where we all were, he said from himself that he was writing JavaScript for the better part of the last decade. And if the creator of TypeScript has this idea that he’s writing JavaScript, perhaps you know with this extra type annotations, this takes the whole language and the whole tool into totally different light.

Stefan: And that’s why they’re stretching the fact so much that everything that you have, especially if it’s a new language feature, this is JavaScript. So they are very closely aligned to the ECMAScript standard. They are also championing a couple of proposals in the ECMAScript standard. They are involved, they know what’s happening, and if there’s a new feature that reaches a certain stage, they’re adopting it in TypeScript, but they’re not creating any new language features on their own.

Stefan: Where they innovate is in the type system. And you can really separate the type system from the actual JavaScript code. Of course there’s some mingling of JavaScript code and types group, especially when you do type annotations, but other than that it’s JavaScript with benefits. And those benefits are what makes it worth in my opinion.

Drew: And I guess we could go through all sorts of those benefits, all sorts of features that are in TypeScript, we could go through them blow by blow, but it doesn’t necessarily make sense to do that in a podcast. It’s difficult to describe code, isn’t it?

Stefan: Oh, you an write an entire book about that.

Drew: Are there any particular features of TypeScript that you’re most excited about or think provide the most value to users?

Stefan: I guess one of the features from the type system that I like most, which is again advanced but not super advanced so that it’s easily graspable, are union and section types. Where you can say, Okay, this argument or this variable can be not only of this type, but also of another type. Or it needs to have features from this type and this other type. And if you, once you realize that you can make use of that, you suddenly can model your application a lot, lot better.

Stefan: So, I adopted a work for where I tried to think about the object and the functions that I have, like what do they expect, what is the data, how are the properties designed. And then I tried to work with them as much within functions and if you use an intersection types you can, you have so many tools of modeling your data that if you spend a little time doing that you catch a ton of errors and a ton of problems up front without spending too much time into, in TypeScript land.

Stefan: And that’s why I guess they would be my most favorite feature. And also the fact that TypeScript transpires everything. I don’t need any Babble or any other transpile and I’m pretty tired of having too many tools that I need to use. So if I just can rely on one tool and maybe another one for bundling, that takes a lot of noise off my mind. So, that’s what I’m also very thankful for. It can just do a lot.

Drew: You’ve written about what it can do in a new book for Smashing. Loads of great information for people who are wanting to learn TypeScript. So, what sort of developer is the book aimed at?

Stefan: Yeah, so if you read TypeScript in 50 Lessons, we assume that you are already a JavaScript developer. You don’t have to be a seasoned JavaScript developer, so just enough that you, you’ve written application with it, you know some quirks, you know what an object is, you know what an error is, you know what a function is, you know what an assignment is. So stuff like that.

Stefan: And we take you from there, from just enough JavaScript that you know how to be dangerous, and guide you through the TypeScript layer. So, you could write books about TypeScript that you just speak about every feature that there is and explain just a little and let the reader figure out whatever to do with it, and we take a total different approach. We focus on one particular part, which is the type system, we leave out a lot of other things that, they are, neither the team nor seasoned TypeScript developers would recommend that you do, and focus just on the part that is long lasting.

Stefan: So, this was one thing that I really cared about when writing this book that once it’s out it should have some relevance in years to come. Especially with TypeScript getting four releases a year, you never know all the features and you can’t express all the features. But you can express, or explain, how the type system works. And from that on you figure out the things on your own. And this is what we do, so we give a very in depth introduction into the type system.

Stefan: First, in the first four chapters we guide you to the point where Okay, yeah, you know how to assign types, now you know how to work with types. Then there’s this water sheds chapter where we go into unit intersection types and from then on you learn about type modeling and about moving into types system. And after you read the last few chapters, we had seven chapters in total, you should know everything, to be prepared for every single TypeScript that there is. And for every new class of types they introduce and for every new class of errors they try to solve.

Stefan: And it took me quite a while to write this book to be honest, so me knowing that it didn’t have to change the table of contents and it didn’t have to introduce any new concepts over the last 1 1/2 years to me is proof enough that we succeeded in that. So, maybe we snuck in one or two features from TypeScript 4.0 but not all. So all the learnings that you have are still well it even though we, I designed them 1 1/2 years ago. So, yeah this is the main goal of the book. And it’s kind of what we see in the tag line. We want to take you from a beginner to an expert. And I hope we succeed with that. Yeah.

Drew: I certainly found reading the book though because it is broken down in, you know it’s 50 lessons so it’s all in sort of fairly bite size chunks, and I found that I was able to start using all of that straight away. You’d read about something and then you could start using it. It’s not one of those books where you have to make it all the way through to the end before you can start being productive.

Stefan: Yeah. Yep. Absolutely.

Drew: Very easy to just sort of drop in and drop out of which with many of us being so busy and under so much pressure in our jobs and things at the moment, it’s great just to be able to read a little bit and then forget about it for a while and then come back and read a bit more.

Stefan: Yep. This is also something that we take a lot of care, that we really cared about to achieve. It can be really overwhelming to learn a new language. Especially a new programming language. And so those bite sized chunks, you know you just spend about five or maybe ten minutes with one of those lessons. And you can immediately apply the learnings of those lessons to some actual code and we provide you with all the code examples online. So if you go to TypeScript-Book.com you see a list of all the code examples that there are.

Stefan: And this helps you just getting in as much as you need and as much as you like and it gives you also a lot of room to breathe and to take a break and to get your mind off of it and then revisit back later. This is also by the edit some interludes in between chapters which are mostly non-technical. They give you little bit of TypeScript culture, little bit of ideas how the TypeScript team thinks, how the community thinks, and how writing good TypeScript code because you without actually focusing on the coding aspect. And we also added those to give you a little break, a little room to breathe, to digest what you just learned because we know that this can be a lot of stuff. And, yeah, so if you just take one lesson a day, you are through with it in 50 days and are an expert in TypeScript, so.

Drew: I often find that when I’m writing about something I’ve been putting together a presentation or an article or something like that, I find that I learn new things that I didn’t appreciate before because having to explain something, you have to make sure you really understand all the details. Was there anything that you found about TypeScript in writing the book that you realized you were learning for the first time?

Stefan: Yes. There were two kind of things that I learned while writing the book that really surprised me. And one thing is how the type definitions TypeScript brings along are structured and created and declared. So they have written a parcel that goes over all the web standards on top of your 3C and there’s this web interface definition language which is it’s own language created by W3C to declare JavaScript interfaces and to take this code slip, it’s refracted them into TypeScript types. And then have some way of structuring them to be ready from ECMAScript 5 standards up to ECMAScript 2020, 2021 standards and if you browse through those alter generated file and read how good they are and how well documented they are and how the structure types that you can learn a lot.

Stefan: So this was one thing there. I kind of lost track at some point while writing it because it was just spending two or three days within, in those lib.d.ts files and soaking up everything that they created. I even have one lesson dedicated to lib.d.ts because it was so, so surprising. And the other thing is, I guess, realizing how generics and conditional types really work under the hood.

Stefan: Because when you apply them and you work with them you just use them as much so you get the right results, but you never question what’s actually making them work and by explaining them in chapters five and six in my book I really found out there are very delicate mechanics underneath and if you understand those mechanics it gets a lot, lot easier creating conditional types, creating generic types, than it would be without just by trying to figure out things. That’s why I also have some flows of code in my book where we start with the conditional type that you write and then we go step by step evaluating what it means until we get to the result type.

Stefan: And this is something where I found some joy in it because it really made me understand what my book should be actually about. That I spend a lot of time and cared a lot about getting those examples right, so. I hope readers will find the same joy out of it because it can be very, very interesting. And, yeah, it gets a little bit nerdy, but that’s part of the fun.

Drew: For anyone wanting to actually get started with JavaScript it sounds like your book is a really great place to begin. Are there any other resources that you’d recommend?

Stefan: So, one thing that I also mention very early in the book is the TypeScript Playground. So, TypeScript offers an interactive editor online with lots and lots and lots of examples to give you good feeling of how it is to work with TypeScript, how TypeScript in the JavaScript only scenario looks like and works like or which language features there and what they mean for your types and especially in the recent year, the TypeScript team hired a person, Orta, just to work on documentation and Playground and website and all those learning resources. And you can see that the process immensely.

Stefan: So, he spend so much time into refactoring every bit and piece of the whole website that it’s now a great learning resource and Otta also, has also written the forward to my book and were chatting about how a book on TypeScript can or should be different compared to what they provide as a learning resource. And I think they work really well together. The book gives you a very tailored and opinionated view and the learning resource that guides you step by step whereas the handbook is this big knowledge base where you get all the additional information and can dig deep into one specific scenario that wouldn’t have enough room in a book.

Drew: Stefan’s book TypeScript in 50 Lessons is available digitally from Smashing right now and it’ll be available in print from November 2020. You can find it at TypeScript-Book.com. So, I’ve been learning all about TypeScript. What have you been learning about lately Stefan?

Stefan: I’m digging into different programing languages again. I’ve been learning a little bit of Go and a little bit of Thrust and what scenarios there are for using them and it’s fun learning something entirely new. It gives you a new perspective on what you already learned so far. So, this is what I enjoy a lot at the moment.

Drew: It’s always exciting, isn’t it? Learning a new language and getting a new perspective on how other languages are structured.

Stefan: Absolutely.

Drew: If you, dear listener, would like to hear more from Stefan, you can follow him on Twitter where he’s DDPRRT and you can find his personal site at fetblog.edu. TypeScript in 50 Lessons is available now from Smashing and you can read all about it at TypeScript-Book.com. Thanks for joining us today, Stefan. Do you have any parting words?

Stefan: Thank you very much. No, well, DDPRRT is the worst Twitter handle in the entire world and if you say it very fast it’s dead parrot, and if you know Monty Python, you might know about the dead parrot. So, that’s all I can say about the worst twitter handle that there is.

Drew: He’s pining for the fjords.

Stefan: Yeah. But, seriously, I hope people enjoy working with TypeScript. I hope they enjoy my book. I’m really, really excited about feedback, so if you have any feedback hit me up on Twitter. I’m here to chat with you about all that stuff. And I’m also very happy to work with you on type programs. If you have something that you can’t quite make sense out of it just drop me a line or a Twitter direct message. I really take the time to see if we can solve the problem.

Smashing Podcast Episode 25 With Anthony Campolo: What Is RedwoodJS?

We’re talking about RedwoodJS. What exactly does it mean to be a full-stack Jamstack framework? I spoke to community champion Anthony Campolo to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: He’s a Lambda School student, studying full stack web development, as well as being a contributor to RedwoodJS. Something of a community champion, he’s recently written a 12 part article series called A First Look at RedwoodJS that helps to explain the origins and motivations of Redwood, along with many of the different concepts that the framework introduces. So, we know he’s an expert at RedwoodJS, but did you know he’s never seen a dog? My smashing friends, please welcome Anthony Campolo.

Drew: Hi, Anthony. How are you?

Anthony Campolo: Hello. I am smashing, thank you so much for having me.

Drew: I wanted to talk to you today, and it’s probably obvious from the introduction, about RedwoodJS. For those who haven't heard of RedwoodJS before, at a high level, what is it?

Anthony: I think there’s a couple ways that you can describe it depending on where people are coming from, but the canonical definition is it’s a full stack serverless framework for the Jamstack. So, it combines full stack web development with serverless AWS Lambda type stuff and the Jamstack, which is a big thing these days.

Drew: So, it’s a full stack framework that tries to put together a lot of the ideas around a Jamstack development ecosystem? Is that right?

Anthony: Yeah, it’s pushing the boundaries of what a Jamstack application can be, so by calling it full stack, Jamstack, it’s about how do we go beyond just the front end to having the same sort of deployment paradigm of just get pushed, getting your whole code deployed. How do we get that but also with our back end, and have it all connected?

Drew: Now, before we delve too deeply into it, I think it’s quite interesting to hear that it’s from quite a seasoned team, isn't it? The people behind Redwood, they’re not spring chickens. Not to say they’re old, but they’ve been around the block, haven't they, in terms of web development?

Anthony: They’re seasoned. Yes, I’ve actually put a decent amount of time into writing about the history of the framework and the ideas that have led to it, and Tom Preston-Werner is the creator, and so he’s also known as the creator of Jekyll, which is a really influential static site generator. He also did TOML, the configuration file language. And he was the CEO of GitHub originally. So, his work with Jekyll and GitHub pages and that sort of thing I think has really led to what we now think of as the Jamstack. A lot of people would say, "Oh, the Jamstack’s new. They’ve been doing this forever." That’s how we’ve been talking about how it’s an extension of these older ideas, the static site generations, but with GraphQL and serverless and these ideas of how to use glue code and APIs to make your app work.

Drew: So, this is definitely from people who are very embedded in that community? I mean, the CEO of GitHub, you really don't get more embedded in the sort of open source community than that. So, Redwood is a full stack framework and I guess that means you’ve got Redwood code running in the front end and in the back end. Is that right?

Anthony: Yeah, this is the first thing I like to explain to people when I’m showing them a Redwood project, is that it’s a monorepo. So, you have your front end and your backend in the same repo, and then each of those live in their own folders. You have a web folder, which is your front end, and it’s fairly similar to what you’d get from a Create React app. Then, you have API folder, which is your back end, and this is where all of your functions get essentially shoved into one big GraphQL handler that gets deployed to AWS Lambda through Netlify.

Drew: Okay, so starting at the front, as you mention, it’s based around React. Is that React plus a bunch of Redwood code, or is it just plain React? What’s the balance there?

Anthony: It’s a lot of things. It’s definitely just React in the sense of you’re not bringing in a lot of state management libraries, you’re not even bringing in a router actually. They have their own router that they wrote, and they use a lot of GraphQL stuff. So, when people talk about React and GraphQL and friends, that’s a bit of what’s going on here, is that it gives you a lot of default integrations to get React talking to your GraphQL. Because we have a lot of conventions now over how to use React, but the data fetching is still a huge hassle.

Drew: So, it’s React configured with a bunch of other tools that work nicely with React to give you a functioning ecosystem for doing this particular style of task. Is that a fair description?

Anthony: Yeah, no, yeah, that’s a great way to put it. The way Tom has put it is that there’s all these best of breed solutions that exist, and really sophisticated tools and technology we can use, but it’s really hard to actually leverage them because you have such a huge startup cost, and having to learn them, having to figure out how to integrate them. So, they put the tagline as, "We do your webpack config for you."

Drew: I think it’s a common pain point that you hear from lots of people when they’re trying to get started in the modern development framework with client side JavaScript apps and configuring web pack, configuring all the different things, the build processes, the build steps. It can be quite a minefield, can't it, to get everything hooked together and working? And it’s a long way before you get to "Hello, World!". So, Redwood is giving us all that preconfigured?

Anthony: Yeah, it’s very much a convention over configuration type idea, because you have... Tom was, like he built GitHub with Ruby on Rails and Rob, one of the other core contributors, he’s been a Rails developer forever. They have a lot of ideas that philosophically they align with in terms of Rails, but they want to take those convention over configuration ideas, the full stack framework ideas, and implement that with all the modern technology we have now.

Drew: So, you mentioned that Redwood gives you a router or a router, as we say over on this side of the pond, does it come with things like default components and any of that sort of stuff in React, or are you just then to implement all that yourself?

Anthony: Yeah, the router is, it’s very sophisticated. It does most of the stuff that you would get just from React router, it has just kind of different ideas in terms of how these should be implemented, because Next they also have their own router, and it’s still not really entirely figured out how we want to get our single page app routing to work. Because of Suspense, you have a lot of these kind of questions over where is the async stuff going to come in? We have with Redwood, this idea of a cell, and this is what really does your data fetching for you.

Drew: So, maybe we could go into that a little bit? What is a cell in terms of Redwood?

Anthony: Yeah, so a cell is a default way to write a GraphQL query and then have your page basically tell whether you’re getting the data back, whether you’re getting an error back, whether you’re in a loading state, or whether... There’s one more state, I forget. But yeah, so it gives you the different states that basically you can be in based on whether you are getting your data or not. It’s setup with Apollo under the covers. So, if you’re using Redwood, you’re using Apollo as your GraphQL client, but you don't ever have to think about it. You never have to write any Apollo or even think about it, it’s all baked in. It lets you just write GraphQL queries, which was really the dream of why people wanted GraphQL, is that it was this really simple query language that front end devs could use. But then, you had to figure out how to set up a GraphQL server, you had to figure out all this other stuff, and how do you get that all wired up. So, it does all of the GraphQL integration for you so you can just write GraphQL, you don't have to think about how do I even implement GraphQL.

Drew: So, I guess one of the classic jobs of a framework is to take all the boiler plate code that you could write yourself and implement it for you, and tidy the way behind the scenes so you never have to look at that boiler plate ever again, and you can just write the code that’s unique to your circumstance. I guess that’s what’s going on with a cell is it? There’s nothing revolutionary here, it’s something that you could set up a React component to have all this different states and you could hook in Apollo and you could do all this yourself, but that’s actually quite a lot of work and it’s a common pattern. So, Redwood has tidied up into a nice, reusable pattern that you can just start using without having to think about it. Is that a good description?

Anthony: Yeah, they came up with the name but they definitely acknowledge that this was a practice they saw frequently and that they saw a lot of people just coding it themselves, and they decided that they wanted a declarative way to do your data fetching. So, that’s why you have this setup, because it lets you just have your different states and you don't have to do if/then logic to figure out, need to do this if this happens. So, it’s about just having a single way to declare all the different states your data could be in as you’re loading it.

Drew: It’s one of the characteristics of React, isn't it, that React doesn't try and give you an architecture for your project, it lets you decide how you’re going to structure things. That, of course, has pros and cons. But, it seems like Redwood is imposing some of that structure for you so that you don't have to think about it and so that it can put the plumbing in for you and sort of pick up where React left off in terms of giving you that sort of structure.

Anthony: Yeah, and I think it’s really interesting that we’ve seen multiple different attempts at this solution to this problem, because I mean you’ve had people who’ve been saying it forever, "Why isn't there a Rails for JavaScript or a Rails for React?" There’s a great Full Stack Radio interview between Michael Chan and Adam Wathan called React is Not a Rails competitor. This is one of the different frameworks.

Anthony: The other ones are BlitzJS which has gotten a decent amount of buzz, and then Bison is kind of a new up and coming one. They all have a similar stack, but they use different pieces. You’ll have React query instead of Apollo, or you’ll have Chakra instead of Tailwind. The people who are putting together all these pieces into their stacks, all these stacks are kind of, they’re battling it out, it’s all very friendly competition. Actually, that’s one thing that I really appreciate, is that we actually all collaborate between the frameworks as well. There’s no animosity there.

Drew: So, we’ve mentioned Apollo and GraphQL, Redwood uses GraphQL quite heavily as one of the core pieces, isn't it, of the framework? We can probably dedicate an entire podcast episode to just GraphQL, but for those who aren't familiar, what piece is GraphQL doing here, what problem is it solving in this context?

Anthony: Yeah, this is a great question. When I am telling people what they should know to have a good start with Redwood, I’d say that you should have used Create React app, just if you’ve made a Create React app, and you’ve deployed it to Netlify or Vercel, that’ll get you a good start. Then, know at least a little bit of GraphQL because it is very central. So, the GraphQL is how your front end will talk to your back end. They say it’s a query language for APIs, the idea being that it’s meant to be an alternative to RESTful API methods, and that instead of doing that RESTful thing, you are sending queries which specify exactly the hierarchical data structure you want to receive back from the database. So, it requires a little more startup time to get your GraphQL server to talk to the two pieces. Then, once you have it there, the front end developers have the ability to get data in much more flexible way. You don't need all these different API endpoints that your back end guys need to keep making.

Drew: So, if there are changes in requirements in the front end, presumably you can then just tweak your GraphQL query and you don't need the help of somebody who works on the back end to make that change for you?

Anthony: I mean, the real dream is you can throw on a mobile client to it, that it would be that flexible ultimately that it becomes, you can have multiple clients all talking to your one API. Your GraphQL API becomes your source of truth, that’s where all your logic is centralized. Then, you can build all these different view layers on top.

Drew: So, we’ve got GraphQL there giving us the ability to query some sort of back end. In Redwood, what is the back end?

Anthony: Yeah. There’s a couple different ways to create your back end. There’s the way you’ll get out of the box with the tutorial, which is you use Postgres database deployed on Heroku, super easy, super simple. Then, your Redwood app talks to it with Prisma. I don't know if you’re familiar at all with Prisma, but it’s like an O/RM. They specifically say it’s not an O/RM, it’s a query builder, which is a little more lower level. But, for the sake of just explaining it to people, Prisma is the thing that lets you talk to your database. It does your migrations and sets up your tables. It does all the SQL stuff so you don't have to write SQL. To me, that sounds like an O/RM. You don't necessarily need to use Prisma though to use Redwood.

Anthony: I actually built a just proof of concept app where we used FaunaDB instead. FaunaDB, they have their own GraphQL API, so you can just send GraphQL API straight to Fauna, and then do your database mutations that way. You lose a lot of the functionality of Prisma’s CLI, but Prisma really it’s a convenience factor to work really easily with your relational database. But really, anything you could think of, you could figure out how to hook it up with Redwood is what I found out just because it’s built around GraphQL and the whole point is to be able to talk to all these different pieces.

Drew: So, Prisma is essentially a sort of abstraction layer between your code and whatever data store that you’re using presumably that Prisma supports, is that... or is it doing more intelligent things than that?

Anthony: Yeah, so you write a schema, so you create a schema.Prisma file, and it would have model post, and then it would have id and integer and auto increment, like title sting, body string, created at date, time. So, you’d create basically what you want to be in your database with the types, and then it does the database stuff for you so you don't have to interact with the database.

Drew: So, you use Prisma to define I guess what sort of database or what sort of data store that you’re talking to. Then, in there you lay out your different mvc models to use that parlance. So then, when your application is talking to the data stores, it’s kind of using an instance of a Prisma client, is it? Is that what’s going on?

Anthony: Yes. Yeah, that’s exactly it. So, in your back end’s API folder, you have a lib folder with a db.js, and just by default that has your Prisma client set up. So, that’s all the stuff you get out of the box, and like you said, Prisma can work with different databases. It can switch between SQLite for development and then Postgres for production, that kind of thing. It’s mostly relational ones right now, but the roadmap has things like Mongo and Fauna on it.

Drew: So, that’s quite useful then if you can set up and use SQLite in your local development environment as you’re getting things up and running, and then go into production with something like MySQL.

Anthony: That’s exactly how the tutorial is set up, that’s the workflow it shows you.

Drew: It’s quite interesting, isn't it, to see a very modern approach to a framework then falling back on some of these more traditional databases like MySQL. I’m very familiar with MySQL. I love it for its stability and I love the relational way of storing data. I think it works so well for so many things. Often you see the baby thrown out which was the bath water when it comes to the newer types of data store, so it’s quite interesting to see Redwood by default supporting these good, old relational databases.

Anthony: Yeah, no, that’s such a good point, because I say that for all the new stuff Redwood combines together, there’s some things that actually says the old, tried and true way is actually the best. So, they are really big on relational databases. That comes from Tom’s experience with using Rails and having a relational back end. Active Record was the O/RM layer that Prisma’s meant to approximate.

Drew: I guess, we’re talking about a serverless architecture here with Redwood, and we talked to Chris Coyier I think two or three episodes back, all about serverless using APIs and cloud function and things. So, taking a step back, if you were to think in terms of a server based framework, like we mentioned Ruby on Rails or something like Laravel in the PHP world. Even with a React front end, your API request would be running code that is Rails code or Laravel code plus then your user code and configuration. Is that the same with Redwood? Is there actual Redwood server code that runs, or is it just more tools and structure and glue that enables you to implement your own?

Anthony: Yeah, so in the back end, there’s a file specifically that is a way to take your SDL, so you have your schema definition language, and then you have what are called your services, which are like your methods for talking to your back end. Then, all of this gets stitched together into a GraphQL handler that is deployed to a single Lambda function. So, it’s optimized for Lambda specifically. We actually just recently had someone do it with the serverless framework, and we’ve got some people working on Azure and Google Cloud something. It’s not Google Cloud function, it’s the one built on top of that. But yeah, so it’s right now basically optimized for deploying your back end as a GraphQL function in an AWS Lambda. This is the stuff that’s all magic happening in the code I don't understand, but that’s the high level explanation.

Drew: So, there are deployment tools are there, that take all the code that you’ve written, squash it all together into some sort of magic ball of code that can be executed in the cloud and puts it up onto AWS or do you still have to manage that process yourself?

Anthony: Yeah, so it’s all done through Netlify if you follow along with the tutorial. You don't really have to mess with any sort of serverless functions yourself. The stuff that wires your back end together to shove it into the AWS Lambda, that’s all handled, you don't have to touch any of that code. That’s all generated out of the box as your conventions over your configurations so you don't really have to think too much about how to make it serverless. It’s serverless by default. It’s really a hard thing to wrap your head around. It took a while for me to wrap my head around it.

Drew: Yeah, because it’s an important point isn't because there are actually now a few different areas we’re keeping track of here. We’ve got I think three different areas. We’ve got our front end React app, that’s running in the browser, and then we’ve got an API that is GraphQL based, running as a cloud function, and that’s responding to our queries, but that’s then interacting with a data store which uses Prisma. And that data store is what and where in this, because you can't run a MySQL server on Netlify, can you?

Anthony: Yes, that’s where Heroku comes in. So, in the very last part of the tutorial, you deploy your front end to Netlify and then you deploy your back end to Heroku Postgres and you just grab your config variables from Heroku, plug it into Netlify. Getting your Netlify front end to talk to your Postgres back end is a really, really simple thing. They wanted to go with the thing that was going to be the easiest for anyone to get spun up, but still have good stable, battle tested tech. At the end, what you get out of the box just by following the instructions, is really incredible.

Drew: Jamstack enthusiasts will be familiar with services like FaunaDB that you mentioned that provides a data store as an API, AWS has DynamoDB, Google has got Cloud SQL, and so on. So, you mentioned that Redwood is looking at integrating, or I guess Prisma is the component here that’s looking at integrating with those sorts of services further down the line?

Anthony: Yeah, this is a good question. This is something I’m actually talking with Ryan Chenkie at Prisma about kind of helping out with, is what is the kind of database story for Redwood for things that don't necessarily work with Prisma? Would it be better to figure out a way to get Redwood to work with it directly like I did with Fauna or would it make more sense to implement a driver for Prisma? So, there’s different ways to approach it. There’s obviously a million different databases now that everyone wants to use, so it’s how motivated are you to get your data store onto it. There’s a lot of community contributions going in there.

Drew: So, because Prisma understands your model and it knows how to query them, is it able to generate some kind of migrations or things like that to help you get that database set up?

Anthony: That’s exactly the thing that you lose out when you have to take Prisma out and get your data, is that you lose all the migration functions. It has a really advanced CLI that does a ton of stuff for you, so you can go through the whole Redwood tutorial and enter the Prisma commands and you don't have to have any idea what it’s doing, it just works. It’s a really great tool for doing all that kind of database type stuff that you want to make sure you get right and you want to make sure it’s done correctly.

Drew: It seems like having a really good tooling around frameworks is quite a modern trend, isn't it? To not just say, "Here’s all the things that this framework can do, but here’s perhaps some CLI tools that are going to do a whole bunch of it for you." Does Redwood have tools for things like CLI generators and stuff to get you up and running quickly?

Anthony: This is probably the biggest key feature that you get from Redwood, is you get a whole set of very sophisticated generators. For anyone who’s ever seen the original Ruby on Rails demo, that DHH gave, he builds a blog in like 15 minutes and he does it all with Rails, and people are like, "Whoa, this is amazing." That’s the effect Redwood is going with. They want you to be able to get everything spun up really quickly so you can generate pages, you can generate layouts, you can generate your cells, which I was talking about, and you can do a scaffold command that is going to create your entire CRUD interface. I have a whole section, part four of the blog series, just explains all the code that the scaffold gives you. It gives you so much code. There’s an off generator, there’s even a Tailwind generator that configures your tailwind for you.

Drew: That’s amazing. I remember seeing DHH’s demo of Rails. I mean, it was probably, what, 15 years ago now when he first did that scaffolding and showed you, and you get a fairly rudimentary but functional control panel essentially to enable you to create new items, edit them, delete them, et cetera. That can be invaluable in a project, especially working in a sort of dynamic environment where, okay maybe you’re going to implement better tools in the future for editing that content, but it means being able to spin something up quickly, you can get test data in, or you can even hand that over to a content team who could start working whilst you’re working on the front end, so that’s really useful.

Drew: If you wanted to just deploy that and have that in production, presumably you can just deploy it along with your front end code, but you’d need some way to secure that aspect, those roots in your application.

Anthony: Yeah, there’s a couple different options for authentication. You can use Netlify identity. That’s the default if you go into the tutorial, and then you can also use Auth0, and then one I’m not familiar with called Magic.Link, and there’ll probably be a couple of extra ones added in the future. But yeah, so there’s a couple built in solutions there already, and that’s the very last thing you do so that’s the very last part of my whole 12 part blog series is the Auth one. I don't think I’d ever figured out Auth before I used Redwood. It’s hard and they’ve definitely done a good job with it.

Drew: Does that integrate at a route level, or a route level, sorry, how do you secure things?

Anthony: Yeah, so part of how they have their own router, they also have... You can do private routes, so they have a private route component. Then, your actual login form, that’s what you get from Netlify identity so you don't have to actually create a form and do your state management with that, that is where a lot of problems come into play. Taking away the really key parts and then you can just implement role based access. We have role based access control add on that was been done over the last couple weeks be David T. So, there’s a lot of work happening to create other ways to do it, but what they got now is already... it works, it’ll get you functional.

Drew: People always say about security algorithm hashing cryptography, that you should never write your own because it’s never going to be as good as the things that are out there. Increasingly, I think that’s also true of authentication at a higher level; that authentication is such a complex area these days that people want to not just log into your site with unique credentials, but they might want to authenticate using Google, or they might want to authenticate using an Apple device, or they might want two factor authentication, or they might want to integrate it with a single sign on service that they’re using from an enterprise. All these things are such a headache if you try and implement it yourself and so much opportunity for getting something wrong and exposing security holes in your application, that using an authentication service seems almost like a no brainer at this point to me. So, just being able to drop something in with essentially a few lines of code and be up and running sounds like a really productive way to work and to keep things secure.

Drew: It sounds like the deploying both the front end and the server aspects, the serverless function things, is a naturally fit for deploying to Netlify. Are you tied into that with Redwood? I mean, we mentioned that Tom Preston-Werner is one of the main proponents of this framework, he’s also on the board at Netlify. Do you think there’s potential for too tight a coupling there if you were to choose Redwood as the basis for a project?

Anthony: Yeah, this is something that Tom’s definitely conscious of. He’s invested in a lot of companies that float around. He invested in Prisma and Fauna. He wants to just make the tools he wants to use. It’s not about we want to lock you into this thing so much as what Netlify has built he thinks is the best option, so that’s why they built around it. But, they don't want it to be locked in to any one deploy target, and that’s why we have work being done on things like the serverless framework and some people have talked about Begin. We want to be pragmatic, we want it to work for whatever someone’s use case is. So, we get you 90% of the way and then you just have to wire up the last couple things to get it to work with whatever your servers of choice is.

Drew: I guess even Netlify is using AWS Lambda for the servers functions so it’s really the deploy part that’s taken care of by Redwood there, and actually you could deploy that to Lambda yourself. Posting your front end is just files, isn't it, it’s CDN based the rest of it? So, there’s quite a lot of flexibility there without being too tied in.

Anthony: Yeah, there’s a actually a term that Tom talks about as the core philosophical idea behind Redwood, which is that we want to get to a universal deployment machine. That’s kind of t idea, is that you can just deploy things and you don't have to think about it at all. He’s been talking about this idea for years and years and years, and this is what Jekyll was even about back in the day. When you hear that now, you’re like, "Oh, you mean like Netlify?" That’s basically what Netlify is to most people who are working on the front end. They don't even think about deploying anymore, it’s not even a thought.

Drew: Here’s my application in a Git Repo, this directory is the front end, this directory is the back end, here’s my database, and that’s about as much configuration as perhaps you would need for then whatever service to take it and to build it and host it.

Anthony: Yes, and one thing I should also point out, we just very recently got Vercel Redwood default deploy set up, so when you’re deploying on a server side app you can say, "Oh, I have Gatsby app," and it knows exactly how to build a Gatsby app versus a NextApp. We have that for Vercel now. So, there are really, really good non-Netlify options as well, if you’re more into that.

Drew: So, if I wanted to get started and build an app and take it into production this week, is Redwood ready for that? Is it mature?

Anthony: Yeah, we’ve got about a half dozen apps that are in production right now. The first one was called Predict COVID, which came out back in March, and it’s like a realtime data visualization application. Then, we’ve got repeater.dev is done by Rob, it’s like a cron job like thing for Jamstack. Then, there’s Tape.sh, Duoflag I think is another one. So, there’s at least a handful. If you go awesome Redwood repo, you can see a list of all of them. If you go to the community forums, you can find write ups of these as well, because people have put these into production and kind of said how it went. So far, they’ve all been successful and no one’s said, "I’m never using this again."

Drew: But, it is very new. I guess there’s no escaping that, but in terms of maturity, Redwood’s pretty new, it’s getting a good following.

Anthony: Well, it’s funny, it is and it isn't. It was announced in March. At that point, it had been worked on for about a year by Tom and Peter. So, they’d already put a ton of upfront work into this, so it wasn't like I’m going to announce this project with a Read Me and then start building it. By the time they announced it, it wasn't... It’s not a 1.0 now, but it’s pretty dang close in terms of what people would expect out of a 1.0. But, Tom is very against what we call type driven development so he always errs on the say it’s not ready. So, we say it’s not ready for production even though it’s in production.

Drew: I think one thing that people sometimes get burned on using frameworks is that they’ll build a project around the framework and then that framework will very quickly go to another major version that had backwards incompatibilities, and they’re then left with a big project to update everything onto the new version of the framework. Is that something that’s likely to happen with Redwood? I mean, none of us has got a crystal ball, but just with the technologies that are involved and the way it’s structured, do you think that’s a big danger or a little danger?

Anthony: Yeah, it’s a super valid concern and definitely something the team has thought about. The CLI has an upgrade command, so you can basically every time there’s a version bump, you just do a command and it bumps you up the version. I’ve been dealing with this a little bit just because of the series I wrote, I started it when it was on version 11 or 0.11, it’s like 0.17 or something now. So, I’ve been slowly iterating on it as it’s gone but nothing breaks. It’s all, you get slowly things, or like "Oh, this is kind of a nice little touch you’ve got here," but it’s pretty much set in stone architecturally. Redwood as it’s structured, the front or the back end is not going to change at all. It was very well thought out in terms of what they want architecturally. That’s why they built it, so they could get something that’s structured like this thing.

Drew: I guess with modern web development, there is a certain point where you’re just never going to get away from being reliant on dependencies updating themselves and changing. I mean, even using React, React goes through as many different changes as anything else.

Anthony: That’s exactly why Tom inventing semantic versioning.

Drew: I guess from the other side of that coin, if Redwood did happen to go away, which is always something we consider when picking a framework, if development stopped somehow, I guess the impact on a particular app might not be too great because it is just so heavily built on existing other projects around. Is that-

Anthony: Well, some would say that a Redwood tree can survive a lot, it survives for a very long time. That may have been why it’s called that, is that you can just make a site and deploy it and it’s not going to break, it’s just going to work. So yeah, maintainability, sustainability, all that kind of stuff, that’s huge. Being built by people who tried to scale Rails apps, I imagine they’ve thought a lot about that. But in terms of the going away part, that’s always going to be a danger with any open source project, so I think what you have to look for is how enthusiastic is the community to continue it without the team if that ever happens. I don't think you even need to worry about that because Tom’s a billionaire and he has a venture funding thing that is funding some of the development. It is an open source project that is well funded actually. It has four full time members, Tom, Rob, David, and Peter. You just go to the forums, you can see the activity that’s going on, so I wouldn't worry about that too much-

Drew: Of course.

Anthony: Beyond normal open source worries that come along with that stuff.

Drew: What is the community like? You mentioned the community, are there lots of people using it and contributing to the code base or is it mainly the core team who are doing the development?

Anthony: Yeah, it’s very much structured to be a community thing. They want to get as much buy in from the community as possible, and this comes from the lineage like you said. There’s few people with more open source cred than Tom, so he’s done a really great job of bringing people into the fold. I think just my story in general is a big win for the community because I came in, I’m a boot camp student, I’m learning all this stuff as I go. I’m not pushing code to the repo, I’m making doc fixes and writing blog articles and stuff, but they still invited me to the core contributors meeting because they saw what I was doing and they thought it was adding value. Yeah, there’s really a lot of things about how they approach community building that I have a lot of respect for, and that is why I’ve been so invested in it and putting so much of myself into it.

Drew: Some frameworks have got this sort of natural bent for certain types of projects. For example. The Python framework, Django came out of online news publishing, and so it’s a really good fit if you want to rapidly publish content like you would in a news organization. Does Redwood lean in any particular direction when it comes to the type of projects? Is it suited for content publishing or building web applications or-

Anthony: It’s made to be fairly agnostic to that. It wants to be a tool that you use for a lot of stuff. First, before it was called Redwood, it was called Hammer, the idea being that you do a lot of stuff with a hammer. But, there definitely is a kind of sweet spot, which I think is the multi client type applications. So, if you know that you’re starting with a web front end but you’re pretty sure you’re going to end up with a mobile client as well, then it’s a really good fit for that because it starts you off in a way that you’re going to be able to extend into having multiple clients with GraphQL, which we kind of talked about a little bit. So, I’d say that’d probably be the first thing that I would say is its sweet spot. But, it’s meant to work for as many things as possible.

Drew: Does Redwood have a published roadmap of where it’s going? What can we expect to be coming in the near future?

Anthony: Glad you asked. We just put out a roadmap to 1.0 less than a month ago, it was probably like two or three weeks ago. It kind of itemizes things that we’re working on, things we think we’re kind of close on, things we think we still have a long ways to go on. That kind of helps the community see where can I help contribute. That’s one of the things we’re really great about is showing here are the things that still need to be worked on. They’re aiming for 1.0 by the end of the year. We’ll see where we get with that, but that’s the trajectory we’re currently on.

Drew: One of the beauties of a Jamstack and a serverless approach I always think is that it’s this idea of lots of pieces loosely joined that has served us so well in computer science up until this point. It should be really easy to scale up a Jamstack and serverless project because you can add multiple front ends or you could put more resources behind running your functions, and you can scale up a big engineering team by having people work on different small pieces. Is there a danger that adopting a framework around all of that, that you might be taking a distributed architecture and creating a tighter binding than you might otherwise have? Could Redwood become the monolith that acts as a bottleneck in your engineering efforts?

Anthony: Yeah, this is something I think about a lot because as I learned web development, I was taking... I’m in a boot camp that supposedly is full stack development, but you learn each piece in isolation. We’re essentially learning the PERN stack, but you learn React, and then we learned Express. We never talked about how it actually works together. So, I do think that there is definitely a danger of not being able to comprehend in your project because of how it’s all wired up. So, what I really liked about Redwood is that it just made sense. It was a mental model of how to think about my entire app and all the pieces and how they fit together in a way that really made sense to me. But, what I was surprised to find doing the Fauna project is that it’s much more modular than you would think based on... You talk about it, and like you said, it sounds like it’s a monolith thing, but you can rip pieces out and replace them with other pieces and they can still work. So, it’s made to be a fully integrated solution, but not a solution that is tightly coupled just because this is a good way to integrate all these technologies doesn't mean you need to tightly couple them to integrate them well.

Drew: Yeah, that sounds a very promising way of structuring things, and it’s going to be really exciting to see what happens with Redwood as it gets to version 1.0. Is there anything else we should know about it that we haven't talked about?

Anthony: No. I mean, I would say if you’re interested, just check out the tutorial on YouTube, the RedwoodJS tutorial. They have what they call tutorial driven development, which is kind of a play on Read Me driven development, which is another thing Tom coined, that you should start with a Read Me, and then create your code to make sense with what your Read Me was. This is the idea of you create a tutorial and then you write your framework to make the tutorial work. So, that’s why it’s a really easy way to get spun up with it because it was made to make sense of going through the process of learning it. They’ve really thought about how to actually get onboarded into a massive framework with all these different pieces and all this different new tech. They progressively reveal it to you as you go. The series that I wrote is very heavily influenced by it. I essentially built the same project, but I write my own stuff as I go, and reference the docs. So, if you’re interested in just learning Redwood, start with the actual tutorial and then check out my series.

Drew: So, I’ve been learning all about Redwood, what have you been learning about?

Anthony: Yeah, so I’ve been learning about CMSs, and I was actually really curious to get your thoughts on this because I imagine you’ve been around the block, you know a lot of CMSs. Obviously, you know you’ve got your WordPress's, your Drupal, but what’s really interesting with something like Redwood is since you have this GraphQL stuff baked in, it has the CMS, it’s just such a natural fit. So, I’m trying to figure out, what are interesting headless CMSs to check out? Which ones have GraphQL integration? Which ones have different sweet spots? If I wanted to take a CMS to build an app with RedwoodJS, what would you recommend?

Drew: That is a good question, and I’m not sure I have an immediate answer. I have looked at lots of different CMSs, not particularly with a view to GraphQL. I’ve not worked with GraphQL myself yet, and so that was not-

Anthony: Oh man, you’ve got to join the club, dude.

Drew: Yeah, no, I’m definitely getting onboard. But yes, I have a requirement at work that may be coming up to know a bit more about GraphQL, so it’s certainly one of the things that I need to be learning.

Anthony: I actually learned GraphQL through Redwood. I didn't really know GraphQL, and I’d say you should know a little bit before going into it, and I had a very, very tiny basic knowledge. You can actually learn what a schema definition language is, and that GraphQL kind of jargon. You’ll learn a lot and you’ll pick it up as you go with Redwood.

Drew: Yeah, I should definitely get onboard and maybe doing some Redwood is the way to do it. Perhaps I need to pick up a project and start going with Redwood and see where it takes me.

Anthony: Yeah, at the very least I would say just check it out, just because it’s interesting. I find it to be just a really fascinating thought experiment of how do we do modern web application development differently and more coherently.

Drew: If you, dear listener, would like to hear more from Anthony, you can find him on Twitter at ajcwebdev. His comprehensive series of articles about getting started with Redwood are on the Redwood community site, which we’ll link to from the show notes. Of course, you can find all about Redwood and get started at RedwoodJS.com. Thanks for joining us today, Anthony. Do you have any parting words?

Anthony: Just if you’re interested in any of this stuff, feel free to reach out. My DMs are always open. The community is very open in general. I’ll be happy to explain or walkthrough or get you set up with anything you need to know to get going.