SlideShare ist ein Scribd-Unternehmen logo

Dev Day Andreas Roth.pdf

Reflection in TypeScript: Wie wir die Schlucht zwischen Laufzeit und Compile-Zeit endlich überbrücken können

1 von 35
Downloaden Sie, um offline zu lesen
Andreas Roth
§ Dresden, Germany
§ Development Lead @ esveo
§ We help developers to accelerate their
TypeScript projects
Andreas Roth
@andrewgreenh
andreas.roth@esveo.com
@andrewgreenh
@andrewgreenh
Code, der anderen Code im gleichen
System inspizieren und auch u.U.
auch modifizieren kann.
import java.lang.reflect.Field;
class Person {
int age;
String name;
}
class Main {
public static void main(String args[]) {
Field[] allFields = Person.class.getDeclaredFields();
for (Field field : allFields) {
System.out.println(
field.getName() +
" " +
field.getType()
);
}
}
}
@andrewgreenh
import java.lang.reflect.Field;
class Person {
int age;
String name;
}
class Main {
public static void main(String args[]) {
Field[] allFields = Person.class.getDeclaredFields();
for (Field field : allFields) {
System.out.println(
field.getName() +
" " +
field.getType()
);
}
}
}
@andrewgreenh

Recomendados

A evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidA evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidRodrigo de Souza Castro
 
Best of build 2021 - C# 10 & .NET 6
Best of build 2021 -  C# 10 & .NET 6Best of build 2021 -  C# 10 & .NET 6
Best of build 2021 - C# 10 & .NET 6Moaid Hathot
 
Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNikolas Burk
 
[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)[2019-07] GraphQL in depth (serverside)
[2019-07] GraphQL in depth (serverside)croquiscom
 

Más contenido relacionado

Ähnlich wie Dev Day Andreas Roth.pdf

Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...
Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...
Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...Codemotion
 
Retour sur la Microsoft //Build 2018
Retour sur la Microsoft //Build 2018Retour sur la Microsoft //Build 2018
Retour sur la Microsoft //Build 2018Timothé Larivière
 
Lombokの紹介
Lombokの紹介Lombokの紹介
Lombokの紹介onozaty
 
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 JavaJevgeni Kabanov
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in javaHarish Gyanani
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
Cutting through the fog of microservices: lightsabers optional
Cutting through the fog of microservices: lightsabers optionalCutting through the fog of microservices: lightsabers optional
Cutting through the fog of microservices: lightsabers optionalGraham Charters
 
NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020Thodoris Bais
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining ClassesIntro C# Book
 
Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Andrew Petryk
 
Android Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageAndroid Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageDroidConTLV
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesomePiotr Miazga
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
Writing good code
Writing good codeWriting good code
Writing good codeIshti Gupta
 
Aprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJSAprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJSLoiane Groner
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionHans Höchtl
 

Ähnlich wie Dev Day Andreas Roth.pdf (20)

Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...
Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...
Developing and maintaining a Java GraphQL back-end: The less obvious - Bojan ...
 
Retour sur la Microsoft //Build 2018
Retour sur la Microsoft //Build 2018Retour sur la Microsoft //Build 2018
Retour sur la Microsoft //Build 2018
 
Lombokの紹介
Lombokの紹介Lombokの紹介
Lombokの紹介
 
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
 
Simple class and object examples in java
Simple class and object examples in javaSimple class and object examples in java
Simple class and object examples in java
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
Cutting through the fog of microservices: lightsabers optional
Cutting through the fog of microservices: lightsabers optionalCutting through the fog of microservices: lightsabers optional
Cutting through the fog of microservices: lightsabers optional
 
NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
 
Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)Generic Types in Java (for ArtClub @ArtBrains Software)
Generic Types in Java (for ArtClub @ArtBrains Software)
 
Android Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageAndroid Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, Vonage
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesome
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Green dao 3.0
Green dao 3.0Green dao 3.0
Green dao 3.0
 
Writing good code
Writing good codeWriting good code
Writing good code
 
Aprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJSAprimorando sua Aplicação com Ext JS 4 - BrazilJS
Aprimorando sua Aplicação com Ext JS 4 - BrazilJS
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 

Mehr von CarolinaMatthies

Dev-Day-Keynote-Folien Leena Simon.pdf
Dev-Day-Keynote-Folien Leena Simon.pdfDev-Day-Keynote-Folien Leena Simon.pdf
Dev-Day-Keynote-Folien Leena Simon.pdfCarolinaMatthies
 
Dev Day Johannes Dienst.pdf
Dev Day Johannes Dienst.pdfDev Day Johannes Dienst.pdf
Dev Day Johannes Dienst.pdfCarolinaMatthies
 
DevDay_Christian Mauth.pdf
DevDay_Christian Mauth.pdfDevDay_Christian Mauth.pdf
DevDay_Christian Mauth.pdfCarolinaMatthies
 
Dev Day Stephan Pirnbaum.pdf
Dev Day Stephan Pirnbaum.pdfDev Day Stephan Pirnbaum.pdf
Dev Day Stephan Pirnbaum.pdfCarolinaMatthies
 

Mehr von CarolinaMatthies (8)

Dev-Day-Keynote-Folien Leena Simon.pdf
Dev-Day-Keynote-Folien Leena Simon.pdfDev-Day-Keynote-Folien Leena Simon.pdf
Dev-Day-Keynote-Folien Leena Simon.pdf
 
Dev Day Johannes Dienst.pdf
Dev Day Johannes Dienst.pdfDev Day Johannes Dienst.pdf
Dev Day Johannes Dienst.pdf
 
DevDay_Mirko Seifert.pdf
DevDay_Mirko Seifert.pdfDevDay_Mirko Seifert.pdf
DevDay_Mirko Seifert.pdf
 
DevDay_Christian Mauth.pdf
DevDay_Christian Mauth.pdfDevDay_Christian Mauth.pdf
DevDay_Christian Mauth.pdf
 
Dev Day Stephan Pirnbaum.pdf
Dev Day Stephan Pirnbaum.pdfDev Day Stephan Pirnbaum.pdf
Dev Day Stephan Pirnbaum.pdf
 
Vom Umgang mit Fehlern
Vom Umgang mit FehlernVom Umgang mit Fehlern
Vom Umgang mit Fehlern
 
Dev Day Maksim Gudow.pdf
Dev Day Maksim Gudow.pdfDev Day Maksim Gudow.pdf
Dev Day Maksim Gudow.pdf
 
Dev Day Jiří Kraml.pdf
Dev Day Jiří Kraml.pdfDev Day Jiří Kraml.pdf
Dev Day Jiří Kraml.pdf
 

Último

Chapter 20 Firms in IGCSE economics presentation
Chapter 20  Firms in IGCSE  economics presentationChapter 20  Firms in IGCSE  economics presentation
Chapter 20 Firms in IGCSE economics presentationSamandarbekNumonov
 
Monthly HSE Report March for overall HSE
Monthly HSE Report March for overall HSEMonthly HSE Report March for overall HSE
Monthly HSE Report March for overall HSEOlgaOliveaJohn
 
Space expansion: cultural considerations, long term perspectives, and spiritu...
Space expansion: cultural considerations, long term perspectives, and spiritu...Space expansion: cultural considerations, long term perspectives, and spiritu...
Space expansion: cultural considerations, long term perspectives, and spiritu...Giulio Prisco
 
Present and Future Requisites for Prosperity in the Caribbean
Present and Future Requisites for Prosperity in the CaribbeanPresent and Future Requisites for Prosperity in the Caribbean
Present and Future Requisites for Prosperity in the CaribbeanCaribbean Development Bank
 
KKrish - DOVE Leadership Program Concept
KKrish - DOVE Leadership Program ConceptKKrish - DOVE Leadership Program Concept
KKrish - DOVE Leadership Program ConceptKarthik Krishna
 
Partnerships for Resilient Prosperity in the Caribbean
Partnerships for Resilient Prosperity in the CaribbeanPartnerships for Resilient Prosperity in the Caribbean
Partnerships for Resilient Prosperity in the CaribbeanCaribbean Development Bank
 
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdf
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdfInstructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdf
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdfaytenfsuc
 
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptx
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptxTeams Nation 2024 - #Copilot & Teams or Just Premium.pptx
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptxKai Stenberg
 
God and You 2 Cor 5:15-19; February 25, 2024
God and You 2 Cor 5:15-19; February 25, 2024God and You 2 Cor 5:15-19; February 25, 2024
God and You 2 Cor 5:15-19; February 25, 2024Central Church of Christ
 
Supporting Resilient Prosperity in the Caribbean
Supporting Resilient Prosperity in the CaribbeanSupporting Resilient Prosperity in the Caribbean
Supporting Resilient Prosperity in the CaribbeanCaribbean Development Bank
 

Último (11)

Chapter 20 Firms in IGCSE economics presentation
Chapter 20  Firms in IGCSE  economics presentationChapter 20  Firms in IGCSE  economics presentation
Chapter 20 Firms in IGCSE economics presentation
 
Monthly HSE Report March for overall HSE
Monthly HSE Report March for overall HSEMonthly HSE Report March for overall HSE
Monthly HSE Report March for overall HSE
 
Space expansion: cultural considerations, long term perspectives, and spiritu...
Space expansion: cultural considerations, long term perspectives, and spiritu...Space expansion: cultural considerations, long term perspectives, and spiritu...
Space expansion: cultural considerations, long term perspectives, and spiritu...
 
Present and Future Requisites for Prosperity in the Caribbean
Present and Future Requisites for Prosperity in the CaribbeanPresent and Future Requisites for Prosperity in the Caribbean
Present and Future Requisites for Prosperity in the Caribbean
 
KKrish - DOVE Leadership Program Concept
KKrish - DOVE Leadership Program ConceptKKrish - DOVE Leadership Program Concept
KKrish - DOVE Leadership Program Concept
 
Partnerships for Resilient Prosperity in the Caribbean
Partnerships for Resilient Prosperity in the CaribbeanPartnerships for Resilient Prosperity in the Caribbean
Partnerships for Resilient Prosperity in the Caribbean
 
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdf
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdfInstructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdf
Instructional Supervision - By Dr. Cherinet Aytenfsu Weldearegay.pdf
 
Auditorium Session 1 - Connection - Inclusion
Auditorium Session 1 - Connection - InclusionAuditorium Session 1 - Connection - Inclusion
Auditorium Session 1 - Connection - Inclusion
 
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptx
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptxTeams Nation 2024 - #Copilot & Teams or Just Premium.pptx
Teams Nation 2024 - #Copilot & Teams or Just Premium.pptx
 
God and You 2 Cor 5:15-19; February 25, 2024
God and You 2 Cor 5:15-19; February 25, 2024God and You 2 Cor 5:15-19; February 25, 2024
God and You 2 Cor 5:15-19; February 25, 2024
 
Supporting Resilient Prosperity in the Caribbean
Supporting Resilient Prosperity in the CaribbeanSupporting Resilient Prosperity in the Caribbean
Supporting Resilient Prosperity in the Caribbean
 

Dev Day Andreas Roth.pdf

  • 2. § Dresden, Germany § Development Lead @ esveo § We help developers to accelerate their TypeScript projects Andreas Roth @andrewgreenh andreas.roth@esveo.com
  • 4. @andrewgreenh Code, der anderen Code im gleichen System inspizieren und auch u.U. auch modifizieren kann.
  • 5. import java.lang.reflect.Field; class Person { int age; String name; } class Main { public static void main(String args[]) { Field[] allFields = Person.class.getDeclaredFields(); for (Field field : allFields) { System.out.println( field.getName() + " " + field.getType() ); } } } @andrewgreenh
  • 6. import java.lang.reflect.Field; class Person { int age; String name; } class Main { public static void main(String args[]) { Field[] allFields = Person.class.getDeclaredFields(); for (Field field : allFields) { System.out.println( field.getName() + " " + field.getType() ); } } } @andrewgreenh
  • 7. import java.lang.reflect.Field; class Person { int age; String name; } class Main { public static void main(String args[]) { Field[] allFields = Person.class.getDeclaredFields(); for (Field field : allFields) { System.out.println( field.getName() + " " + field.getType() ); } } } @andrewgreenh
  • 8. import java.lang.reflect.Field; class Person { int age; String name; } class Main { public static void main(String args[]) { Field[] allFields = Person.class.getDeclaredFields(); for (Field field : allFields) { System.out.println( field.getName() + " " + field.getType() ); } } } @andrewgreenh
  • 9. import java.lang.reflect.Field; class Person { int age; String name; } class Main { public static void main(String args[]) { Field[] allFields = Person.class.getDeclaredFields(); for (Field field : allFields) { System.out.println( field.getName() + " " + field.getType() ); } } } @andrewgreenh
  • 11. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 12. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 13. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 14. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 15. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 16. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 17. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 18. @andrewgreenh class User { @maxLength(10) name?: string; age?: number; } @RestController class UserController { constructor(private userRepository: UserRepository) {} @request.POST('/user’) createUser(body: User) { this.userRepository.create(body); } }
  • 20. @andrewgreenh class Person { age?: number; name?: string; greet(other: Person) { console.log(`Hello ${other.name}`); } }
  • 21. @andrewgreenh class Person { age?: number; name?: string; greet(other: Person) { console.log(`Hello ${other.name}`); } } "use strict"; class Person { age; name; greet(other) { console.log(`Hello ${other.name}`); } }
  • 28. @andrewgreenh import zod, { number, object, string } from "zod"; const Person = object({ name: string().min(5), age: number().int().max(150), }); type Person = zod.infer<typeof Person>; function handleRequest(input: unknown) { const person = Person.parse(input); console.log(person.age); }
  • 29. @andrewgreenh import zod, { number, object, string } from "zod"; const Person = object({ name: string().min(5), age: number().int().max(150), }); type Person = zod.infer<typeof Person>; function handleRequest(input: unknown) { const person = Person.parse(input); console.log(person.age); }
  • 35. @andrewgreenh 1. Versuch einen Laufzeitwert als Quelle der Wahrheit zu nehmen 2. Hoffe, dass dein Anwendungsfall so generell ist, dass es Bibliotheken oder Generatoren gibt 3. Versuche Deepkit mit dem Wissen, dass du vom Standard abweichst 4. Finde einen anderen Ansatz J