SlideShare a Scribd company logo
Asynchronous Single Page Applications
without a Line of HTML or Javascript.
Or why D is just awesome
Robert ”burner” Schadek
May 5, 2016
DConf
Javascript and HTML are awesome
• No explicit types
• Variables may be undefined
• Repetition repetition repetition
• No templates
• No compile time function execution
• No compile time
1
Goals
• Retain type-information of data from DB to Client’s
Browser
3
Goals
• Retain type-information of data from DB to Client’s
Browser
• Keeping things DRY
3
Goals
• Retain type-information of data from DB to Client’s
Browser
• Keeping things DRY
• Performance
3
Goals
• Retain type-information of data from DB to Client’s
Browser
• Keeping things DRY
• Performance
• Get things done
3
Vibe.d and Diet
Vibe.d
• Powerful asynchronous I/O and web toolkit for D
• Uses Fibers and Threads
4
Vibe.d
• Powerful asynchronous I/O and web toolkit for D
• Uses Fibers and Threads
• n → m mapping
• yield()
• async IO
4
Vibe.d
• Powerful asynchronous I/O and web toolkit for D
• Uses Fibers and Threads
• n → m mapping
• yield()
• async IO
• async DB connectivity for MongoDB, Redis, MySQL
• You don’t need to care about async
• Web interface generator
• REST interface generator
4
REST Interface Generator
i n t e r f a c e MyAPI {
// GET /weather −> responds {” text ”: ” . . . ” , ”
→ temperature ”: . . . }
Weather getWeather () ;
}
5
REST Interface Generator
i n t e r f a c e MyAPI {
// GET /weather −> responds {” text ”: ” . . . ” , ”
→ temperature ”: . . . }
Weather getWeather () ;
}
c l a s s MyAPIImplementation : MyAPI {
auto weather = [ ”sunny” , ” rainy ” , ” cats and dogs ”
→ , ”snow” ] ;
Weather getWeather () {
return Weather (
weather [ uniform (0 , weather . length ) ] ,
uniform ( −10 ,30)
) ;
}
} 5
REST Interface Generator
auto router = new URLRouter ;
router . get ( ”/” , staticTemplate ! ” index . dt” ) ;
router . get ( ”/main . html” , staticTemplate ! ”main . dt” ) ;
router . r e g i s t e r R e s t I n t e r f a c e !MyAPI(new
→ MyAPIImplementation , r e s t s e t t i n g s ) ;
6
REST Interface Generator
auto router = new URLRouter ;
router . get ( ”/” , staticTemplate ! ” index . dt” ) ;
router . get ( ”/main . html” , staticTemplate ! ”main . dt” ) ;
router . r e g i s t e r R e s t I n t e r f a c e !MyAPI(new
→ MyAPIImplementation , r e s t s e t t i n g s ) ;
struct Weather {
s t r i n g text ;
double temperature ;
}
6
AngularJS Typescript
i n t e r f a c e Weather {
text : string ,
temperature : number
}
7
AngularJS Typescript
i n t e r f a c e Weather {
text : string ,
temperature : number
}
i n t e r f a c e MainScope extends ng . IScope {
weather : Weather
}
7
AngularJS Typescript
i n t e r f a c e Weather {
text : string ,
temperature : number
}
i n t e r f a c e MainScope extends ng . IScope {
weather : Weather
}
c l a s s MainCtrl {
public s t a t i c $ i n j e c t = [ ’ $scope ’ , ’ $http ’ ] ;
constructor ( private $scope : MainScope ,
private $http : ng . IHttpService )
{
t h i s . weather () ;
}
7
AngularJS Typescript
weather () : void {
var s = ’ /weather ’ ;
t h i s . $http . get ( s ) . success (( data : Weather ) => {
t h i s . $scope . weather = data ;
}) ;
}
8
Diet
doctype html
html (ng−app=”myapp”)
head
t i t l e DConf 2016 Weather
− j a v a s c r i p t ( ” . / angular . j s ”) ;
− j a v a s c r i p t ( ” . / angular−route . j s ”) ;
− j a v a s c r i p t ( ” . / myapp . j s ”) ;
body
div (ng−view )
9
Diet
doctype html
html (ng−app=”myapp”)
head
t i t l e DConf 2016 Weather
− j a v a s c r i p t ( ” . / angular . j s ”) ;
− j a v a s c r i p t ( ” . / angular−route . j s ”) ;
− j a v a s c r i p t ( ” . / myapp . j s ”) ;
body
div (ng−view )
− void j a v a s c r i p t ( s t r i n g name)
s c r i p t ( src=”#{name}”)
9
Diet
. container
p {{ weather . text }}
p {{ weather . temperature }}
button ( type=”submit ” ,ng−c l i c k =” c t r l . weather () ; ” )
→ Get Weather
10
Live Demo
Dataflow from the Server to the
Frontend and back again
Dataflow from the Server to the Frontend and back again
struct Weather {
s t r i n g text ;
double temperature ;
}
Dlang
11
Dataflow from the Server to the Frontend and back again
struct Weather {
s t r i n g text ;
double temperature ;
}
Dlang
i n t e r f a c e Weather {
text : string ,
tempereture : number
}
Typescript
11
dstructtotypescript
dstructtotypescript -i weather.d -p weather.ts -s
→ Weather
12
dstructtotypescript
dstructtotypescript -i weather.d -p weather.ts -s
→ Weather
struct Weather {
string text ;
double temperature ;
}
dstructtotypescript
dstructtotypescript -i weather.d -p weather.ts -s
→ Weather
struct Weather {
string text ;
double temperature ;
}
import std . format ;
foreach ( i t ; __traits (allMembers , Weather) )
dstructtotypescript
dstructtotypescript -i weather.d -p weather.ts -s
→ Weather
struct Weather {
string text ;
double temperature ;
}
import std . format ;
foreach ( i t ; __traits (allMembers , Weather) )
interface Weather {
text : string ,
temperature : number
}
12
Everything is wrong
13
Everything is wrong
• All we solved was a tiny specific problem
• What about server to database
• What if we would use Dart instead of Typescript
• How do we communicate the overall architecture
• How do we keep the architecture in sync with the code
• How do we communicate with non-developer
• ...
14
Everything is wrong
• All we solved was a tiny specific problem
• What about server to database
• What if we would use Dart instead of Typescript
• How do we communicate the overall architecture
• How do we keep the architecture in sync with the code
• How do we communicate with non-developer
• ...
• How do we deal with change?
14
Everything is still wrong
• Waterfall Model
15
Everything is still wrong
• Waterfall Model ← no change, never
15
Everything is still wrong
• Waterfall Model ← no change, never
• Hacking
15
Everything is still wrong
• Waterfall Model ← no change, never
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• Agile Methods
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• Agile Methods ← just hacking, with fancy names
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• UML
• Agile Methods ← just hacking, with fancy names
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• UML ← just kill me already
• Agile Methods ← just hacking, with fancy names
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• UML ← just kill me already
• Agile Methods ← just hacking, with fancy names
• Hacking ← no plan to speak of, just change
15
Everything is still wrong
• Waterfall Model ← no change, never
• UML ← just kill me already
• Agile Methods ← just hacking, with fancy names
• Hacking ← no plan to speak of, just change
15
What do we want
• Speak about the system at different levels of detail
with different people
• Quickly introduce people to the system
• Keep data classes (Model) synchronized across
• Frontend
• Server
• Database
• Write only one model for everything, to keep stuff in sync
• Have description line based, because git
• Generate everything possible from the model
16
Introducing the C4 Architecture
Structurizr
• Implements C4 Architecture Model
• Java library to build the model
21
Structurizr
• Implements C4 Architecture Model
• Java library to build the model
• Its code, its fits into git
21
Structurizr
• Implements C4 Architecture Model
• Java library to build the model
• Its code, its fits into git
• Structurizr generates code
21
Structurizr
• Implements C4 Architecture Model
• Java library to build the model
• Its code, its fits into git
• Structurizr generates code
• Only Java and .net
21
How hard can it be
How do we approach the development
• We’re not gonne create a new language
23
How do we approach the development
• We’re not gonne create a new language, at first
23
How do we approach the development
• We’re not gonne create a new language, at first, most likely
23
How do we approach the development
• We’re not gonne create a new language, at first, most likely
• The model (ast) is pretty simple
23
How do we approach the development
• We’re not gonne create a new language, at first, most likely
• The model (ast) is pretty simple
• The world
• The world has
• Actors, software/hardware systems
• A software systems has
• Containers (everything with a unique pid)
• A container has
• Components (think module) and classes
• A component has
• Components and classes
• Classes have members
• Connections between the above
• UML Association, Aggregation, Composition, Dependency,
. . .
• Additional informations, names, descriptions
23
Using Degenerator 1/2
auto world = new TheWorld( ”TheWorld” ) ;
Actor users = world . getOrNewActor ( ”The Users ” ) ;
users . d e s c r i p t i o n = ” This i s a way to long
→ de s c r i p t i o n fo r something ”
~ ” that should be obvious . ” ;
auto system = world . getOrNewSoftwareSystem ( ”
→ AwesomeSoftware” ) ;
24
Using Degenerator 1/2
auto world = new TheWorld( ”TheWorld” ) ;
Actor users = world . getOrNewActor ( ”The Users ” ) ;
users . d e s c r i p t i o n = ” This i s a way to long
→ de s c r i p t i o n fo r something ”
~ ” that should be obvious . ” ;
auto system = world . getOrNewSoftwareSystem ( ”
→ AwesomeSoftware” ) ;
Container frontend = system . getOrNewContainer ( ”
→ Frontend” ) ;
frontend . technology = ”Angular” ;
auto frontendUserCtrl = frontend . getOrNewComponent(
→ ” frontUserCtrl ” ) ;
24
Using Degenerator 2/4
auto database = system . getOrNewContainer ( ”Database”
→ ) ;
database . technology = ”MySQL” ;
world . getOrNew ! Dependency ( ” serverDatabase ” ,
server , database
) . d e s c r i p t i o n = ”CRUD” ;
25
Using Degenerator 2/4
auto database = system . getOrNewContainer ( ”Database”
→ ) ;
database . technology = ”MySQL” ;
world . getOrNew ! Dependency ( ” serverDatabase ” ,
server , database
) . d e s c r i p t i o n = ”CRUD” ;
Class user = getOrNewClass ( ”User” ,
frontendUserCtrl , serverUserCtrl , database
) ;
25
Using Degenerator 3/4
Class user = getOrNewClass ( ”User” ,
frontendUserCtrl , serverUserCtrl , database
) ;
26
Using Degenerator 3/4
Class user = getOrNewClass ( ”User” ,
frontendUserCtrl , serverUserCtrl , database
) ;
MemberVariable userId = user . getOrNew !
→ MemberVariable ( ” id ” ) ;
userId . type = in teger ;
userId . addLandSpecificAttribute ( ”MySQL” , ”PRIMARY
→ KEY” ) ;
userId . addLandSpecificAttribute ( ”MySQL” , ”AUTO
→ INCREMENT” ) ;
26
Using Degenerator 4/4
Class address = getOrNewClass ( ” Address ” ,
frontendUserCtrl , serverUserCtrl , database
) ;
27
Using Degenerator 4/4
Class address = getOrNewClass ( ” Address ” ,
frontendUserCtrl , serverUserCtrl , database
) ;
Aggregation userAddress = world . getOrNew !
→ Aggregation ( ” addressUser ” ,
address , user
) ;
27
Types in Degenerator
• Types
28
Types in Degenerator
• Types e.g. strings are not always strings
28
Types in Degenerator
• Types e.g. strings are not always strings
• D string
• MySQL text
• C++ std::string
28
Types in Degenerator
• Types e.g. strings are not always strings
• D string
• MySQL text
• C++ std::string
struct Type {
s t r i n g name ;
s t r i n g [ s t r i n g ] typeMapping ;
}
auto pwdHash = Type( ” PasswordString ” ) ;
28
Types in Degenerator
• Types e.g. strings are not always strings
• D string
• MySQL text
• C++ std::string
struct Type {
s t r i n g name ;
s t r i n g [ s t r i n g ] typeMapping ;
}
auto pwdHash = Type( ” PasswordString ” ) ;
pwdHash . typeMappings [ ”D” ] = ” s t r i n g ” ;
pwdHash . typeMappings [ ”MySQL” ] = ”VARCHAR(128) ” ;
28
Generating
Graphvic gv = new Graphvic ( world , ”GraphvizOutput” ) ;
gv . generate () ;
MySQL mysql = new MySQL( world , ”MySQL” ) ;
mysql . generate ( database ) ;
29
The World
30
The World and Containers
31
Awesome Software System
32
Generating the Database CREATE TABLE Statements
CREATE TABLE Address {
id LONG PRIMARY KEY
};
CREATE TABLE Address_User {
User_id LONG
FOREIGN KEY(User_id)
→ REFERENCES User ( id ) ON
→ UPDATE CASCADE ON
→ DELETE CASCADE,
Address_id LONG
FOREIGN KEY(Address_id)
→ REFERENCES Address ( id )
→ ON UPDATE CASCADE ON
→ DELETE CASCADE
}
CREATE TABLE User {
id LONG PRIMARY KEY AUTO
→ INCREMENT,
lastname TEXT,
firstname TEXT
};
CREATE TABLE PostelCode {
id LONG PRIMARY KEY AUTO
→ INCREMENT,
code LONG,
Address_id LONG
FOREIGN KEY(Address_id )
→ REFERENCES Address ( id )
→ ON UPDATE CASCADE ON
→ DELETE CASCADE
};
33
What can we generate
• Diagrams describing the project at different levels of detail
• Database schema
• phpmyadmin clones
• Database access code
• Data objects (D struct/class, Typescript interface/class, . . .
• Server skeletons
• Frontend skeletons
34
What can we generate
• Diagrams describing the project at different levels of detail
• Database schema
• phpmyadmin clones
• Database access code
• Data objects (D struct/class, Typescript interface/class, . . .
• Server skeletons
• Frontend skeletons
• Graphviz mostly done, MySQL is getting there, Vibe.d and
Angular2 next
34
The End
• vibe.d https://vibed.org
• typescript https://www.typescriptlang.org/
• dstructtotypescript
https://github.com/burner/dstructtotypescript
• C4 Architecture (Simon Brown)
http://www.codingthearchitecture.com
• Structurizr https://structurizr.com/
• Degenerator https://github.com/burner/Degenerator
36

More Related Content

What's hot

Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
Bo-Yi Wu
 
Introduction to Rust language programming
Introduction to Rust language programmingIntroduction to Rust language programming
Introduction to Rust language programming
Rodolfo Finochietti
 
Optimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleOptimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with Truffle
Stefan Marr
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native codeTips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
Kenneth Geisshirt
 
Klee and angr
Klee and angrKlee and angr
Klee and angr
Wei-Bo Chen
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
Felix Geisendörfer
 
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Codemotion
 
Node.js extensions in C++
Node.js extensions in C++Node.js extensions in C++
Node.js extensions in C++
Kenneth Geisshirt
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
Dvir Volk
 
C++ Coroutines
C++ CoroutinesC++ Coroutines
C++ Coroutines
Sumant Tambe
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
Jen Yee Hong
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
Jen Yee Hong
 
DConf 2016: Bitpacking Like a Madman by Amaury Sechet
DConf 2016: Bitpacking Like a Madman by Amaury SechetDConf 2016: Bitpacking Like a Madman by Amaury Sechet
DConf 2016: Bitpacking Like a Madman by Amaury Sechet
Andrei Alexandrescu
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
fukamachi
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdb
Wei-Bo Chen
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling
Douglas Chen
 
Extending Node.js using C++
Extending Node.js using C++Extending Node.js using C++
Extending Node.js using C++
Kenneth Geisshirt
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
 
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Romain Dorgueil
 

What's hot (20)

Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
Introduction to Rust language programming
Introduction to Rust language programmingIntroduction to Rust language programming
Introduction to Rust language programming
 
Optimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleOptimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with Truffle
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
 
Tips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native codeTips and tricks for building high performance android apps using native code
Tips and tricks for building high performance android apps using native code
 
Klee and angr
Klee and angrKlee and angr
Klee and angr
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
Asynchronous IO in Rust - Enrico Risa - Codemotion Rome 2017
 
Node.js extensions in C++
Node.js extensions in C++Node.js extensions in C++
Node.js extensions in C++
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
 
C++ Coroutines
C++ CoroutinesC++ Coroutines
C++ Coroutines
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
 
DConf 2016: Bitpacking Like a Madman by Amaury Sechet
DConf 2016: Bitpacking Like a Madman by Amaury SechetDConf 2016: Bitpacking Like a Madman by Amaury Sechet
DConf 2016: Bitpacking Like a Madman by Amaury Sechet
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
 
Triton and symbolic execution on gdb
Triton and symbolic execution on gdbTriton and symbolic execution on gdb
Triton and symbolic execution on gdb
 
[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling[COSCUP 2020] How to use llvm frontend library-libtooling
[COSCUP 2020] How to use llvm frontend library-libtooling
 
Extending Node.js using C++
Extending Node.js using C++Extending Node.js using C++
Extending Node.js using C++
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
 

Viewers also liked

Informática básica
Informática básicaInformática básica
Informática básica
Mishell1205
 
Estudio de caso tecnologia y sociedad
Estudio de caso tecnologia y sociedadEstudio de caso tecnologia y sociedad
Estudio de caso tecnologia y sociedad
Ricardo Valencia
 
Ket tap, ke thua
Ket tap, ke thuaKet tap, ke thua
Ket tap, ke thua
Tuan Do
 
Message from Merida, WILD9
Message from Merida, WILD9Message from Merida, WILD9
Message from Merida, WILD9
WILD Foundation
 
Los 7 saberes
Los 7 saberesLos 7 saberes
Los 7 saberes
Jessica Ortiz
 
Trading Derivados22/03/2013
Trading Derivados22/03/2013Trading Derivados22/03/2013
Trading Derivados22/03/2013
BNP Paribas Personal Investors
 
Colectivo de comunicaciones ever toro
Colectivo de comunicaciones ever toroColectivo de comunicaciones ever toro
Colectivo de comunicaciones ever toro
Ever Jesus Toro Toro
 
Comentario sobre las redes
Comentario sobre las redesComentario sobre las redes
Comentario sobre las redes
luislossa
 
Guia de antidepresivos. 1
Guia de antidepresivos. 1Guia de antidepresivos. 1
Guia de antidepresivos. 1
Juan Delgado Delgado
 
Presentacion de Power Point
Presentacion de Power PointPresentacion de Power Point
Presentacion de Power Point
Edith Navarro
 
Responding in Times of Crisis: Providing Psychological First Aid
Responding in Times of Crisis: Providing Psychological First AidResponding in Times of Crisis: Providing Psychological First Aid
Responding in Times of Crisis: Providing Psychological First Aid
Bernie McCann
 
TIRADS SCORING : its Efficacy and Accuracy
TIRADS SCORING : its Efficacy and AccuracyTIRADS SCORING : its Efficacy and Accuracy
TIRADS SCORING : its Efficacy and Accuracy
Roshan Valentine
 
Ccna new syllabus
Ccna new syllabusCcna new syllabus
Ccna new syllabus
thetechnicalzone
 

Viewers also liked (14)

Informática básica
Informática básicaInformática básica
Informática básica
 
Halaman persetujuan juli
Halaman  persetujuan juliHalaman  persetujuan juli
Halaman persetujuan juli
 
Estudio de caso tecnologia y sociedad
Estudio de caso tecnologia y sociedadEstudio de caso tecnologia y sociedad
Estudio de caso tecnologia y sociedad
 
Ket tap, ke thua
Ket tap, ke thuaKet tap, ke thua
Ket tap, ke thua
 
Message from Merida, WILD9
Message from Merida, WILD9Message from Merida, WILD9
Message from Merida, WILD9
 
Los 7 saberes
Los 7 saberesLos 7 saberes
Los 7 saberes
 
Trading Derivados22/03/2013
Trading Derivados22/03/2013Trading Derivados22/03/2013
Trading Derivados22/03/2013
 
Colectivo de comunicaciones ever toro
Colectivo de comunicaciones ever toroColectivo de comunicaciones ever toro
Colectivo de comunicaciones ever toro
 
Comentario sobre las redes
Comentario sobre las redesComentario sobre las redes
Comentario sobre las redes
 
Guia de antidepresivos. 1
Guia de antidepresivos. 1Guia de antidepresivos. 1
Guia de antidepresivos. 1
 
Presentacion de Power Point
Presentacion de Power PointPresentacion de Power Point
Presentacion de Power Point
 
Responding in Times of Crisis: Providing Psychological First Aid
Responding in Times of Crisis: Providing Psychological First AidResponding in Times of Crisis: Providing Psychological First Aid
Responding in Times of Crisis: Providing Psychological First Aid
 
TIRADS SCORING : its Efficacy and Accuracy
TIRADS SCORING : its Efficacy and AccuracyTIRADS SCORING : its Efficacy and Accuracy
TIRADS SCORING : its Efficacy and Accuracy
 
Ccna new syllabus
Ccna new syllabusCcna new syllabus
Ccna new syllabus
 

Similar to Asynchronous single page applications without a line of HTML or Javascript, or why D is just awesome

FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023
Matthew Groves
 
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PyData
 
10 ways to make your code rock
10 ways to make your code rock10 ways to make your code rock
10 ways to make your code rock
martincronje
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
Andrew Rota
 
Rails israel 2013
Rails israel 2013Rails israel 2013
Rails israel 2013
Reuven Lerner
 
MySQL Performance Monitoring
MySQL Performance MonitoringMySQL Performance Monitoring
MySQL Performance Monitoring
spil-engineering
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
AOE
 
Revealing ALLSTOCKER
Revealing ALLSTOCKERRevealing ALLSTOCKER
Revealing ALLSTOCKER
Masashi Umezawa
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
MongoDB APAC
 
Cassandra drivers and libraries
Cassandra drivers and librariesCassandra drivers and libraries
Cassandra drivers and libraries
Duyhai Doan
 
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
Ontico
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
JAX London
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
Elizabeth Smith
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
C4Media
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
DataStax Academy
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
Kyrylo Reznykov
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
DataWorks Summit
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
Asanka Indrajith
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
Jose Manuel Pereira Garcia
 

Similar to Asynchronous single page applications without a line of HTML or Javascript, or why D is just awesome (20)

FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023
 
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
 
10 ways to make your code rock
10 ways to make your code rock10 ways to make your code rock
10 ways to make your code rock
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
 
Rails israel 2013
Rails israel 2013Rails israel 2013
Rails israel 2013
 
MySQL Performance Monitoring
MySQL Performance MonitoringMySQL Performance Monitoring
MySQL Performance Monitoring
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
Revealing ALLSTOCKER
Revealing ALLSTOCKERRevealing ALLSTOCKER
Revealing ALLSTOCKER
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
Cassandra drivers and libraries
Cassandra drivers and librariesCassandra drivers and libraries
Cassandra drivers and libraries
 
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
PostgreSQL - масштабирование в моде, Valentine Gogichashvili (Zalando SE)
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Data Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFixData Science in the Cloud @StitchFix
Data Science in the Cloud @StitchFix
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 

Recently uploaded

Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 

Recently uploaded (20)

Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 

Asynchronous single page applications without a line of HTML or Javascript, or why D is just awesome

  • 1. Asynchronous Single Page Applications without a Line of HTML or Javascript. Or why D is just awesome Robert ”burner” Schadek May 5, 2016 DConf
  • 2. Javascript and HTML are awesome • No explicit types • Variables may be undefined • Repetition repetition repetition • No templates • No compile time function execution • No compile time 1
  • 3.
  • 4. Goals • Retain type-information of data from DB to Client’s Browser 3
  • 5. Goals • Retain type-information of data from DB to Client’s Browser • Keeping things DRY 3
  • 6. Goals • Retain type-information of data from DB to Client’s Browser • Keeping things DRY • Performance 3
  • 7. Goals • Retain type-information of data from DB to Client’s Browser • Keeping things DRY • Performance • Get things done 3
  • 9. Vibe.d • Powerful asynchronous I/O and web toolkit for D • Uses Fibers and Threads 4
  • 10. Vibe.d • Powerful asynchronous I/O and web toolkit for D • Uses Fibers and Threads • n → m mapping • yield() • async IO 4
  • 11. Vibe.d • Powerful asynchronous I/O and web toolkit for D • Uses Fibers and Threads • n → m mapping • yield() • async IO • async DB connectivity for MongoDB, Redis, MySQL • You don’t need to care about async • Web interface generator • REST interface generator 4
  • 12. REST Interface Generator i n t e r f a c e MyAPI { // GET /weather −> responds {” text ”: ” . . . ” , ” → temperature ”: . . . } Weather getWeather () ; } 5
  • 13. REST Interface Generator i n t e r f a c e MyAPI { // GET /weather −> responds {” text ”: ” . . . ” , ” → temperature ”: . . . } Weather getWeather () ; } c l a s s MyAPIImplementation : MyAPI { auto weather = [ ”sunny” , ” rainy ” , ” cats and dogs ” → , ”snow” ] ; Weather getWeather () { return Weather ( weather [ uniform (0 , weather . length ) ] , uniform ( −10 ,30) ) ; } } 5
  • 14. REST Interface Generator auto router = new URLRouter ; router . get ( ”/” , staticTemplate ! ” index . dt” ) ; router . get ( ”/main . html” , staticTemplate ! ”main . dt” ) ; router . r e g i s t e r R e s t I n t e r f a c e !MyAPI(new → MyAPIImplementation , r e s t s e t t i n g s ) ; 6
  • 15. REST Interface Generator auto router = new URLRouter ; router . get ( ”/” , staticTemplate ! ” index . dt” ) ; router . get ( ”/main . html” , staticTemplate ! ”main . dt” ) ; router . r e g i s t e r R e s t I n t e r f a c e !MyAPI(new → MyAPIImplementation , r e s t s e t t i n g s ) ; struct Weather { s t r i n g text ; double temperature ; } 6
  • 16. AngularJS Typescript i n t e r f a c e Weather { text : string , temperature : number } 7
  • 17. AngularJS Typescript i n t e r f a c e Weather { text : string , temperature : number } i n t e r f a c e MainScope extends ng . IScope { weather : Weather } 7
  • 18. AngularJS Typescript i n t e r f a c e Weather { text : string , temperature : number } i n t e r f a c e MainScope extends ng . IScope { weather : Weather } c l a s s MainCtrl { public s t a t i c $ i n j e c t = [ ’ $scope ’ , ’ $http ’ ] ; constructor ( private $scope : MainScope , private $http : ng . IHttpService ) { t h i s . weather () ; } 7
  • 19. AngularJS Typescript weather () : void { var s = ’ /weather ’ ; t h i s . $http . get ( s ) . success (( data : Weather ) => { t h i s . $scope . weather = data ; }) ; } 8
  • 20. Diet doctype html html (ng−app=”myapp”) head t i t l e DConf 2016 Weather − j a v a s c r i p t ( ” . / angular . j s ”) ; − j a v a s c r i p t ( ” . / angular−route . j s ”) ; − j a v a s c r i p t ( ” . / myapp . j s ”) ; body div (ng−view ) 9
  • 21. Diet doctype html html (ng−app=”myapp”) head t i t l e DConf 2016 Weather − j a v a s c r i p t ( ” . / angular . j s ”) ; − j a v a s c r i p t ( ” . / angular−route . j s ”) ; − j a v a s c r i p t ( ” . / myapp . j s ”) ; body div (ng−view ) − void j a v a s c r i p t ( s t r i n g name) s c r i p t ( src=”#{name}”) 9
  • 22. Diet . container p {{ weather . text }} p {{ weather . temperature }} button ( type=”submit ” ,ng−c l i c k =” c t r l . weather () ; ” ) → Get Weather 10
  • 24. Dataflow from the Server to the Frontend and back again
  • 25. Dataflow from the Server to the Frontend and back again struct Weather { s t r i n g text ; double temperature ; } Dlang 11
  • 26. Dataflow from the Server to the Frontend and back again struct Weather { s t r i n g text ; double temperature ; } Dlang i n t e r f a c e Weather { text : string , tempereture : number } Typescript 11
  • 27. dstructtotypescript dstructtotypescript -i weather.d -p weather.ts -s → Weather 12
  • 28. dstructtotypescript dstructtotypescript -i weather.d -p weather.ts -s → Weather struct Weather { string text ; double temperature ; }
  • 29. dstructtotypescript dstructtotypescript -i weather.d -p weather.ts -s → Weather struct Weather { string text ; double temperature ; } import std . format ; foreach ( i t ; __traits (allMembers , Weather) )
  • 30. dstructtotypescript dstructtotypescript -i weather.d -p weather.ts -s → Weather struct Weather { string text ; double temperature ; } import std . format ; foreach ( i t ; __traits (allMembers , Weather) ) interface Weather { text : string , temperature : number } 12
  • 32. 13
  • 33. Everything is wrong • All we solved was a tiny specific problem • What about server to database • What if we would use Dart instead of Typescript • How do we communicate the overall architecture • How do we keep the architecture in sync with the code • How do we communicate with non-developer • ... 14
  • 34. Everything is wrong • All we solved was a tiny specific problem • What about server to database • What if we would use Dart instead of Typescript • How do we communicate the overall architecture • How do we keep the architecture in sync with the code • How do we communicate with non-developer • ... • How do we deal with change? 14
  • 35. Everything is still wrong • Waterfall Model 15
  • 36. Everything is still wrong • Waterfall Model ← no change, never 15
  • 37. Everything is still wrong • Waterfall Model ← no change, never • Hacking 15
  • 38. Everything is still wrong • Waterfall Model ← no change, never • Hacking ← no plan to speak of, just change 15
  • 39. Everything is still wrong • Waterfall Model ← no change, never • Agile Methods • Hacking ← no plan to speak of, just change 15
  • 40. Everything is still wrong • Waterfall Model ← no change, never • Agile Methods ← just hacking, with fancy names • Hacking ← no plan to speak of, just change 15
  • 41. Everything is still wrong • Waterfall Model ← no change, never • UML • Agile Methods ← just hacking, with fancy names • Hacking ← no plan to speak of, just change 15
  • 42. Everything is still wrong • Waterfall Model ← no change, never • UML ← just kill me already • Agile Methods ← just hacking, with fancy names • Hacking ← no plan to speak of, just change 15
  • 43. Everything is still wrong • Waterfall Model ← no change, never • UML ← just kill me already • Agile Methods ← just hacking, with fancy names • Hacking ← no plan to speak of, just change 15
  • 44. Everything is still wrong • Waterfall Model ← no change, never • UML ← just kill me already • Agile Methods ← just hacking, with fancy names • Hacking ← no plan to speak of, just change 15
  • 45. What do we want • Speak about the system at different levels of detail with different people • Quickly introduce people to the system • Keep data classes (Model) synchronized across • Frontend • Server • Database • Write only one model for everything, to keep stuff in sync • Have description line based, because git • Generate everything possible from the model 16
  • 46. Introducing the C4 Architecture
  • 47.
  • 48.
  • 49.
  • 50.
  • 51. Structurizr • Implements C4 Architecture Model • Java library to build the model 21
  • 52. Structurizr • Implements C4 Architecture Model • Java library to build the model • Its code, its fits into git 21
  • 53. Structurizr • Implements C4 Architecture Model • Java library to build the model • Its code, its fits into git • Structurizr generates code 21
  • 54. Structurizr • Implements C4 Architecture Model • Java library to build the model • Its code, its fits into git • Structurizr generates code • Only Java and .net 21
  • 55.
  • 56. How hard can it be
  • 57. How do we approach the development • We’re not gonne create a new language 23
  • 58. How do we approach the development • We’re not gonne create a new language, at first 23
  • 59. How do we approach the development • We’re not gonne create a new language, at first, most likely 23
  • 60. How do we approach the development • We’re not gonne create a new language, at first, most likely • The model (ast) is pretty simple 23
  • 61. How do we approach the development • We’re not gonne create a new language, at first, most likely • The model (ast) is pretty simple • The world • The world has • Actors, software/hardware systems • A software systems has • Containers (everything with a unique pid) • A container has • Components (think module) and classes • A component has • Components and classes • Classes have members • Connections between the above • UML Association, Aggregation, Composition, Dependency, . . . • Additional informations, names, descriptions 23
  • 62. Using Degenerator 1/2 auto world = new TheWorld( ”TheWorld” ) ; Actor users = world . getOrNewActor ( ”The Users ” ) ; users . d e s c r i p t i o n = ” This i s a way to long → de s c r i p t i o n fo r something ” ~ ” that should be obvious . ” ; auto system = world . getOrNewSoftwareSystem ( ” → AwesomeSoftware” ) ; 24
  • 63. Using Degenerator 1/2 auto world = new TheWorld( ”TheWorld” ) ; Actor users = world . getOrNewActor ( ”The Users ” ) ; users . d e s c r i p t i o n = ” This i s a way to long → de s c r i p t i o n fo r something ” ~ ” that should be obvious . ” ; auto system = world . getOrNewSoftwareSystem ( ” → AwesomeSoftware” ) ; Container frontend = system . getOrNewContainer ( ” → Frontend” ) ; frontend . technology = ”Angular” ; auto frontendUserCtrl = frontend . getOrNewComponent( → ” frontUserCtrl ” ) ; 24
  • 64. Using Degenerator 2/4 auto database = system . getOrNewContainer ( ”Database” → ) ; database . technology = ”MySQL” ; world . getOrNew ! Dependency ( ” serverDatabase ” , server , database ) . d e s c r i p t i o n = ”CRUD” ; 25
  • 65. Using Degenerator 2/4 auto database = system . getOrNewContainer ( ”Database” → ) ; database . technology = ”MySQL” ; world . getOrNew ! Dependency ( ” serverDatabase ” , server , database ) . d e s c r i p t i o n = ”CRUD” ; Class user = getOrNewClass ( ”User” , frontendUserCtrl , serverUserCtrl , database ) ; 25
  • 66. Using Degenerator 3/4 Class user = getOrNewClass ( ”User” , frontendUserCtrl , serverUserCtrl , database ) ; 26
  • 67. Using Degenerator 3/4 Class user = getOrNewClass ( ”User” , frontendUserCtrl , serverUserCtrl , database ) ; MemberVariable userId = user . getOrNew ! → MemberVariable ( ” id ” ) ; userId . type = in teger ; userId . addLandSpecificAttribute ( ”MySQL” , ”PRIMARY → KEY” ) ; userId . addLandSpecificAttribute ( ”MySQL” , ”AUTO → INCREMENT” ) ; 26
  • 68. Using Degenerator 4/4 Class address = getOrNewClass ( ” Address ” , frontendUserCtrl , serverUserCtrl , database ) ; 27
  • 69. Using Degenerator 4/4 Class address = getOrNewClass ( ” Address ” , frontendUserCtrl , serverUserCtrl , database ) ; Aggregation userAddress = world . getOrNew ! → Aggregation ( ” addressUser ” , address , user ) ; 27
  • 71. Types in Degenerator • Types e.g. strings are not always strings 28
  • 72. Types in Degenerator • Types e.g. strings are not always strings • D string • MySQL text • C++ std::string 28
  • 73. Types in Degenerator • Types e.g. strings are not always strings • D string • MySQL text • C++ std::string struct Type { s t r i n g name ; s t r i n g [ s t r i n g ] typeMapping ; } auto pwdHash = Type( ” PasswordString ” ) ; 28
  • 74. Types in Degenerator • Types e.g. strings are not always strings • D string • MySQL text • C++ std::string struct Type { s t r i n g name ; s t r i n g [ s t r i n g ] typeMapping ; } auto pwdHash = Type( ” PasswordString ” ) ; pwdHash . typeMappings [ ”D” ] = ” s t r i n g ” ; pwdHash . typeMappings [ ”MySQL” ] = ”VARCHAR(128) ” ; 28
  • 75. Generating Graphvic gv = new Graphvic ( world , ”GraphvizOutput” ) ; gv . generate () ; MySQL mysql = new MySQL( world , ”MySQL” ) ; mysql . generate ( database ) ; 29
  • 77. The World and Containers 31
  • 79. Generating the Database CREATE TABLE Statements CREATE TABLE Address { id LONG PRIMARY KEY }; CREATE TABLE Address_User { User_id LONG FOREIGN KEY(User_id) → REFERENCES User ( id ) ON → UPDATE CASCADE ON → DELETE CASCADE, Address_id LONG FOREIGN KEY(Address_id) → REFERENCES Address ( id ) → ON UPDATE CASCADE ON → DELETE CASCADE } CREATE TABLE User { id LONG PRIMARY KEY AUTO → INCREMENT, lastname TEXT, firstname TEXT }; CREATE TABLE PostelCode { id LONG PRIMARY KEY AUTO → INCREMENT, code LONG, Address_id LONG FOREIGN KEY(Address_id ) → REFERENCES Address ( id ) → ON UPDATE CASCADE ON → DELETE CASCADE }; 33
  • 80. What can we generate • Diagrams describing the project at different levels of detail • Database schema • phpmyadmin clones • Database access code • Data objects (D struct/class, Typescript interface/class, . . . • Server skeletons • Frontend skeletons 34
  • 81. What can we generate • Diagrams describing the project at different levels of detail • Database schema • phpmyadmin clones • Database access code • Data objects (D struct/class, Typescript interface/class, . . . • Server skeletons • Frontend skeletons • Graphviz mostly done, MySQL is getting there, Vibe.d and Angular2 next 34
  • 82.
  • 83. The End • vibe.d https://vibed.org • typescript https://www.typescriptlang.org/ • dstructtotypescript https://github.com/burner/dstructtotypescript • C4 Architecture (Simon Brown) http://www.codingthearchitecture.com • Structurizr https://structurizr.com/ • Degenerator https://github.com/burner/Degenerator 36