Logo
    Search

    Podcast Summary

    • Adding functionality to codebases with polyfills, transpiling, and monkey patchingPolyfills modify prototypes to add new features, transpiling converts code to another language, monkey patching modifies existing functions or objects, and ponyfills add new functions without modifying prototypes. Choose the best technique based on specific use case, feature support, and risks.

      Polyfills, transpiling, and monkey patching are techniques used to add functionality to codebases that may not be natively supported in the current environment. Polyfills involve using JavaScript code to add new features to existing objects, such as arrays, by modifying their prototypes. For example, if a browser doesn't yet support the flatMap method on arrays, a polyfill can be added to enable its use. Transpiling, on the other hand, is the process of converting code written in one programming language or syntax into another. This is often used to make code compatible with older browsers or environments that don't support newer features. Monkey patching is a more advanced technique where existing functions or objects are modified in real-time to add new functionality. This can be useful in certain situations, but it can also be risky and lead to unintended consequences. Ponyfills are a type of polyfill where instead of modifying the prototype, a new function is added. This can be useful when working with proposed features that may not yet be approved or supported in all browsers. When deciding which technique to use, consider the specific use case, the level of support for the desired feature, and the potential risks and benefits of each approach.

    • Best practice: Use transpiling instead of modifying prototypesTranspile code from high-level languages to JavaScript for compatibility and consistency. Prioritize features with strong adoption likelihood to minimize future refactoring.

      When it comes to modifying prototypes in JavaScript development, it's generally best practice to avoid doing so unless the changes have been approved and are supported by all major browsers. Instead, consider using a technique called transpiling, which involves translating and compiling code from one high-level programming language to another, such as TypeScript to JavaScript or ES6 to ES5. This process can help ensure compatibility and consistency in your codebase. Transpiling is particularly useful when dealing with new syntax or features that have not yet been fully adopted by the JavaScript language. For example, arrow functions, decorators, and the pipeline operator are all examples of features that may require transpiling. However, it's important to carefully consider which features to transpile, as some may still be in the proposal stage or have competing visions for their final syntax. When deciding which features to transpile, it's crucial to prioritize those that are well-established and have a strong likelihood of being adopted into the JavaScript language. This can help minimize the risk of having to rewrite or refactor code down the line due to changes in syntax or functionality. By focusing on stable, approved features, developers can build on a solid foundation and avoid unnecessary complications.

    • TypeScript's decorators vs CSSTypeScript's decorators can cause confusion due to different syntaxes. Transpiling CSS can ensure cross-browser compatibility but can't add new features and some advanced CSS capabilities may not be fully compatible.

      TypeScript's implementation of decorators, which is different from the ECMAScript decorator proposal, can cause confusion for developers due to the existence of two decorator syntaxes. On the topic of CSS, transpiling unsupported CSS can help ensure cross-browser compatibility by replacing unsupported properties with their equivalent fallbacks. However, it's important to note that transpiling cannot add new features that the browser doesn't support, and some advanced CSS features, like dynamic CSS variables, may not be fully compatible with transpiling. Lastly, while CSS is often considered a styling language rather than a programming language, it does possess programming capabilities, and the debate around its classification is largely semantic and irrelevant to its practical use.

    • Using Polyfills for Compatibility and New FeaturesPolyfills allow for using new JavaScript and CSS features in browsers that don't support them yet, with potential concerns for confusion between mutable and immutable array methods.

      Polyfills are a solution for using new features in JavaScript or CSS that are not yet supported by certain browsers. For JavaScript, polyfills can be used to add new array methods that are not mutating, such as reverse, sorted, sliced, and with. These polyfills can be included in your codebase and will add the new methods to the prototype of all Arrays if they don't already exist. However, some concerns have been raised about the potential for confusion with mutable and immutable array methods. In the case of CSS, polyfills involve dynamically modifying the stylesheets to add new features, rather than modifying the JavaScript code as with transpiling. Overall, polyfills are a useful tool for ensuring compatibility across different browsers and for adding new features without having to wait for widespread support. However, it's important to be mindful of potential gotchas, such as the distinction between mutable and immutable array methods.

    • Using Polyfills to Add New Features with a CostPolyfills add new features but come with JavaScript and potential performance costs. Use them wisely and understand the trade-offs.

      While polyfills in CSS can add new features to your site, they come with the cost of additional JavaScript and potential performance issues. For instance, the polyfill for container queries uses technologies like resize observer and can add a lot of JavaScript to your site, which can run frequently and impact site performance. However, if used judiciously, polyfills can be beneficial. For example, we're using HTML polyfills for the popover API on our new site, which allows us to add pop-over features without writing any JavaScript ourselves. The popover API works by adding and toggling classes and adding click handlers, making it a lightweight solution. However, it's important to note that not all browsers support the popover API yet, and polyfilling it involves display: none and positioning the element absolutely when the button is clicked. Another feature we had to polyfill was anchoring, which puts the new layer outside of the rendering context in HTML, making it impossible to position absolutely within a relative container. To overcome this, we wrote a Svelte action that works as a polyfill for anchoring. In summary, while polyfills can add new features to your site, they come with the cost of additional JavaScript and potential performance issues. It's important to use them judiciously and understand the trade-offs involved.

    • Polyfills bridge the gap between modern HTML features and older browsersPolyfills enable modern HTML features to work in older browsers using minimal JavaScript, tools like Babel or TypeScript, and web components

      There are certain HTML features that were not natively supported by older browsers and required polyfills to function properly. Two examples given were the "details" tag, which allows users to expand and collapse content, and the "picture" element, which enables efficient image loading. Polyfills can be implemented using minimal JavaScript, as demonstrated by Miriam Suzanne's popover API polyfill. Transpiling and polyfilling code involves using tools like Babel or TypeScript to ensure compatibility with various browsers. Babel compiles code based on the browsers you want to support, while TypeScript can sometimes require waiting for new features to be implemented before use. Web components, such as the select menu polyfill, can also serve as polyfills by providing alternative ways to use unsupported HTML elements.

    • Exploring Different Tools and Languages for Simplifying JavaScript DevelopmentTools like CoffeeScript, Civet, JSX, and Svelte offer various syntaxes and features to simplify JavaScript development, but may require a learning curve and additional setup. Polyfill.io helps handle browser compatibility issues by detecting user agents and downloading necessary polyfills.

      There are various programming languages and tools, such as CoffeeScript, Civet, JSX, and Svelte, which offer different syntaxes and features to simplify JavaScript development. CoffeeScript and Civet are examples of languages that provide cleaner syntaxes and have a strong resemblance to CoffeeScript. JSX, on the other hand, is a transformer that converts tag-based syntax into JavaScript, and is used by frameworks like React. While these tools can make development easier and more efficient, they may also come with a learning curve and require additional setup. For instance, a Python developer might find it challenging to learn the non-bracket CSS syntax and Pub Sub in a project written in Meteor with Stylus. Furthermore, there can be confusion regarding terminology, such as the distinction between a compiler and a transpiler. However, at the end of the day, the choice of tools and languages is largely a matter of personal preference and project requirements. One popular tool for handling browser compatibility issues is Polyfill.io, which detects user agents and downloads the necessary polyfills for the browser. By including a script tag, developers can ensure their code runs smoothly across different browsers. Ultimately, the goal is to find the right balance between simplicity, efficiency, and ease of use, and to continuously explore and adapt to new tools and technologies as they emerge.

    • Understanding Polyfills, Transpilers, Shivs, Shims, and Monkey PatchingPolyfills add missing features to environments, transpilers convert modern code to older versions, shivs and shims were originally used for HTML5 compatibility, monkey patching modifies external library code without merging changes

      When it comes to web development, there are several techniques used to ensure compatibility and functionality across different browsers and environments. Two common techniques are polyfilling and transpiling. Polyfilling is the process of adding missing features to an environment using code, while transpiling involves converting modern code syntax into older versions that can be understood by certain environments. For example, Promises can be polyfilled, but async/await cannot and must be transpiled. Another topic discussed was the history of HTML5 shiv and shim. These terms were used interchangeably, but shiv originally referred to a script that allowed older browsers to recognize new HTML5 elements, while shim was a term used to describe a code snippet that levels up or props up existing functionality. However, the terms were often used interchangeably and the origin of the names remains unclear. Monkey patching was also discussed as a technique for modifying external library code without merging the changes into the core library. This is typically done using patch packages in tools like PNPM, and involves making direct modifications to the code in the node_modules folder. Monkey patching is a non-permanent solution that allows for customization and flexibility in library usage.

    • Modifying existing code with monkey patchingMonkey patching is a technique to modify code without changing the original source, useful for libraries using browser primitives or globals in SSR context. Apply patches through if statements, generating diff files for persistence.

      Monkey patching is a technique used to modify existing code without changing the original source. It's particularly useful when dealing with libraries that use browser primitives or globals in an SSR (Server Side Rendering) context. Monkey patching involves adding an if statement to ensure the code runs only in a browser environment, then applying a patch to modify the desired lines of code. The patch generates a diff file, which is applied whenever the library is reinstalled, ensuring the patch remains in effect. Monkey patching can be done by modifying the node module file directly or by overwriting functions or properties on a module. While the latter method is simpler, modifying node modules directly is recommended for more precise changes. However, it's important to note that monkey patching can be mysterious and may lead to unintended consequences, especially when modifying prototypes. Patches are usually temporary and explicit, with patches easily visible in the package.json file or a dedicated patches folder. Monkey patching can be useful for fixing specific issues that libraries won't address, but it's important to be aware of the potential risks and limitations.

    • Monkey patching: Modifying code without permissionMonkey patching can be a quick solution, but risks unexpected issues and should be weighed against alternatives like forking or communicating with the package author.

      Monkey patching, or modifying existing code without the author's permission, is a contentious practice in programming. Some developers strongly oppose it, considering it a bad practice or a code smell. Monkey patching involves adding patches to packages or even modifying the prototype, which can lead to unexpected issues if the author decides to add the same method or feature. This was demonstrated with the history of MooTools and the controversy surrounding its modification of built-in prototypes. However, in some cases, monkey patching can be a necessary solution when you need to get things done quickly and the package author may not respond promptly. It's a calculated risk, as you may be taking the chance that the author won't add the feature you've monkey-patched. Alternatives to monkey patching include forking the package, making modifications, and deploying it yourself. This approach can be more time-consuming but is generally considered a more acceptable practice. Ultimately, it's essential to be aware of the potential risks and benefits of monkey patching and to weigh them carefully before deciding to implement it in your projects. It's also crucial to communicate with the package author if possible and consider their perspective on the issue.

    • Miros' Air Purifier Eliminates Odors and VOCsMiros' Mira Smart WiFi Air Purifier effectively reduces unpleasant odors and potentially harmful VOCs from the air. Cable sleeves are a simple and affordable solution for organizing and hiding unsightly cables.

      Miros' smart home products, specifically their Mira Smart WiFi Air Purifier, can effectively eliminate unpleasant odors and potentially harmful VOCs from the air. Wes shared his experience of using the air purifier to reduce the smell of newly installed rubber flooring in his gym. He was impressed with its ability to filter out the odors and improve air quality. Additionally, Wes expressed his appreciation for cable sleeves as a simple and affordable solution for organizing and hiding unsightly cables. He recommended cable sleeves for anyone looking to create a cleaner, more organized cabling setup.

    • Improve workspace functionality with cable sleevesCable sleeves enhance appearance and protect cables, making workspaces more organized and safer. Split versions and accessories like cable ties and reflective tape simplify installation.

      Using cable sleeves to organize and protect cables can significantly improve the appearance and functionality of a workspace, especially for those with multiple cables carrying power, audio, and Ethernet. The process of installing the sleeves can be somewhat annoying, but the benefits outweigh the inconvenience. A split version of the cable sleeve makes the process easier, as it eliminates the need to take apart existing cables or desolder components. Additionally, using cable ties and reflective tape can help keep cables organized and visible, ensuring safety and preventing potential accidents. Sources like AliExpress offer affordable options for purchasing cable sleeves and related accessories. Investing in courses from websites like westboss.com and using error tracking tools such as Sentry at century.io can further enhance productivity and problem-solving capabilities.

    • Sentry: A Must-Have Tool for Smooth Application DevelopmentSentry offers real-time error tracking and monitoring, enabling developers to swiftly identify and resolve issues, enhancing application performance and user experience.

      Sentry is a valuable tool that has saved the speaker from numerous issues. They highly recommend checking it out at century.sentry.io, using the coupon code "tasty treat" for two months free. This was a brief message in the podcast episode, but the importance of Sentry cannot be overstated. It's a must-have for developers who want to ensure their applications are running smoothly and error-free. If you're interested in more discussions on software development, be sure to listen to the full episodes on Syntax.fm. Don't forget to subscribe in your podcast player or leave a review if you enjoy the show. In essence, Sentry is a crucial part of the development process, providing real-time error tracking and monitoring, allowing developers to quickly identify and address issues, ultimately saving time and resources. It's an investment worth making for any team looking to improve their application's performance and user experience.

    Recent Episodes from Syntax - Tasty Web Development Treats

    789: Do More With AI - LLMs With Big Token Counts

    789: Do More With AI - LLMs With Big Token Counts

    Join Scott and CJ as they dive into the fascinating world of AI, exploring topics from LLM token sizes and context windows to understanding input length. They discuss practical use cases and share insights on how web developers can leverage larger token counts to maximize the potential of AI and LLMs.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    CJ: X Instagram YouTube TwitchTV

    Randy: X Instagram YouTube Threads

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    Scott and CJ chat with Paul Copplestone, CEO and co-founder of Supabase, about the journey of building an open source alternative to Firebase. Learn about the tech stack, the story behind their excellent documentation, and how Supabase balances business goals with open-source values.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 Who is Paul Copplestone?
    • 01:17 Why ‘Supa’ and not ‘Super’?
    • 02:26 How did Supabase start?
    • 08:42 Simplicity in design.
    • 10:32 How do you take Supabase one step beyond the competition?
    • 12:35 How do you decide which libraries are officially supported vs community maintained?
      • 15:17 You don’t need a client library!
    • 16:48 Edge functions for server-side functionality.
    • 18:51 The genesis of pgvector.
    • 20:59 The product strategy.
    • 22:25 What’s the story behind Supabase’s awesome docs?
    • 25:26 The tech behind Supabase.
    • 35:46 How do you balance business goals with open source?
    • 42:01 What’s next for Supabase?
    • 44:15 Supabase’s GA + new features.
    • 48:24 Who runs the X account?
    • 50:39 Sick Picks + Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    CJ: X Instagram YouTube TwitchTV

    Randy: X Instagram YouTube Threads

    787: You Should Try Vue.js

    787: You Should Try Vue.js

    Scott and CJ dive deep into the world of Vue.js, exploring what makes this frontend framework unique and why it stands out from React and Svelte. CJ gives a comprehensive tour, covering everything from getting started to advanced features like state management and Vue’s built-in styles.

    Show Notes

    Vue.js: The Documentary.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    786: What Open Source license should you use?

    786: What Open Source license should you use?

    Scott and CJ dive into the world of open source, breaking down its meaning, benefits, and the various types of licenses you’ll encounter. From permissive licenses like MIT and Apache 2.0 to copy-left licenses such as GNU GPLv3, they’ll help you choose and apply the right license for your project.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    785: What’s Next for NextJS with Tim Neutkens

    785: What’s Next for NextJS with Tim Neutkens

    Scott and Wes dive into the world of Next.js with special guest Tim Neutkens from Vercel. They explore the latest updates, including the React Compiler and React Server Components, discussing their impact on developer workflows and the future of Next.js development.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 What does the React Compiler do?
    • 05:04 Will React Compiler help with managing Context?
    • 06:39 What happens if you’re not using a React Compiler?
    • 09:30 Will this work on any NextJS version?
    • 12:18 What are React Server Components?
    • 16:28 Shipping all the data inside an encapsulated component.
    • 20:17 Clearing up the frustrations around retrofitting server components.
    • 23:13 Handing migration.
    • 28:30 Is this just a fetch request with props?
    • 36:41 How closely are the NextJS and React teams working?
    • 41:53 Will we ever get Async Client Components?
    • 43:52 Async Local Storage API.
    • 45:31 Turbopack.
    • 57:51 Sick Picks & Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    784: Logging × Blogging × Testing × Freelancing

    784: Logging × Blogging × Testing × Freelancing

    In this Potluck episode, Scott and Wes tackle listener questions on modern blogging, website environmental impact, and using LangChain with LLMs. They also cover CSS hyphens, unit vs. integration testing, and balancing web development with new parenthood.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    Scott and Wes dive into the world of browser caching for audio files, exploring the File System API and the Cache API. They discuss size restrictions across different browsers, how tools like Riverside.fm leverage IndexedDB, and walk through code examples for creating, retrieving, and managing cached audio data.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    782: The Developer’s Guide To Fonts with Stephen Nixon

    782: The Developer’s Guide To Fonts with Stephen Nixon

    Scott and CJ are joined by Stephen Nixon of ArrowType to delve into the world of fonts and type for developers. They explore the intricacies of font creation, the utility of variable fonts, and offer tips for making visually appealing typography on the web.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    781: Potluck - The Value of TypeScript × Vue vs Svelte × Leetcode

    781: Potluck - The Value of TypeScript × Vue vs Svelte × Leetcode

    In this potluck episode of Syntax, Scott and CJ serve up a variety of community questions, from the nuances of beginner vs. advanced TypeScript to the pros and cons of SvelteKit. They also discuss falling out of love with React, shipping private packages via NPM, and the eternal struggle of always starting but never finishing projects.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    780: Cloud Storage: Bandwidth, Storage and BIG ZIPS

    780: Cloud Storage: Bandwidth, Storage and BIG ZIPS

    Today, Scott and Wes dive into cloud storage solutions—why you might need them, how they use them, and what you need to know about the big players, fees, and more.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    Related Episodes

    Hasty Treat - Old Browsers, Fallbacks and Polyfills - Part 3

    Hasty Treat - Old Browsers, Fallbacks and Polyfills - Part 3

    In this Hasty Treat, Scott and Wes conclude a three-part series about old browsers, fallbacks and polyfills. In part three, they talk specifically about transpiling and polyfilling.

    VueSchool.io — Sponsor

    Check out VueSchool.io’s new subscription plans. Get access to their entire catalog with more than 160 lessons, including The Vue.js Masterclass, for one low monthly fee. New content and courses are added regularly. Visit VueSchool.io/syntax and get your first month for only $5.

    Show Notes

    2:20 - Polyfills and Transpile

    5:18 - Back in the day

    • Border-radius htc hack
    • PNG fix for transparent PNGs
    • Flash for custom fonts
    • Cufon and SIFR

    10:48 - JavaScript Polyfills

    13:47 - JavaScript Transpile

    • Syntax is transpiled
    • babel-preset-env
    • Babel has plugins and presets
    • Meteor bundle to different browsers on demand
    • There are polyfills for most things, but performance can be an issue
      • Resize observer
      • Intersection Observer
    • Some things can’t be done with either
      • New browser APIs
      • Service workers, device access, inline video on old iOS, etc.

    Tweet us your tasty treats!

    Выпуск №39: Привет, Svelte! Пока, moment.js!

    Выпуск №39: Привет, Svelte! Пока, moment.js!
    написал виджет на Свелт и доволен https://habr.com/ru/company/citymobil/blog/504270/ TS in Svelte https://svelte.dev/blog/svelte-and-typescript Новый пропозал про правильную дату https://tc39.es/proposal-temporal/docs/cookbook.html Добавляем https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat как и что подсвечивать https://buttondown.email/hillelwayne/archive/syntax-highlighting-is-a-waste-of-an-information/ Apple declined to implement 16 Web APIs in Safari due to privacy concerns https://css-tricks.com/apple-declined-to-implement-16-web-apis-in-safari-due-to-privacy-concerns/ Displaying the Current Step with CSS Counters https://css-tricks.com/displaying-the-current-step-with-css-counters/ Пики: Порядок отрисовки https://abandonedwig.info/blog/2020/07/03/css-painting-order.html Introduction to Node.js https://nodejs.dev/learn ШРИ 2019-2020 https://www.youtube.com/playlist?list=PLKaafC45L_SRoYnuEW5cgqHN-kpSTVfMs Хак чтобы сделать любой HTML в MD (например в ридми гитахаба) https://medium.com/@omrilotan/rich-html-in-github-readme-bfb3de791441

    Large Scale GraphQL

    Large Scale GraphQL

    Large Scale GraphQL. Wat is het en hoe implementeer je zoiets bij een grote organisatie? Daar gaan Koen en Jette het in deze aflevering uitgebreid over hebben met twee van onze eigen Capi’s. Zo vertellen Martin van Toorn en Jeroen Hammann vanuit hun ervaring bij de Albert Heijn, alles over dit onderwerp. We gaan het o.a. hebben over, waar GraphQL vandaan komt, het verschil tussen Rest en GraphQL, cashing en meer.

    Info [capi]cast
    www.capicast.nl
    Info [code]capi
    www.codecapi.nl

    Socials
    LinkedIn
    Instagram
    TikTok