Slide 1

Slide 1 text

Happy Programming with CoffeeScript 高見見龍龍 photo by yukop

Slide 2

Slide 2 text

a.k.a Eddie or Aquarianboy Live and work in Taipei, Taiwan. Serving in my own little tiny company. Flash / AS3 / Ruby / Rails / Python programming for living. Mac OS user, Objective-C for personal inerests. Technical Education and Consulant. PTT Flash BM (since 2007/4). Ruby Certified Programmer (Since 2012/1). Adobe Certified Flash Developer (Since 2006/7). Linux Professional Institue Certification (Since 2005/3). 高見見龍龍 photo by Eddie

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Intro 簡介

Slide 5

Slide 5 text

Popular

Slide 6

Slide 6 text

Powerful Popular

Slide 7

Slide 7 text

Complicaed Powerful Popular

Slide 8

Slide 8 text

Before photo by Razlan

Slide 9

Slide 9 text

Now photo by Razlan

Slide 10

Slide 10 text

seems easy photo by apple apple

Slide 11

Slide 11 text

photo by Marcus Q

Slide 12

Slide 12 text

Today, I am going o ell you..

Slide 13

Slide 13 text

Happy 快樂

Slide 14

Slide 14 text

photo by Nick Humphries We’re not alking about this kind of coffee.

Slide 15

Slide 15 text

Not this either. photo by naotoj

Slide 16

Slide 16 text

I have no idea why engineers like using food as their project name.

Slide 17

Slide 17 text

Jeremy Ashkenas photo by jsconf

Slide 18

Slide 18 text

2009/12

Slide 19

Slide 19 text

and I sared o use CoffeeScript since 2011/5

Slide 20

Slide 20 text

and I sared o use CoffeeScript since 2011/5 because of Rails

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

yet another new language !?

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

"It's just JavaScript"

Slide 25

Slide 25 text

just writen in different synax

Slide 26

Slide 26 text

borrowed from Python, Ruby and Haskell.

Slide 27

Slide 27 text

and would be compiled ino JavaScript code

Slide 28

Slide 28 text

JSLint Compatible

Slide 29

Slide 29 text

So, it's still Javascript

Slide 30

Slide 30 text

"hmm.."

Slide 31

Slide 31 text

"It's just JavaScript"

Slide 32

Slide 32 text

"It's just JavaScript"

Slide 33

Slide 33 text

"I think it's just CoffeeScript"

Slide 34

Slide 34 text

whaever.. WTH can you do with CoffeeScript?

Slide 35

Slide 35 text

anything which JavaScript can do.

Slide 36

Slide 36 text

front-end, back-end, mobile.. ec.

Slide 37

Slide 37 text

but with less line of code.. ~ 30% off

Slide 38

Slide 38 text

CoffeeScript compiler is writen in CoffeeScript

Slide 39

Slide 39 text

photo by Bryan Gosline Is JavaScript that bad?

Slide 40

Slide 40 text

photo by Steve Ganz the good parts

Slide 41

Slide 41 text

CoffeeScript = English-like grammar + nice Synactic Sugar + Goodies

Slide 42

Slide 42 text

Syntax 語法

Slide 43

Slide 43 text

indenations rule, whiespace maters!

Slide 44

Slide 44 text

} } } }

Slide 45

Slide 45 text

} } } }

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

String Inerpolation

Slide 48

Slide 48 text

greeting = "hi, " + name + ", " + msg

Slide 49

Slide 49 text

greeting = "hi, #{name}, #{msg}"

Slide 50

Slide 50 text

semicolon

Slide 51

Slide 51 text

semicolon

Slide 52

Slide 52 text

var

Slide 53

Slide 53 text

var

Slide 54

Slide 54 text

->

Slide 55

Slide 55 text

say_hello = (msg) -> console.log "hello, JSDC"

Slide 56

Slide 56 text

var say_hello; say_hello = function(msg) { return console.log("hello, JSDC"); };

Slide 57

Slide 57 text

default parameer

Slide 58

Slide 58 text

say_something = (msg = "JSDC") -> console.log "say #{msg}"

Slide 59

Slide 59 text

var say_something; say_something = function(msg) { if (msg == null) { msg = "JSDC"; } return console.log("say " + msg); };

Slide 60

Slide 60 text

( ) is not always necessary.

Slide 61

Slide 61 text

greeting("eddie", "how are you");

Slide 62

Slide 62 text

greeting "eddie", "how are you"

Slide 63

Slide 63 text

everything is an expression

Slide 64

Slide 64 text

return is not necessary.

Slide 65

Slide 65 text

var hello; hello = function() { return "hi, JSDC"; };

Slide 66

Slide 66 text

hello = -> "hi, JSDC"

Slide 67

Slide 67 text

Array

Slide 68

Slide 68 text

var a; a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

Slide 69

Slide 69 text

a = [1..10]

Slide 70

Slide 70 text

Loop

Slide 71

Slide 71 text

console.log i for i in [1..10]

Slide 72

Slide 72 text

var i, _i; for (i = _i = 1; _i <= 10; i = ++_i) { console.log(i); }

Slide 73

Slide 73 text

console.log "YES" if oday == 'JSDC'

Slide 74

Slide 74 text

Sugar

Slide 75

Slide 75 text

yes, no

Slide 76

Slide 76 text

A: “would you marry me?” B: true

Slide 77

Slide 77 text

A: “would you marry me?” B: yes

Slide 78

Slide 78 text

console.log "go home" if oday isnt "JSDC"

Slide 79

Slide 79 text

OO

Slide 80

Slide 80 text

Hello.prootype.greeting = function(name) { console.log("hi, " + name); };

Slide 81

Slide 81 text

class Hello greeting: (name) -> console.log "hi, #{name}"

Slide 82

Slide 82 text

class Hello construcor: (@name) -> greeting: (msg) -> "hi, #{@name}, #{msg}"

Slide 83

Slide 83 text

var Hello; Hello = (function() { Hello.name = 'Hello'; function Hello(name) { this.name = name; } Hello.prootype.greeting = function(msg) { return "hi, " + this.name + ", " + msg; }; return Hello; })();

Slide 84

Slide 84 text

Diff? 差別?

Slide 85

Slide 85 text

Your Brain JavaScript Browser the Original Way

Slide 86

Slide 86 text

Your Brain JavaScript Browser the CoffeeScript way CoffeeScript

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

lots of languages that compile o JS http://goo.gl/nkAkQ

Slide 89

Slide 89 text

Ref 參考

Slide 90

Slide 90 text

RTFM, it's awesome! http://coffeescript.org/

Slide 91

Slide 91 text

or my shameless promotion blog http://blog.eddie.com.tw/caegory/coffeescript/

Slide 92

Slide 92 text

Let’s get our feet wet! photo by jlhopes

Slide 93

Slide 93 text

Demo 展示

Slide 94

Slide 94 text

But.. 巴特..

Slide 95

Slide 95 text

CoffeeScript is not so perfect

Slide 96

Slide 96 text

Readability != Comprehension

Slide 97

Slide 97 text

People may still wrie CoffeeScript as horribly as they wroe JavaScript..

Slide 98

Slide 98 text

indenations rule, whiespace maters!

Slide 99

Slide 99 text

( ) is not always necessary.

Slide 100

Slide 100 text

Debugging ool?

Slide 101

Slide 101 text

You've beter have a human CoffeeScript compiler in your head!

Slide 102

Slide 102 text

Then.. 然後..

Slide 103

Slide 103 text

CoffeeScript is not used o replace JavaScript.

Slide 104

Slide 104 text

If you don’t know Javascript, and you think CoffeeScript can save your life..

Slide 105

Slide 105 text

you would be in trouble.

Slide 106

Slide 106 text

So.. 所以..

Slide 107

Slide 107 text

Who is using CoffeeScript?

Slide 108

Slide 108 text

actually, I don't really care!

Slide 109

Slide 109 text

Who won't need this?

Slide 110

Slide 110 text

People who don't like CoffeeScript.

Slide 111

Slide 111 text

People who already know javascript(the good parts) very well.

Slide 112

Slide 112 text

Who might need/like this?

Slide 113

Slide 113 text

someone who don't like ;

Slide 114

Slide 114 text

someone who don't like { }

Slide 115

Slide 115 text

someone who don't like the PROTOTYPE.

Slide 116

Slide 116 text

Rails developer

Slide 117

Slide 117 text

Anyway 總之

Slide 118

Slide 118 text

Should I learn CoffeeScript?

Slide 119

Slide 119 text

Is it worth it?

Slide 120

Slide 120 text

IMHO 拙見

Slide 121

Slide 121 text

You should..

Slide 122

Slide 122 text

learn JavaScript!

Slide 123

Slide 123 text

learn JavaScript!

Slide 124

Slide 124 text

learn JavaScript!

Slide 125

Slide 125 text

learn JavaScript!

Slide 126

Slide 126 text

.. and use CoffeeScript !

Slide 127

Slide 127 text

oally worth it!

Slide 128

Slide 128 text

I can't go back anymore!

Slide 129

Slide 129 text

give it a try

Slide 130

Slide 130 text

Happy? 快樂?

Slide 131

Slide 131 text

END 結束

Slide 132

Slide 132 text

高見見龍龍 Conacts photo by Eddie Websie Blog Plurk Facebook Google Plus Twiter Email Mobile http://www.eddie.com.tw http://blog.eddie.com.tw http://www.plurk.com/aquarianboy http://www.facebook.com/eddiekao http://www.eddie.com.tw/+ https://twiter.com/#!/eddiekao [email protected] +886-928-617-687