1 of 82

hexMachina

urban framework for hardcore developers

2 of 82

?

francis bourre / Docler Holding

author of @pixlib

3 of 82

pixLib adventures

in the web apps jungles

4 of 82

pixLib adventures

Let’s grab knowledge from other Tech eco-systems

in the web apps jungles

@tweenpix.net 2003

5 of 82

pixLib adventures

pixlib (as2)

pixioc (as2)

lowra (as3)

palmer (as3)

pixlib community version (as3)

pixlib closed source version (as3)

hexMachina (as3)

2003

2004

2007

2008

2008

2009

2015

@tweenpix.net 2003

6 of 82

Six Feet Under

2015

...

7 of 82

How can I target the browser now?

with a statically typed language

8 of 82

No interface @compile time

9 of 82

with extra benefits

10 of 82

hexMachina

Which kind of framework is it...

and what is the goal?

11 of 82

Monolith framework?

12 of 82

Monolith framework?

Many repositories available:

Core, Annotation, Inject, Service, MVC, IoC,State...

13 of 82

Golden Principles

for maintaining long lifecycle applications

14 of 82

Golden Principles

  • secure collaboration

for maintaining long lifecycle applications

15 of 82

Golden Principles

  • secure collaboration
  • code reusability

for maintaining long lifecycle applications

16 of 82

Golden Principles

  • secure collaboration
  • code reusability
  • low coupling

for maintaining long lifecycle applications

17 of 82

Secure collaboration

design by contract @compile time

18 of 82

INTERFACEs

define contracts

  • Formal specs of your components

19 of 82

INTERFACEs

define contracts

  • Formal specs of your components
  • Hide the implementation

20 of 82

INTERFACEs

define contracts

  • Formal specs of your components
  • Hide the implementation
  • Easy team workflow

21 of 82

INTERFACEs

define contracts

  • Formal specs of your components
  • Hide the implementation
  • Easy team workflow
  • And more...

22 of 82

Code reusability

modular system and configurable components

23 of 82

MODULE

Every module is a micro-application

...And proud to be.

24 of 82

DOMAIN

Every module belongs to an unique domain

.slides

.wwx

.live

.hx

.docler

.talk

.modular

25 of 82

MODULE

micro-application

  • unique Domain
  • private EventBus
  • FrontController

(and/or Controller/s)

  • Model/s

26 of 82

27 of 82

Low coupling

prefer runtime coupling - USE IoC

Jimmy!

Answer me!

28 of 82

Hollywood principle

" Don’t call us, we will call you "

29 of 82

Dependency Injection

30 of 82

Automate coupling

Use automatic dependency injection

31 of 82

INJECTION with ANNOTATIONS

32 of 82

hexAnnotation

Do dirty reflection job @compile time

LoadPhotosCommand.__meta__ = { obj : { 'hex.di.IInjectorContainer' : ["{\"ctor\":{\"args\":[],\"isPre\":false,\"name\":\"new\",\"isPost\":false,\"order\":0},\"props\":[{\"isOpt\":false,\"name\":\"photosService\",\"type\":\"IGetPhotosService\",\"key\":\"\"},{\"isOpt\":false,\"name\":\"galleryModel\",\"type\":\"IGalleryModel\",\"key\":\"\"}],\"name\":\"LoadPhotosCommand\",\"methods\":[]}"]}};

33 of 82

hexInject

  • Works with annotations: Properties, methods and constructors

34 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name

35 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name
  • Value, class instance or singleton can satisfy dependencies

36 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name
  • Value, class instance or singleton can satisfy dependencies
  • Injections can be optional

37 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name
  • Value, class instance or singleton can satisfy dependencies
  • Injections can be optional
  • Injectors chaining

38 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name
  • Value, class instance or singleton can satisfy dependencies
  • Injections can be optional
  • Injectors chaining
  • Event-driven and Exception handling

39 of 82

hexInject

  • Works with annotations: Properties, methods and constructors
  • Mapping by type and optionally by name
  • Value, class instance or singleton can satisfy dependencies
  • Injections can be optional
  • Injectors chaining
  • Event-driven and Exception handling
  • Supports ordered @PostConstruct and @PreDestroy

40 of 82

Build configurable architecture

use Domain Specific Language

41 of 82

hexIoC

Injections with DSL

42 of 82

DSL PARSING/ASSEMBLING FLOW

Xml Parser

parses

43 of 82

DSL PARSING/ASSEMBLING FLOW

Xml Parser

Assembler

parses

translates

44 of 82

DSL PARSING/ASSEMBLING FLOW

Xml Parser

Assembler

Context Factory

parses

translates

Runtime @pplication

builds

45 of 82

DSL PARSING/COMPILING FLOW

Xml Parser

Assembler

CompileTime Factory

parses

translates

Generated Code

generates

46 of 82

HEXMACHINA DSL

hello world

47 of 82

HEXMACHINA DSL

String is default type

48 of 82

HEXMACHINA DSL

simple module creation

49 of 82

SERVICES

service locator / services mapping

50 of 82

HEXMACHINA DSL

constructor injection by DSL

51 of 82

After compilation

JavaScript is generated

52 of 82

INCLUDE

recursive files inclusion

53 of 82

DSL CHECKING

@compile time

Fail early, fail loudly

54 of 82

DSL CHECKING @compile time

type not found

55 of 82

DSL CHECKING @compile time

missing ID

56 of 82

DSL CHECKING @compile time

file missing

57 of 82

Low coupling

Use messaging

58 of 82

Observer pattern

with domain messaging

Publisher

type

observer

type

observer

observer

observer

observer

observer

Observable

named domain

Observable

59 of 82

60 of 82

61 of 82

62 of 82

63 of 82

hexState

states flow configurable with DSL

64 of 82

state machine

asleep

STATE

awake

STATE

wakeup

MESSAGE

STATE CONTROLLER

triggers

65 of 82

state machine

asleep

STATE

awake

STATE

wakeup

MESSAGE

STATE CONTROLLER

triggers

transition

triggers

66 of 82

state machine

asleep

STATE

awake

STATE

executes

wakeup

MESSAGE

STATE CONTROLLER

triggers

transition

triggers

commands

list

67 of 82

state machine

asleep

STATE

awake

STATE

executes

wakeup

MESSAGE

STATE CONTROLLER

triggers

transition

triggers

executes

commands

list

commands

list

68 of 82

Context state machine

dispatcher

external

MESSAGE

sent to

application Context

69 of 82

Context state machine

dispatcher

STATE MACHINE

triggers

external

MESSAGE

sent to

application Context

70 of 82

Context state machine

dispatcher

STATE MACHINE

triggers

external

MESSAGE

sent to

commands

list

commands

list

application Context

71 of 82

Context state machine

application Context

dispatcher

STATE MACHINE

triggers

external

MESSAGE

sent to

commands

list

commands

list

Module

72 of 82

Context states

state flow described with DSL

73 of 82

Context states

module scope for execution

74 of 82

hexUnit

UNIT TEST FRAMEWORK

75 of 82

TEST RESULTS NOTIFIERS

  • Shell
  • Browser/Dom
  • Flash/Display
  • Flash/Trace
  • Web socket

76 of 82

hexCore

Logging API

filter logs by:

  • Domain
  • Levels

web console

  • search text

77 of 82

hexMachina

What’s next?

78 of 82

Recursive composition

context agregates contexts, that agregates contexts, that...

79 of 82

Contexts hierarchy

hierarchy is handled by DSL

80 of 82

Other planned additions

  • High level of code coverage
  • More platforms testing
  • More articles
  • Add states transitions to DSL compiler
  • hexDom (virtual DOM, databinding)
  • Full context error-checking at compile time

81 of 82

Questions...

82 of 82