SlideShare a Scribd company logo
Types End-to-end
More Features And Fewer Bugs with GraphQL
hello, i'm stephen!
Samsara, end-to-end
Samsara, end-to-end

Recommended for you

All things that are not code
All things that are not codeAll things that are not code
All things that are not code

In this talk I’ll challenge what developers and devops consider things that belong in the code, what are the benefits for extracting concerns from the development life cycle and what approaches are we already seeing used. Among other I will explore different techniques companies are already taking (home grown solutions) and motivation for companies to create a software decoration framework running on devices for the purposes of A/B testing, dynamic analytics and gradually releasing features. The client side architecture that runs your code on multiple remote devices introduce new challenges but also new opportunities in how we view production code and how it is released. We will explore the new role of production control and how such systems enable devops tools management without the need to disrupt the development cycle and development team, we will show examples of profiling, logging, debugging, root cause analysis and customer support that are introduced to the system without the need for a release. (with real life examples)

mobile delivery
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript

The document discusses working with code abstract syntax trees (ASTs). It provides examples of parsing code into ASTs using libraries like Esprima, querying ASTs using libraries like grasp-equery, constructing and transforming ASTs, and generating code from ASTs. It introduces aster, an AST-based code builder that allows defining reusable AST transformations as plugins and integrating AST-based builds into generic build systems like Grunt and Gulp. Aster aims to improve on file-based builders by working directly with ASTs in a streaming fashion.

source codejavascriptmetaprogramming
Advanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScriptAdvanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScript

This document is a 53 page presentation by Andreas Ecker of 1&1 Internet AG on advanced object-oriented JavaScript. It covers topics like classes, inheritance, scopes, closures, namespaces, and design patterns. It also introduces the qooxdoo framework, which provides features like classes, static members, interfaces, and mixins to improve the object model of JavaScript.

javascriptobject-orientationoo
Samsara, end-to-end
Samsara, end-to-end
Types End-to-End @ samsara
mo' features, mo' problems.

Recommended for you

Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing

Workshop JavaScript Testing. Frameworks. Client vs Server Testing. Jasmine. Chai. Nock. Sinon. Spec Runners: Karma. TDD. Code coverage. Building a testable JS app. Presentado por ing: Raúl Delgado y Mario García

visualengintestingjavascript
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript

1. The document discusses JavaScript concepts like scope, closures, context, and object-oriented programming techniques like constructors, methods, and inheritance. 2. It provides examples of how to create public and private methods, and "privileged" methods that have access to private values and methods. 3. The document shows how to dynamically generate classes at runtime based on properties passed to a constructor using these JavaScript concepts.

contextclosuresscope
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services

In the coming two weeks I will do a series of talks at various conferences in Austria and Germany. I will speak about AngularJS, TypeScript, and Windows Azure Mobile Services. In this blog post I publish the slides and the sample code.

angularjssoftware developmentmvc
GraphQL Schema
type Device {
name: string!;
id: number!;
currentDriver: Driver;
locations: [Location!]!;
// ...
}
type Root {
device(id: number!): Device;
}
mo' features, mo' problems.
(mo' static types)
safety
editor tooling
safety
static verification at compile time and deployment
editor tooling
autocomplete, go to definition, type hints

Recommended for you

Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript

This document provides a summary of an introductory presentation on advanced JavaScript concepts including closures, prototypes, inheritance, and more. The presentation covers object literals and arrays, functions as objects, constructors and the this keyword, prototypes and the prototype chain, classical and prototypal inheritance, scope, and closures. Examples are provided to demonstrate each concept.

javascriptprototypeconstructor
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core

JavaScript provides core functionality for web pages and applications. It has a C-like syntax and is dynamically typed. JavaScript code runs on both the client-side in web browsers and the server-side in environments like Node.js. It uses prototype-based inheritance where objects can inherit properties from object prototypes. New features are being added regularly through the ECMAScript specification. JavaScript allows DOM manipulation to modify web pages and event handling for user interactions.

javascript
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers

Slides from my talk at 4Developers conference in Warsaw More Domain-Driven Design related content at: https://domaincentric.net/

phpdesingtesting
GraphQL + TypeScript
a simple example
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
a simple example
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
plain old javascript
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));

Recommended for you

Understanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG JuneUnderstanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG June

You all might have downloaded and edited a lot of javascript. Other than merely changing syntax have you really understood its working or how the code was organised ? Have you ever thought of how the object oriented way of writing Javascript has been influencing the front end development? From a language that had helped developers write small validations and similar stuff, today, the object oriented javascript and its frameworks power the world becoming one of the most prominent language of all times.

coffee@dbgobject oriented javascriptdigital brand group
Esprima - What is that
Esprima - What is thatEsprima - What is that
Esprima - What is that

Esprima is a JavaScript parser that produces an abstract syntax tree (AST) from JavaScript code. The AST can then be traversed and analyzed to gather metadata and perform tasks like syntax validation, code completion, and instrumentation. Esprima supports ECMAScript 5.1 and below and can be used from browsers, Node.js, RequireJS, and other environments/packages. It parses code into a JSON AST and has options to customize the output.

esprimajavascriptparser
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima

Have you ever thought, “I wish it was easier to change JavaScript code programmatically?” Maybe you wanted to write or edit a configuration block in source code. Perhaps you wanted to generate customized algorithmic code. For many, this kind of thing seems inaccessible. The tools exist, though. In this talk, Stephen Vance will look at how he has used recast and esprima to edit and rewrite JavaScript code, leaving the untouched code completely intact, including whitespace and comments. At the end, you should have enough knowledge to be dangerous and start to write the next automatic programming, AI, take-over-the-world, self-improving software.

javascriptember.jsnode
oh no
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));
oh no
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));
oh no
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));
oh no
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));

Recommended for you

Javascript
JavascriptJavascript
Javascript

This document discusses JavaScript functions and objects. It explains that functions can return values, run code, and construct objects. It also discusses creating user-defined and built-in objects, accessing and adding properties, and inheritance through the prototype chain. Functions are first-class citizens that can be stored in variables, passed as arguments, and returned from other functions.

JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX

This document provides an overview and introduction to JavaScript basics and best practices. It covers what JavaScript is, how engines work, language features, and future developments like ES6. The basics section discusses types, variables, expressions, statements, functions, objects, and prototypical inheritance. The best practices section focuses on techniques for enterprise applications. The document is intended to help front-end developers learn JavaScript fundamentals.

javascriptbest practices
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K

The document discusses the goals and design of Zepto.js, a JavaScript framework for mobile web applications. It aims to have a very small codebase that is easy to use, extends native browser APIs, and avoids non-essential browser implementations. It provides a jQuery-like API but takes advantage of mobile features for better performance on small screens and devices with limited bandwidth.

htmlframeworkipad
✨ typescript ✨
typing it all out (by hand)
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
typing it all out
const DeviceNameComponent = props => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
}));
typing it all out (with typescript!)
const DeviceNameComponent = (props: Props) => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryInputVariables>
(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
})
);

Recommended for you

Advanced JavaScript Concepts
Advanced JavaScript ConceptsAdvanced JavaScript Concepts
Advanced JavaScript Concepts

Topics covered: Closure, Callback, Module Pattern, Cascading, Curry, Inheritance, Pseudo Classical, Prototype

javascript
Html and i_phone_mobile-2
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2

The document discusses HTML5 features such as new structural elements, form types, media elements, and JavaScript APIs for canvas, local storage, web databases, web workers, websockets, geolocation, and offline web applications. It also covers tools and techniques for building mobile web apps, including jQtouch for iPhone styling, feature detection over browser detection, and PhoneGap for compiling HTML5 apps to native mobile apps. While HTML5 provides many capabilities for mobile, native apps still have advantages in accessing device hardware and approval processes.

html5 iphone mobile javascript
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005

The document introduces dynamic languages and provides examples comparing Java and Groovy implementations of a filtering task. It discusses the benefits of Groovy, including its Java-like syntax, dynamic typing, built-in support for lists/maps/arrays, closures, and additional libraries that simplify APIs. Groovy aims to integrate well with Java while adding meta-programming capabilities. The document provides examples of common uses of Groovy and its features.

oraclescriptingjavascript
typing it all out with typescript!
const DeviceNameComponent = (props: Props) => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables>
(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
})
);
typing it all out with typescript!
const DeviceNameComponent = (props: Props) => {
return <div>Name: {props.graphqlValue.device.fullName}</div>;
}
export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables>
(DeviceNameComponent, () => ({
query: ...,
variables: {
deviceId: 202152006793,
},
})
);
this works pretty well, but...
a simple example
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}

Recommended for you

Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript

Folien des Talks "Einführung in TypeScript" von Lukas Gamper und Demian Holderegger. Ein Talk im Rahmen von @wwdtalks

programmingjavascripttypescript
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play

This document provides an overview of the Play! web framework for Java, including how it differs from traditional Java web development approaches by avoiding servlets, portlets, XML, EJBs, JSPs, and other technologies. It demonstrates creating a simple PDF generation application using Play!, including defining a model, controller, and view. The framework uses conventions over configuration and allows rapid development through features like automatic reloading of code changes and helpful error pages.

playjava
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax

Lets look at writing a new Struts 2 application from square one, using the Yahoo User Interface (YUI) Library on the front end, and Struts 2 on the backend. YUI provides the glitz and the glamour, and Struts 2 provides the dreary business logic, input validation, and text formatting.

yuiajax2
uh oh
query VehicleInfo($deviceId: int64, $durationMs: int64!, $endMs: int64) {
device(id: $deviceId) {
id
name
currentDriver {
id
name
}
setPoint: objectStat(statType: SET_POINT) {
intValue
}
vehicleActivityReport(duration: $durationMs, endTime: $endMs) {
tripEntries {
start { address }
end { address }
}
}
...DashcamLatestImage
...CurrentStats
}
}
uh oh uh oh
query VehicleInfo($deviceId: int64, $durationMs: int64!, $endMs: int64) {
device(id: $deviceId) {
id
name
currentDriver {
id
name
}
setPoint: objectStat(statType: SET_POINT) {
intValue
}
vehicleActivityReport(duration: $durationMs, endTime: $endMs) {
tripEntries {
start { address }
end { address }
}
}
...DashcamLatestImage
...CurrentStats
}
}
type VehicleInfoQueryVariables = {
deviceId: number,
durationMs: number,
endM?: number,
};
type VehicleInfoQueryResult = {
device: {
id: number,
name: string,
setPoint: Array<number>,
vehicleActivityReport: {
start: {
address: string,
},
end: {
address: string,
},
} >,
},
lastDashcamEvent: {
reportType: number,
triggerTime: number,
urls: {
still: string,
},
} | null,
},
hmm...
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
// generated_types.d.ts
type DeviceNameQueryInputVariables = {
id: number;
}
type DeviceNameQuery = {
device: {
name: string;
}
}
the graphql schema and typescript types can be mapped 1:1

Recommended for you

Dart Power Tools
Dart Power ToolsDart Power Tools
Dart Power Tools

Increase the speed of Dart software delivery with unit testing, code analysis, headless browser testing, cross-browser and mobile testing, continuous integration, and automated deployments.

dartsoftware developmentgoogle
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java

The document discusses embedded domain-specific languages (DSLs) for Java and provides two case studies: 1) Building SQL queries using a typesafe DSL that avoids errors and allows type inference. 2) Modifying Java bytecode using the ASM library to define a DSL for bytecode engineering.

typesafedsljava
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned

This document discusses lessons learned from implementing GraphQL APIs. It begins by describing some limitations of REST APIs, such as requiring multiple roundtrips to fetch nested data. GraphQL is introduced as an alternative that allows clients to specify exactly what data they need in a single request. The document then covers various GraphQL concepts like queries, mutations, and type systems. It also discusses best practices like using a schema-first approach, pagination support, and the DataLoader library to solve the N+1 problem. Testing GraphQL APIs and integrating with Relay are also briefly outlined. The overall message is that GraphQL is a good alternative to REST when clients have complex data needs.

javagraphqlfacebook
✨ apollo-codegen ✨
what is codegen?
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}

Recommended for you

Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax

Ajax is the web's hottest user interface. Struts is Java's most popular web framework. What happens when we put Ajax on Struts? In this session, we look at writing a new Struts 2 application from square one, using the Yahoo User Interface (YUI) Library on the front end, and Struts 2 on the backend. YUI provides the glitz and the glamour, and Struts 2 provides the dreary business logic, input validation, and text formatting. During the session, we will cover * How to integrate an Ajax UI with Struts 2 * Basics of the Yahoo User Interface (YUI) Library * Business services Struts can provide to an Ajax UI Who should attend: Ajax developers who would like to utilize Struts as a back-end, and Struts developers who would like to utilize Ajax as a front-end. To get the most from this session, some familiarity with an Ajax library, like YUI or Dojo, is helpful.

What’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth LaddWhat’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth Ladd

The modern web is feature-rich and fast, and Dart gives you a familiar and productive toolchain to scale up your code and apps. Come learn what's new with the Dart project, and how you can use the class-based language, rich built-in libraries, productive editor, package manager, and more. You want more? How about Web Components and a Future-based DOM! You'll see lots of demos, with special attention to the Dart-to-JavaScript compiler.

webseth laddjavascript
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans

- Groovy is a dynamic language that runs on the Java Virtual Machine and has seamless integration with Java. - Grails is an open source web application framework built on Groovy that follows conventions over configuration (CoC) and don't repeat yourself (DRY) principles. - Grails uses conventions to define a model-view-controller (MVC) structure and provides dynamic scaffolding to generate basic CRUD operations for domain classes.

how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
// generated_types.d.ts
type DeviceNameQueryInputVariables = {
id: number;
}
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}

Recommended for you

Day 1
Day 1Day 1
Day 1

This document provides an overview and introduction to building a basic fraction calculator app in Objective-C. It begins with an overview of the project architecture using the MVC pattern with a Fraction model class to represent fractions, a Calculator class to perform operations, and a ViewController class to manage the user interface. It then details the implementation of each class, including the Fraction class with methods for creating, modifying, and performing operations on fractions, the Calculator class for setting operands and performing operations, and the ViewController class for handling user interface events and updating the display.

node.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.io

How to control an AR.Drone and show data from its sensors on a real-time dashboard using node.js, socket.io and rickshaw.js.

node.jsnodejsdashboard
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack SupportAnd the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support

The document discusses Rack, a Ruby web server interface. It begins by explaining Rack's basic request/response cycle and common middleware components like Rack::Cache. It then covers integrating Rack into Rails applications and building custom middleware for tasks like exception handling and progressive caching. The document concludes by discussing some advanced Rack techniques and tools.

railsconf2009rackrails
how does codegen work?
# server_schema.graphql:
type Device {
name: string!;
}
type Root {
device(id: number!): Device;
}
# device_name_query.graphql:
query DeviceName($id: number!) {
device(id: $id) {
name
}
}
// generated_types.d.ts
type DeviceNameQuery = {
device: {
name: string;
}
}
$ ts-node codegen.ts > schema.d.ts
typing without typing
const DeviceNameComponent = (props: Props) => {
return <div>Name: {props.graphqlValue.device.name}</div>;
}
export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () =>
({
query: ...,
variables: {
id: 202152006793,
},
})
);
typing without typing
import { DeviceNameQuery, DeviceNameQueryVariables } from "./generated_types";
const DeviceNameComponent = (props: Props) => {
return <div>Name: {props.graphqlValue.device.name}</div>;
}
export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () =>
({
query: ...,
variables: {
id: 202152006793,
},
})
);

Recommended for you

GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang

1. Why we moving API from REST to Graphql? 2. What is Graphql? 3. Graphql in Golang (Why we choose Golang) 4. How to testing Graphql in Golang 5. Deploy Graphql application

graphqlgolangmodernweb
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013

This document provides a case study on using Node.js to build enterprise applications. It discusses how the author's company, ARHS Developments, migrated their testing data from multiple copies of MS Access to a centralized web application called Fatman built with Node.js, Express, MongoDB, and other technologies. Fatman uses Mongoose for object modeling and Async for asynchronous control flow. The document outlines Fatman's architecture and how it handles CRUD operations, schemas, middleware, and controllers to provide a more elegant and scalable solution compared to MS Access.

express.jsnode.jsmongoose.js
Dart and AngularDart
Dart and AngularDartDart and AngularDart
Dart and AngularDart

The document discusses Dart and AngularDart. It provides examples of how Dart code looks similar to languages like Java and C# but behaves like JavaScript. It demonstrates core Dart features like classes, functions, and type inference. It also shows how AngularJS concepts like controllers, directives and dependency injection map to AngularDart. Components are introduced as AngularDart's way to encapsulate reusable UI logic and templates. Discounts for Dart books and resources are listed at the end.

angularjsdartangulardart
data, end-to-end
shared type land
can we go further?
can we go further?

Recommended for you

GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training

The document discusses the Sahana Eden emergency development environment. It provides an overview of key concepts like the model-view-controller architecture and describes how to build a new module for incident reporting with models, controllers and views. Instructions are given for setting up the development environment and performing common tasks like defining data models, creating forms and joining resources.

JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices

MyApp provides JavaScript best practices including: 1) Using namespaces to avoid naming collisions and define packages like MyApp.string.utils for reusable functions. 2) Branching code during initialization or lazily on first use to handle browser differences efficiently. 3) Passing configuration as an object instead of many parameters to simplify function calls. 4) Defining private methods and properties using closures to encapsulate code. 5) Employing self-executing functions for one-time initialization tasks. 6) Allowing method chaining for readability when calling several related methods.

patternjavascriptui
Strongly typed web applications by Adel Salakh
 Strongly typed web applications by Adel Salakh   Strongly typed web applications by Adel Salakh
Strongly typed web applications by Adel Salakh

The introduction of typed JavaScript dialects such as TypeScript and Flow changed the way we make web applications. Armed with a type-checker developers can now be more confident in their code. Despite this, often critical parts of web applications suffer from poor type coverage and weak types. This leads to whole classes of bugs and problems. We will demonstrate different techniques for preventing this and show you how to make sure you are getting the most out of your types and the type-checker.

golang types
# graphqlschema/device.go
type Device struct {
Id int64
Name string
OrganizationId int64
// ...
}
type deviceArgs struct { Id int64 }
root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) {
user, err := db.Device.Get(...)
return user, err
})
golang types
# graphqlschema/device.go
type Device struct {
Id int64
Name string
OrganizationId int64
// ...
}
type deviceArgs struct { Id int64 }
root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) {
user, err := db.Device.Get(...)
return user, err
})
# server_schema.graphql:
type Device {
name: string!;
id: number;
// ...
}
type Root {
device(id: number!): Device;
}
the go type definitions and graphql schema can also be mapped 1:1
✨ thunder + reflection ✨

Recommended for you

Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud

The document discusses managing GraphQL servers with AWS Fargate and Prisma Cloud. It begins with introductions to GraphQL and the core mechanics of a GraphQL server, including the schema, resolver functions, and setup. It then demonstrates building GraphQL servers with Prisma, and managing them using AWS Fargate and the Prisma Cloud service, which provides workflows for server management. Live demonstrations are included.

graphqlapicloud
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf

CSS chapter 1 notes

L-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptxL-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptx

..

golang types
# graphqlschema/device.go
type Device struct {
Id int64
Name string
OrganizationId int64
// ...
}
type deviceArgs struct { Id int64 }
root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) {
user, err := db.Device.Get(...)
return user, err
})
golang types
# graphqlschema/device.go
type Device struct {
Id int64
Name string
OrganizationId int64
// ...
}
type deviceArgs struct { Id int64 }
root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) {
user, err := db.Device.Get(...)
return user, err
})
# server_schema.graphql:
type Root {
device(id: number!): Device;
}
golang types
# graphqlschema/device.go
type Device struct {
Id int64
Name string
OrganizationId int64
// ...
}
type deviceArgs struct { Id int64 }
root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) {
user, err := db.Device.Get(...)
return user, err
})
# server_schema.graphql:
type Device {
name: string!;
id: number;
// ...
}
$ go run schema_generator.go > schema.graphql

Recommended for you

GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdfGUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf

Foreign trade and customs

Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...

For Ad Post Contact :- adityaroy0215@gmail.com Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel With 100% Satisfaction

LeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdfLeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdf

Pyspark

shared type land
shared type land
can we go further?
can we go further?

Recommended for you

MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K SchemeMSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme

Syllabus

msbte syllabusxcxzcxzcxzxccxzczc
Chlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptxChlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptx

Chlorine and Nitric acid

Exploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative ReviewExploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative Review

Image recognition, which comes under Artificial Intelligence (AI) is a critical aspect of computer vision, enabling computers or other computing devices to identify and categorize objects within images. Among numerous fields of life, food processing is an important area, in which image processing plays a vital role, both for producers and consumers. This study focuses on the binary classification of strawberries, where images are sorted into one of two categories. We Utilized a dataset of strawberry images for this study; we aim to determine the effectiveness of different models in identifying whether an image contains strawberries. This research has practical applications in fields such as agriculture and quality control. We compared various popular deep learning models, including MobileNetV2, Convolutional Neural Networks (CNN), and DenseNet121, for binary classification of strawberry images. The accuracy achieved by MobileNetV2 is 96.7%, CNN is 99.8%, and DenseNet121 is 93.6%. Through rigorous testing and analysis, our results demonstrate that CNN outperforms the other models in this task. In the future, the deep learning models can be evaluated on a richer and larger number of images (datasets) for better/improved results.

image recognitiondeep learning
can we go further?
protobuf go generation
message TemperatureStat {
int64 time = 1;
double double_value = 3;
}
surprise! protobufs and go types can also, also be mapped 1:1
✨ protoc-gen-go ✨

Recommended for you

21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY

VLSI design 21ec63 MOS TRANSISTOR THEORY

Introduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer NetworkingIntroduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer Networking

An Internet Protocol address (IP address) is a logical numeric address that is assigned to every single computer, printer, switch, router, tablets, smartphones or any other device that is part of a TCP/IP-based network. Types of IP address- Dynamic means "constantly changing “ .dynamic IP addresses aren't more powerful, but they can change. Static means staying the same. Static. Stand. Stable. Yes, static IP addresses don't change. Most IP addresses assigned today by Internet Service Providers are dynamic IP addresses. It's more cost effective for the ISP and you.

networkinginternetcommunication
Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.

Trends in CAD CAM

protobuf go generation
message TemperatureStat {
int64 time = 1;
double double_value = 3;
}
protobuf go generation
message TemperatureStat {
int64 time = 1;
double double_value = 3;
}
type TemperatureStat struct {
Time int64
DoubleValue float64
}
$ protoc-gen-go > stat.pb.go
shared type land

Recommended for you

OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdfOCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf

OCS Training Institute is pleased to co-operate with a Global provider of Rig Inspection/Audits, Commission-ing, Compliance & Acceptance as well as & Engineering for Offshore Drilling Rigs, to deliver Drilling Rig Inspec-tion Workshops (RIW) which teaches the inspection & maintenance procedures required to ensure equipment integrity. Candidates learn to implement the relevant standards & understand industry requirements so that they can verify the condition of a rig’s equipment & improve safety, thus reducing the number of accidents and protecting the asset.

traininginspectiontrainingcourse
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt

Biomass energy

rujan timsina
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE DonatoCONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato

"Le potenzialità del Digital Twin per il settore Water"

shared type land
type once, benefit everywhere.
schemas and typings can never be out of sync.
type once, benefit everywhere.
autocomplete, go to def, outlines in your {.pb.go, .go, .graphql, .tsx}.
type once, benefit everywhere.
a type can travel from the hardware device to the web application.

Recommended for you

Germany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptxGermany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptx

offshore wind

Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model SafePaharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe

Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe

Software Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project ManagementSoftware Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project Management

Introduction to Project Management: Introduction, Project and Importance of Project Management, Contract Management, Activities Covered by Software Project Management, Plans, Methods and Methodologies, some ways of categorizing Software Projects, Stakeholders, Setting Objectives, Business Case, Project Success and Failure, Management and Management Control, Project Management life cycle, Traditional versus Modern Project Management Practices.

project managementcontract managementmanagement
type once, benefit everywhere.
available in an open source repository near you.
type once, benefit everywhere.
a powerful default. let the computer do the busy work for you.
thank you!
twitter.com/stephencwan
github.com/samsarahq/thunder
questions?
bonus slides

Recommended for you

GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdfGUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf

Energy market

Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...

This study primarily aimed to determine the best practices of clothing businesses to use it as a foundation of strategic business advancements. Moreover, the frequency with which the business's best practices are tracked, which best practices are the most targeted of the apparel firms to be retained, and how does best practices can be used as strategic business advancement. The respondents of the study is the owners of clothing businesses in Talavera, Nueva Ecija. Data were collected and analyzed using a quantitative approach and utilizing a descriptive research design. Unveiling best practices of clothing businesses as a foundation for strategic business advancement through statistical analysis: frequency and percentage, and weighted means analyzing the data in terms of identifying the most to the least important performance indicators of the businesses among all of the variables. Based on the survey conducted on clothing businesses in Talavera, Nueva Ecija, several best practices emerge across different areas of business operations. These practices are categorized into three main sections, section one being the Business Profile and Legal Requirements, followed by the tracking of indicators in terms of Product, Place, Promotion, and Price, and Key Performance Indicators (KPIs) covering finance, marketing, production, technical, and distribution aspects. The research study delved into identifying the core best practices of clothing businesses, serving as a strategic guide for their advancement. Through meticulous analysis, several key findings emerged. Firstly, prioritizing product factors, such as maintaining optimal stock levels and maximizing customer satisfaction, was deemed essential for driving sales and fostering loyalty. Additionally, selecting the right store location was crucial for visibility and accessibility, directly impacting footfall and sales. Vigilance towards competitors and demographic shifts was highlighted as essential for maintaining relevance. Understanding the relationship between marketing spend and customer acquisition proved pivotal for optimizing budgets and achieving a higher ROI. Strategic analysis of profit margins across clothing items emerged as crucial for maximizing profitability and revenue. Creating a positive customer experience, investing in employee training, and implementing effective inventory management practices were also identified as critical success factors. In essence, these findings underscored the holistic approach needed for sustainable growth in the clothing business, emphasizing the importance of product management, marketing strategies, customer experience, and operational efficiency.

best practicesclothing businesskey performance indicators
Biology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtuBiology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtu

BBOC407

the tools are there! we just need to add a little grease.
Never Type
Anything
Type TypeScript from
GraphQL
Type GraphQL from
Go
Type Go from
Protobufs
Type mapping is not always 1:1
● Union Types (supported ts, graphql, but not go)
● Enums Types (supported in ts, graphql, but not go)
● Number Types (float64 only in javascript)
○ A bit of a type safety problem, but we haven't hit the bounds of float64 in production yet.
○ We could also have a different over the wire representation for dealing with this
● Nullable Types (pointer types are not quite option types)
○ Error | Null | Value vs. (Null | Value, Error)
apollo-codegen: Autocomplete

Recommended for you

what do we get out of static type checking?
● Type Safety
● Deployment Safety
● Autocomplete, Go to Definition
GraphQL: Deployment Safety
GraphQL: Deployment Safety
protobufs cont. (grpc systems behind graphql)
rpc UpdateDriverSafetyEvents(UpdateDriverSafetyEventsRequest) returns (UpdateDriverSafetyEventsResponse) {}
message DriverSafetyEventsRequest {
int64 org_id = 1;
repeated int64 device_ids = 2;
int64 end_ms = 3;
int64 start_ms = 4;
}
message DriverSafetyEvent {
int64 device_id = 1;
int64 harsh_event_ms = 2;
HarshEvent harsh_event = 3;
SafetyEventMetadataInboxState state = 4;
}
message DriverSafetyEventsRequest {
int64 org_id = 1;
repeated int64 device_ids = 2;
int64 end_ms = 3;

Recommended for you

can we make this nicer?
Demands: more codegen
● What else can we do?
● extracting golang comments at compile time
● apollo-codegen with a go compilation target (i.e. for a graphql consumer api
service)
Demands: Better Type Interoperability
● Steps for code generation are still a little hard
● Need better ways of providing types across the board
● Providing Types: typescript/#3136
Types End-to-End @ samsara

Recommended for you

Types End-to-End @ samsara

More Related Content

What's hot

Java Script Best Practices
Java Script Best PracticesJava Script Best Practices
Java Script Best Practices
Enrique Juan de Dios
 
Beginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScriptBeginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScript
Stoyan Stefanov
 
JavaScript 2016 for C# Developers
JavaScript 2016 for C# DevelopersJavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
Rick Beerendonk
 
All things that are not code
All things that are not codeAll things that are not code
All things that are not code
Mobile Delivery Days
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
Ingvar Stepanyan
 
Advanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScriptAdvanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScript
ecker
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
Donald Sipe
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
Stoyan Stefanov
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
François Sarradin
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
Kacper Gunia
 
Understanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG JuneUnderstanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG June
Deepu S Nath
 
Esprima - What is that
Esprima - What is thatEsprima - What is that
Esprima - What is that
Abhijeet Pawar
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima
Stephen Vance
 
Javascript
JavascriptJavascript
Javascript
theacadian
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
 
Advanced JavaScript Concepts
Advanced JavaScript ConceptsAdvanced JavaScript Concepts
Advanced JavaScript Concepts
Naresh Kumar
 
Html and i_phone_mobile-2
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2
tonvanbart
 

What's hot (20)

Java Script Best Practices
Java Script Best PracticesJava Script Best Practices
Java Script Best Practices
 
Beginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScriptBeginning Object-Oriented JavaScript
Beginning Object-Oriented JavaScript
 
JavaScript 2016 for C# Developers
JavaScript 2016 for C# DevelopersJavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
 
All things that are not code
All things that are not codeAll things that are not code
All things that are not code
 
AST - the only true tool for building JavaScript
AST - the only true tool for building JavaScriptAST - the only true tool for building JavaScript
AST - the only true tool for building JavaScript
 
Advanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScriptAdvanced Object-Oriented JavaScript
Advanced Object-Oriented JavaScript
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
PHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4DevelopersPHPSpec - the only Design Tool you need - 4Developers
PHPSpec - the only Design Tool you need - 4Developers
 
Understanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG JuneUnderstanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG June
 
Esprima - What is that
Esprima - What is thatEsprima - What is that
Esprima - What is that
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UXJavaScript Basics and Best Practices - CC FE & UX
JavaScript Basics and Best Practices - CC FE & UX
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
Advanced JavaScript Concepts
Advanced JavaScript ConceptsAdvanced JavaScript Concepts
Advanced JavaScript Concepts
 
Html and i_phone_mobile-2
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2
 

Similar to Types End-to-End @ samsara

Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
Tugdual Grall
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
Demian Holderegger
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
Clinton Dreisbach
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
Ted Husted
 
Dart Power Tools
Dart Power ToolsDart Power Tools
Dart Power Tools
Matt Norris
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
Jevgeni Kabanov
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
MarcinStachniuk
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
Ted Husted
 
What’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth LaddWhat’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth Ladd
jaxconf
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
Carol McDonald
 
Day 1
Day 1Day 1
node.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.io
Steven Beeckman
 
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack SupportAnd the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
Ben Scofield
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
Bo-Yi Wu
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
Laurent_VB
 
Dart and AngularDart
Dart and AngularDartDart and AngularDart
Dart and AngularDart
Loc Nguyen
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
AidIQ
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
Siarhei Barysiuk
 
Strongly typed web applications by Adel Salakh
 Strongly typed web applications by Adel Salakh   Strongly typed web applications by Adel Salakh
Strongly typed web applications by Adel Salakh
OdessaJS Conf
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Nikolas Burk
 

Similar to Types End-to-End @ samsara (20)

Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Dart Power Tools
Dart Power ToolsDart Power Tools
Dart Power Tools
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
What’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth LaddWhat’s new in Google Dart - Seth Ladd
What’s new in Google Dart - Seth Ladd
 
Agile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with NetbeansAgile web development Groovy Grails with Netbeans
Agile web development Groovy Grails with Netbeans
 
Day 1
Day 1Day 1
Day 1
 
node.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.ionode.js and the AR.Drone: building a real-time dashboard using socket.io
node.js and the AR.Drone: building a real-time dashboard using socket.io
 
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack SupportAnd the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
 
Dart and AngularDart
Dart and AngularDartDart and AngularDart
Dart and AngularDart
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Strongly typed web applications by Adel Salakh
 Strongly typed web applications by Adel Salakh   Strongly typed web applications by Adel Salakh
Strongly typed web applications by Adel Salakh
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
 

Recently uploaded

22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
sharvaridhokte
 
L-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptxL-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptx
naseki5964
 
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdfGUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
ProexportColombia1
 
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Miss Khusi #V08
 
LeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdfLeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdf
pavanaroshni1977
 
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K SchemeMSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
Anwar Patel
 
Chlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptxChlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptx
yadavsuyash008
 
Exploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative ReviewExploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative Review
sipij
 
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
PradeepKumarSK3
 
Introduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer NetworkingIntroduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer Networking
Md.Shohel Rana ( M.Sc in CSE Khulna University of Engineering & Technology (KUET))
 
Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.
Tool and Die Tech
 
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdfOCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
Muanisa Waras
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
RujanTimsina1
 
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE DonatoCONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
Servizi a rete
 
Germany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptxGermany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptx
rebecca841358
 
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model SafePaharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
aarusi sexy model
 
Software Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project ManagementSoftware Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project Management
Prakhyath Rai
 
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdfGUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
ProexportColombia1
 
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
IJAEMSJORNAL
 
Biology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtuBiology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtu
santoshpatilrao33
 

Recently uploaded (20)

22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
 
L-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptxL-3536-Cost Benifit Analysis in ESIA.pptx
L-3536-Cost Benifit Analysis in ESIA.pptx
 
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdfGUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
GUIA_LEGAL_CHAPTER_4_FOREIGN TRADE CUSTOMS.pdf
 
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
Phone Us ❤ X000XX000X ❤ #ℂall #gIRLS In Chennai By Chenai @ℂall @Girls Hotel ...
 
LeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdfLeetCode Database problems solved using PySpark.pdf
LeetCode Database problems solved using PySpark.pdf
 
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K SchemeMSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme MSBTE K Scheme
 
Chlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptxChlorine and Nitric Acid application, properties, impacts.pptx
Chlorine and Nitric Acid application, properties, impacts.pptx
 
Exploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative ReviewExploring Deep Learning Models for Image Recognition: A Comparative Review
Exploring Deep Learning Models for Image Recognition: A Comparative Review
 
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
21EC63_Module1B.pptx VLSI design 21ec63 MOS TRANSISTOR THEORY
 
Introduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer NetworkingIntroduction to IP address concept - Computer Networking
Introduction to IP address concept - Computer Networking
 
Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.Trends in Computer Aided Design and MFG.
Trends in Computer Aided Design and MFG.
 
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdfOCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
OCS Training - Rig Equipment Inspection - Advanced 5 Days_IADC.pdf
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
 
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE DonatoCONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
CONVEGNO DA IRETI 18 giugno 2024 | PASQUALE Donato
 
Germany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptxGermany Offshore Wind 010724 RE (1) 2 test.pptx
Germany Offshore Wind 010724 RE (1) 2 test.pptx
 
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model SafePaharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
Paharganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Arti Singh Top Model Safe
 
Software Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project ManagementSoftware Engineering and Project Management - Introduction to Project Management
Software Engineering and Project Management - Introduction to Project Management
 
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdfGUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
GUIA_LEGAL_CHAPTER-9_COLOMBIAN ELECTRICITY (1).pdf
 
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
Best Practices of Clothing Businesses in Talavera, Nueva Ecija, A Foundation ...
 
Biology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtuBiology for computer science BBOC407 vtu
Biology for computer science BBOC407 vtu
 

Types End-to-End @ samsara

  • 1. Types End-to-end More Features And Fewer Bugs with GraphQL
  • 8. mo' features, mo' problems.
  • 9. GraphQL Schema type Device { name: string!; id: number!; currentDriver: Driver; locations: [Location!]!; // ... } type Root { device(id: number!): Device; }
  • 10. mo' features, mo' problems. (mo' static types)
  • 12. safety static verification at compile time and deployment editor tooling autocomplete, go to definition, type hints
  • 14. a simple example # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; }
  • 15. a simple example # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 16. plain old javascript const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 17. oh no const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 18. oh no const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 19. oh no const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 20. oh no const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 22. typing it all out (by hand) # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 23. typing it all out const DeviceNameComponent = props => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL(DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }));
  • 24. typing it all out (with typescript!) const DeviceNameComponent = (props: Props) => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryInputVariables> (DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }) );
  • 25. typing it all out with typescript! const DeviceNameComponent = (props: Props) => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }) );
  • 26. typing it all out with typescript! const DeviceNameComponent = (props: Props) => { return <div>Name: {props.graphqlValue.device.fullName}</div>; } export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () => ({ query: ..., variables: { deviceId: 202152006793, }, }) );
  • 27. this works pretty well, but...
  • 28. a simple example # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 29. uh oh query VehicleInfo($deviceId: int64, $durationMs: int64!, $endMs: int64) { device(id: $deviceId) { id name currentDriver { id name } setPoint: objectStat(statType: SET_POINT) { intValue } vehicleActivityReport(duration: $durationMs, endTime: $endMs) { tripEntries { start { address } end { address } } } ...DashcamLatestImage ...CurrentStats } }
  • 30. uh oh uh oh query VehicleInfo($deviceId: int64, $durationMs: int64!, $endMs: int64) { device(id: $deviceId) { id name currentDriver { id name } setPoint: objectStat(statType: SET_POINT) { intValue } vehicleActivityReport(duration: $durationMs, endTime: $endMs) { tripEntries { start { address } end { address } } } ...DashcamLatestImage ...CurrentStats } } type VehicleInfoQueryVariables = { deviceId: number, durationMs: number, endM?: number, }; type VehicleInfoQueryResult = { device: { id: number, name: string, setPoint: Array<number>, vehicleActivityReport: { start: { address: string, }, end: { address: string, }, } >, }, lastDashcamEvent: { reportType: number, triggerTime: number, urls: { still: string, }, } | null, },
  • 31. hmm... # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } } // generated_types.d.ts type DeviceNameQueryInputVariables = { id: number; } type DeviceNameQuery = { device: { name: string; } }
  • 32. the graphql schema and typescript types can be mapped 1:1
  • 35. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 36. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 37. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } } // generated_types.d.ts type DeviceNameQueryInputVariables = { id: number; }
  • 38. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 39. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 40. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } }
  • 41. how does codegen work? # server_schema.graphql: type Device { name: string!; } type Root { device(id: number!): Device; } # device_name_query.graphql: query DeviceName($id: number!) { device(id: $id) { name } } // generated_types.d.ts type DeviceNameQuery = { device: { name: string; } }
  • 42. $ ts-node codegen.ts > schema.d.ts
  • 43. typing without typing const DeviceNameComponent = (props: Props) => { return <div>Name: {props.graphqlValue.device.name}</div>; } export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () => ({ query: ..., variables: { id: 202152006793, }, }) );
  • 44. typing without typing import { DeviceNameQuery, DeviceNameQueryVariables } from "./generated_types"; const DeviceNameComponent = (props: Props) => { return <div>Name: {props.graphqlValue.device.name}</div>; } export default connectGraphQL<Props, DeviceNameQuery, DeviceNameQueryVariables> (DeviceNameComponent, () => ({ query: ..., variables: { id: 202152006793, }, }) );
  • 47. can we go further?
  • 48. can we go further?
  • 49. golang types # graphqlschema/device.go type Device struct { Id int64 Name string OrganizationId int64 // ... } type deviceArgs struct { Id int64 } root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) { user, err := db.Device.Get(...) return user, err })
  • 50. golang types # graphqlschema/device.go type Device struct { Id int64 Name string OrganizationId int64 // ... } type deviceArgs struct { Id int64 } root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) { user, err := db.Device.Get(...) return user, err }) # server_schema.graphql: type Device { name: string!; id: number; // ... } type Root { device(id: number!): Device; }
  • 51. the go type definitions and graphql schema can also be mapped 1:1
  • 52. ✨ thunder + reflection ✨
  • 53. golang types # graphqlschema/device.go type Device struct { Id int64 Name string OrganizationId int64 // ... } type deviceArgs struct { Id int64 } root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) { user, err := db.Device.Get(...) return user, err })
  • 54. golang types # graphqlschema/device.go type Device struct { Id int64 Name string OrganizationId int64 // ... } type deviceArgs struct { Id int64 } root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) { user, err := db.Device.Get(...) return user, err }) # server_schema.graphql: type Root { device(id: number!): Device; }
  • 55. golang types # graphqlschema/device.go type Device struct { Id int64 Name string OrganizationId int64 // ... } type deviceArgs struct { Id int64 } root.FieldFunc("device", func(ctx context.Context, args userArgs) (*Device, error) { user, err := db.Device.Get(...) return user, err }) # server_schema.graphql: type Device { name: string!; id: number; // ... }
  • 56. $ go run schema_generator.go > schema.graphql
  • 59. can we go further?
  • 60. can we go further?
  • 61. can we go further?
  • 62. protobuf go generation message TemperatureStat { int64 time = 1; double double_value = 3; }
  • 63. surprise! protobufs and go types can also, also be mapped 1:1
  • 65. protobuf go generation message TemperatureStat { int64 time = 1; double double_value = 3; }
  • 66. protobuf go generation message TemperatureStat { int64 time = 1; double double_value = 3; } type TemperatureStat struct { Time int64 DoubleValue float64 }
  • 67. $ protoc-gen-go > stat.pb.go
  • 70. type once, benefit everywhere. schemas and typings can never be out of sync.
  • 71. type once, benefit everywhere. autocomplete, go to def, outlines in your {.pb.go, .go, .graphql, .tsx}.
  • 72. type once, benefit everywhere. a type can travel from the hardware device to the web application.
  • 73. type once, benefit everywhere. available in an open source repository near you.
  • 74. type once, benefit everywhere. a powerful default. let the computer do the busy work for you.
  • 77. the tools are there! we just need to add a little grease.
  • 78. Never Type Anything Type TypeScript from GraphQL Type GraphQL from Go Type Go from Protobufs
  • 79. Type mapping is not always 1:1 ● Union Types (supported ts, graphql, but not go) ● Enums Types (supported in ts, graphql, but not go) ● Number Types (float64 only in javascript) ○ A bit of a type safety problem, but we haven't hit the bounds of float64 in production yet. ○ We could also have a different over the wire representation for dealing with this ● Nullable Types (pointer types are not quite option types) ○ Error | Null | Value vs. (Null | Value, Error)
  • 81. what do we get out of static type checking? ● Type Safety ● Deployment Safety ● Autocomplete, Go to Definition
  • 84. protobufs cont. (grpc systems behind graphql) rpc UpdateDriverSafetyEvents(UpdateDriverSafetyEventsRequest) returns (UpdateDriverSafetyEventsResponse) {} message DriverSafetyEventsRequest { int64 org_id = 1; repeated int64 device_ids = 2; int64 end_ms = 3; int64 start_ms = 4; } message DriverSafetyEvent { int64 device_id = 1; int64 harsh_event_ms = 2; HarshEvent harsh_event = 3; SafetyEventMetadataInboxState state = 4; } message DriverSafetyEventsRequest { int64 org_id = 1; repeated int64 device_ids = 2; int64 end_ms = 3;
  • 85. can we make this nicer?
  • 86. Demands: more codegen ● What else can we do? ● extracting golang comments at compile time ● apollo-codegen with a go compilation target (i.e. for a graphql consumer api service)
  • 87. Demands: Better Type Interoperability ● Steps for code generation are still a little hard ● Need better ways of providing types across the board ● Providing Types: typescript/#3136

Editor's Notes

  1. i am stephen frontend infra, including graphql
  2. We really view ourselves as a platform company - there are so many applications we can build on top of our hardware and software.
  3. So behind the scenes, what does this look like? We have our gateway device that can run go programs, It sends its data over to our go-based backend services, and those services are abstracted behind our GraphQL layer, which ends up serving our react web application, and react native mobile application, written in typescript
  4. GraphQL becomes our one true language from the backend
  5. Going back a little, we have a lot of different types of data flowing through the system that need to make it on to the page. A vehicle might have a dash cam installed taking videos, it might have a temperature sensor for monitoring food shipments, it might be taking gps speed measurements - the relationships between all of this can get complicated And that's where we think a type system has a really big impact
  6. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  7. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  8. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  9. Mentioned earlier that we use GraphQL and TypeScript Let's look at an example where this might be useful
  10. What's wrong? (It's hard to tell)
  11. query inputs are checked
  12. query inputs are checked
  13. query inputs are checked
  14. query inputs are checked
  15. query inputs are checked
  16. query inputs are checked
  17. query inputs are checked
  18. query inputs are checked
  19. query inputs are checked
  20. but it's kind of disatisfying
  21. query inputs are checked
  22. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  23. Read the code for this Draw a diagram for inputs/outputs "mapping" type systems
  24. run it on the command line
  25. reflection: program reflecting, asking about itself
  26. query inputs are checked
  27. Now we know that our graphql service and our frontend will always agree, with no manual steps required Autocomplete, compile time checking in the frontend
  28. Highlight GraphQL service / web client as type safe Where does the graphql schema come from?
  29. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  30. Highlight GraphQL service / web client as type safe Where does the graphql schema come from?
  31. reflection: program reflecting, asking about itself
  32. reflection: program reflecting, asking about itself
  33. Highlight GraphQL service / web client as type safe Where does the graphql schema come from?
  34. Highlight GraphQL service / web client / Backend as type safe
  35. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  36. Highlight GraphQL service / web client / Backend as type safe
  37. Highlight GraphQL service / web client / Backend as type safe Show some code snippets (which are handwritten? which are generatede)
  38. Find (some) bugs without executing the program Matters when you write a ton of features, lots of people doing everything (x functional teams) We have lots of teams working on features, some that overlap. Maintaining consistency is important.
  39. reflection: program reflecting, asking about itself
  40. reflection: program reflecting, asking about itself
  41. Highlight GraphQL service / web client / Backend as type safe Show some code snippets (which are handwritten? which are generatede)
  42. Single shared type defintion, for any piece of data Generate defintions, so developers don't need to
  43. entire class of problem
  44. not novel - everything is available in open source (protobufs, thunder, apollo-codegen, typescript) we encourage you to try this out. we look forward to ???
  45. really powerful default when working across the stack we encourage you to try this out. there's a little grease involved,
  46. reflection: program reflecting, asking about itself really powerful default individual steps not really novel apollo-codegen star count apollo-client example documentation
  47. It's still possible to ship buggy changes to business logic But we've eliminated an entire source of potential errors from production
  48. It's still possible to ship buggy changes to business logic But we've eliminated an entire source of potential errors from production