Slide 1

Slide 1 text

THIAGO SCALONE - @scalone DaFunk IOT FRAMEWORK

Slide 2

Slide 2 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 3

Slide 3 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 4

Slide 4 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

HAPPY! Felling 1994

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

2000

Slide 9

Slide 9 text

2000

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

2004

Slide 12

Slide 12 text

2004

Slide 13

Slide 13 text

2004

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

2007

Slide 16

Slide 16 text

2007

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Slide 20

Slide 20 text

mruby

Slide 21

Slide 21 text

THIAGO SCALONE - @scalone DaFunk IOT FRAMEWORK

Slide 22

Slide 22 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 23

Slide 23 text

mruby

Slide 24

Slide 24 text

MRuby ISO/IEC 30170:2012

Slide 25

Slide 25 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 Syntax

Slide 26

Slide 26 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 Syntax No built-in IO/Thread/stdlib

Slide 27

Slide 27 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 Syntax No built-in IO/Thread/stdlib Cross-compilation / ANSI C

Slide 28

Slide 28 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 Syntax No built-in IO/Thread/stdlib Cross-compilation / ANSI C No gems, but mrbgems

Slide 29

Slide 29 text

runtime Operation System

Slide 30

Slide 30 text

runtime Operation System SDK / Dynlib

Slide 31

Slide 31 text

runtime Operation System SDK / Dynlib MRuby VM

Slide 32

Slide 32 text

runtime Operation System SDK / Dynlib MRuby VM Mrbgem

Slide 33

Slide 33 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 34

Slide 34 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 35

Slide 35 text

static Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 36

Slide 36 text

mrbgem Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 37

Slide 37 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 38

Slide 38 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 39

Slide 39 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 40

Slide 40 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 41

Slide 41 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 42

Slide 42 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

THIAGO SCALONE - @scalone DaFunk IOT FRAMEWORK

Slide 45

Slide 45 text

FRAMEWORK

Slide 46

Slide 46 text

FRAMEWORK reusable set of libraries or classes for a software system

Slide 47

Slide 47 text

FRAMEWORK

Slide 48

Slide 48 text

FRAMEWORK Philosophy

Slide 49

Slide 49 text

FRAMEWORK Philosophy Design

Slide 50

Slide 50 text

FRAMEWORK Philosophy Design Good Practices

Slide 51

Slide 51 text

FRAMEWORK Philosophy Design Good Practices Backward compatibility

Slide 52

Slide 52 text

FRAMEWORK Philosophy Design Good Practices Backward compatibility Tools

Slide 53

Slide 53 text

FRAMEWORK GUIDE

Slide 54

Slide 54 text

FRAMEWORK GUIDE

Slide 55

Slide 55 text

DaFunk

Slide 56

Slide 56 text

Pillars

Slide 57

Slide 57 text

Pillars

Slide 58

Slide 58 text

Pillars Optimize for happiness

Slide 59

Slide 59 text

Pillars Optimize for happiness Cross Compilation

Slide 60

Slide 60 text

Pillars Optimize for happiness Cross Compilation Modularity

Slide 61

Slide 61 text

Pillars Optimize for happiness Cross Compilation Modularity Small better

Slide 62

Slide 62 text

Pillars Optimize for happiness Cross Compilation Modularity Small better Convention over configuration

Slide 63

Slide 63 text

Ecosystem

Slide 64

Slide 64 text

mruby + mruby-cli AroundTheWorld

Slide 65

Slide 65 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb

Slide 66

Slide 66 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb

Slide 67

Slide 67 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb

Slide 68

Slide 68 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end

Slide 69

Slide 69 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end

Slide 70

Slide 70 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end

Slide 71

Slide 71 text

Adapter Pattern

Slide 72

Slide 72 text

Modularity

Slide 73

Slide 73 text

Modularity

Slide 74

Slide 74 text

AroundTheWorld

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

$ ls around_the_world/mrbgems/ around.gembox mruby-context mruby-mock mruby-polarssl mruby-sha1 mruby-socket mruby-base58 mruby-platform

Slide 77

Slide 77 text

$ ls around_the_world/mrbgems/ around.gembox mruby-context mruby-mock mruby-polarssl mruby-sha1 mruby-socket mruby-base58 mruby-platform

Slide 78

Slide 78 text

Adapter Pattern

Slide 79

Slide 79 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end

Slide 80

Slide 80 text

lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !"" io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end

Slide 81

Slide 81 text

mruby-platform

Slide 82

Slide 82 text

mruby-platform C/C++

Slide 83

Slide 83 text

mruby-platform C/C++ - Posix

Slide 84

Slide 84 text

Cross Compilation

Slide 85

Slide 85 text

mruby-cli

Slide 86

Slide 86 text

The Pitch

Slide 87

Slide 87 text

Why?

Slide 88

Slide 88 text

Web API Mail Analytics Communication Monitoring Authentication Errors

Slide 89

Slide 89 text

$ my-cli

Slide 90

Slide 90 text

Who Github - Hub Heroku - Heroku Toolbelt AWS - aws-cli Trello - trelo_cli Slack - slack-cli CW - cloudwalk

Slide 91

Slide 91 text

CRuby

Slide 92

Slide 92 text

CRuby Requires Ruby

Slide 93

Slide 93 text

CRuby Requires Ruby Performance (Require)

Slide 94

Slide 94 text

CRuby Requires Ruby Performance (Require) Ruby Versions

Slide 95

Slide 95 text

CRuby Requires Ruby Performance (Require) Ruby Versions Packaging Problems

Slide 96

Slide 96 text

:(

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

$ GOOS=linux GOARCH=amd64 go build $ GOOS=windos GOARCH=amd64 go build $ GOOS=darwin GOARCH=amd64 go build

Slide 99

Slide 99 text

HAPPY! Felling

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

mruby-cli

Slide 102

Slide 102 text

+ = https://github.com/hone/mruby-cli mruby-cli + = https://github.com/hone/mruby-cli mruby-cli + =

Slide 103

Slide 103 text

mruby-cli Ruby Performance No Require Binary for each platform Simple compile and release

Slide 104

Slide 104 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 105

Slide 105 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 106

Slide 106 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 107

Slide 107 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 108

Slide 108 text

$ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb $ hexdump -C rubyconf.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF

Slide 109

Slide 109 text

rubyconf[] = { 0x45,0x54,0x49,0x52,0x30,0x30,0x30,0x33,0x78,0xfb,0x00,0x00,0x00,0x67,0x4d,0x41, 0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x00,0x49,0x30,0x30, 0x30,0x30,0x00,0x00,0x00,0x41,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04, 0x06,0x00,0x80,0x00,0x3d,0x00,0x00,0x01,0xa0,0x00,0x80,0x00,0x4a,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x00,0x00,0x0d,0x48,0x65,0x6c,0x6c,0x6f,0x20,0x47,0x55,0x52, 0x55,0x2d,0x53,0x50,0x00,0x00,0x00,0x01,0x00,0x04,0x70,0x75,0x74,0x73,0x00,0x45, 0x4e,0x44,0x00,0x00,0x00,0x00,0x08, };

Slide 110

Slide 110 text

int main(void) { mrb_state *mrb = mrb_open(); mrbc_context *c; mrb_value v; c = mrbc_context_new(mrb); mrb_load_irep_cxt(mrb, rubyconf, c); mrbc_context_free(mrb, c); return 0; }

Slide 111

Slide 111 text

int main(void) { mrb_state *mrb = mrb_open(); mrbc_context *c; mrb_value v; c = mrbc_context_new(mrb); mrb_load_irep_cxt(mrb, rubyconf, c); mrbc_context_free(mrb, c); return 0; }

Slide 112

Slide 112 text

$ gcc -o rubyconf rubyconf.c -I mruby/ include mruby/build/host/lib/libmruby.a $ ./rubyconf Hello RUBYCONF

Slide 113

Slide 113 text

.RB Review

Slide 114

Slide 114 text

BYTECODE MRB .RB Review

Slide 115

Slide 115 text

BYTECODE MRB VM + MRBGEM + MRB .RB Review

Slide 116

Slide 116 text

BYTECODE MRB VM + MRBGEM + MRB BIN .RB Review

Slide 117

Slide 117 text

+ = https://github.com/hone/mruby-cli mruby-cli + = https://github.com/hone/mruby-cli mruby-cli + =

Slide 118

Slide 118 text

+ = https://github.com/hone mrub

Slide 119

Slide 119 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 120

Slide 120 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 121

Slide 121 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 122

Slide 122 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 123

Slide 123 text

No content

Slide 124

Slide 124 text

+ = https://github.com/hone/mruby-cli mruby-cli + = https://github.com/hone/mruby-cli mruby-cli + =

Slide 125

Slide 125 text

DEMO

Slide 126

Slide 126 text

mruby + mruby-cli AroundTheWorld

Slide 127

Slide 127 text

funky-cli

Slide 128

Slide 128 text

DaFunk

Slide 129

Slide 129 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 130

Slide 130 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 131

Slide 131 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 132

Slide 132 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 133

Slide 133 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 134

Slide 134 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 135

Slide 135 text

I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end

Slide 136

Slide 136 text

Rubygem

Slide 137

Slide 137 text

Rubygem files = (`git ls-files -z`.split("\x0") files << “out/app/main.mrb”)

Slide 138

Slide 138 text

Rubygem files = (`git ls-files -z`.split("\x0") files << “out/app/main.mrb”) Gem::Specification.new do |spec| spec.files = files end

Slide 139

Slide 139 text

Rubygem files = (`git ls-files -z`.split("\x0") files << “out/app/main.mrb”) Gem::Specification.new do |spec| spec.files = files end resources.each do |file,dest| FileUtils.cp(file, dest) end

Slide 140

Slide 140 text

No content

Slide 141

Slide 141 text

DEMO

Slide 142

Slide 142 text

We're hiring [email protected]

Slide 143

Slide 143 text

Thank you @scalone THIAGO SCALONE - [email protected]