Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Ever had a bug because the frontend made incorrect assumptions about the shape of response data from the backend? Or maybe you trod nervously during a refactor? Or perhaps you broke an app by changing the backend data in a way you didn’t think would matter? This talk will show you how avoid these mistakes, enabling you to keep moving fast, by having a single source of truth for your data types, checked both on the frontend and the backend. rubyday 2023 happened in Verona on 16th June 2023 Info and details of this edition: 2023.rubyday.it/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the video titled "End to end typing for web applications," Frederick Cheung discusses strategies to effectively manage data types and enhance type safety in web applications, minimizing the risk of bugs arising from mismatched assumptions between frontend and backend data. The presentation highlights the significance of having a single source of truth regarding data types and emphasizes using TypeScript alongside JSON Schema for robust type checks. Key Points Discussed: - **Problem with Type Safety**: Cheung opens with an anecdote about a sorting function in JavaScript that fails to handle nullable last names, illustrating the common pitfalls developers encounter when integrating frontend and backend code without clear type definitions. - **Introduction to TypeScript**: He explains TypeScript, an open-source language that adds static typing to JavaScript, which helps in identifying type mismatches before runtime. Type annotations allow developers to specify expected data types, helping to catch errors early. - **Static vs. Structural Type Systems**: The distinctions between nominal and structural type systems are outlined, showcasing how TypeScript differs from others by focusing on the structure of data rather than its name. - **Practical Applications**: Cheung details the various constructs available in TypeScript, such as unions, intersections, generics, and how they help manage complex data structures effectively. He discusses narrowing types through conditional checks and the use of discriminated unions to create more precise type definitions. - **Integrating JSON Schema**: Cheung emphasizes the importance of JSON Schema in describing the structure of JSON data, which can maintain sync with TypeScript types. He offers insights into workflow options for generating TypeScript definitions from JSON Schema to ensure front-end safety. - **Progressive Integration**: Discussing his team's incremental approach, Cheung suggests adopting TypeScript gradually, integrating schemas without requiring a system-wide overhaul. This strategy fosters confidence during refactoring and enhances type safety across the application. - **Conclusion and Benefits**: Cheung concludes by stressing the benefits of this approach, including reduced bugs, increased team productivity, and an overall safer codebase. He invites the audience to explore a sample Rails application to see these concepts in action and highlights the importance of continuous learning and adaptation in development practices. By the end of the talk, Cheung effectively illustrates how adopting TypeScript alongside JSON Schema fosters a cohesive development environment, ensuring a smoother integration of frontend and backend systems while minimizing the likelihood of errors.
Suggest modifications
Cancel