2016-10-11

on my name is Matt's immunity amor based on Twitter
and this are website we can find me up if you have any questions and i can
answer them at the end of this talk please send your tweets
and I'll reply to you as soon as I can before we start
arm I want to let you know it today is a very special that for many reasons the
first one is because
its the other was what the studio the dead I'm sorry through spending cuts you
like Thai course you might want to read enjoy this day
and tonight go get some margaritas and tacos um
in if you're hispanic and if you celebrate well a fun
and is also today my birthday out
so um
I i live in San Diego California but my mom is back in France
and she's always worried that's I don't have a lot of friends so I just want to
shore
I some friends I'm gonna record it and you guys are gonna sing for me please
happy birthday so
up in English is fine my most vexing which began speaking German to me if you
want alright so one
to 3 it
good
by he what
thank you it's also Brian help him birthday so
if you want to make you might be gone cold climates and give it a try I'm sure
we'll be really happy
all right let's get started on so before we talk about programming languages
i sat down with the linguists and I asked her
can we talk about human languages let's talk about its
arm I speak a couple languages but I want to understand a bit more
what he means I to study languages and we talked about it and she came
up with this theory that was a um there was discovered
quite a while back by two linguists course Appian worth
and they basically come up with the conclusion
that's um the way languages are design
of facts the way we see the world the world view we of
and we would be a few so it seems logical
%uh when you think about it but they are to actually prove it so they did a
little research
an example of that is a tribe that they found in the middle of nowhere I'm not
sure where he was
but this tribe did not go away
of talking about the past or the future so they could never say
yesterday this up until tomorrow we will do that they were stuck in the present
and do with it would be you okay alright
those who don't know we just walked in
today is matts birthday they just aren't for me
they fought fast I or
frustrated back I'll thank you guys
thank you person thank you thank you
for them they could've so after drinking now
yeah subrident
restricted by yeah
we could lol thank you guys ap
thank you alright so I was explaining that
languages affect or behaviors into
the world view and on this tribe really
was talking the present because the language didn't allow them to talk about
the past for the future
so based on that I wanted to study more programming languages but I'm not a
linguist
and I'm not I was not be good at school so I wasn't really sure how to do it
but I did what I could and I came up with a few things
first I discovered a few things you should not do
like this things that didn't work for me the first thing was to
study language was just looking at hello world and say
okay I don't like it i like it hello world is a very bad way
approve your language is like if you would hear one sent its
in one language and you judge the entire language based on that sentence
the sentence might actually doesn't mean much just the thing I realized is that
syntax
is a very by the way of looking at language it is true that is the first
thing you see
is true that when you look at and which look at the syntax
and you my i have feeling about it you might react
to it but it's actually not the right way of looking at the language because
the syntax Heights a lot of concept behind it
so how did I do it how do I think we should do it
what the first should look at the fuse a few of the language he should think
about it
what did the language what did the language is under
was trying to do with his name which or language also you want to make sure you
find
the right use over language you don't want to have
a Michael Jordan language playing baseball
golf because it just doesn't work and it's not because of the hens actually
michael Jordan uses hands on all the sports but he sucked the two of them
I so it's not that simple
but what you really want to do is to be curious about it and come up to the
language with new eyes
try to get a read of the expectations you out
the world you you coming from and try to look at it like it was the first
language you learn
and try to understand it so I study tonight which is
I came up with discrete and it was very boring so I said
forget about it I I Fergus on
seven languages and I was going to talk to you about seven languages but my talk
was about two hours long
and I realize of the seven languages only four languages I really like
um when I really interesting
I there are very interesting to study based on your knowledge
Ruby so I decided to focus on three languages
Cordier scallop and go
then on the second part of the talk I'm I tried
just think about how this language is affected
the way i right recut so
I do write a bit of this language is i right way more because then I write
closure go
and I'm sky code blood by sending this languages and by writing
some amount of of this all the languages
I realized the well was writing reba coach Ange in my view overby coach Ange
and my view of Matt's as the language is under actually also change
so the former Gov the talk %uh the language that you will be very simple
I will take are horrific loss so this is the example were create a class
we've to getters and setters i've a constrictor
I was taught method idea to create an instance of the object
and I call method on it so that's kind of my hero walt would be more complex
so I can call for languages and give you an idea of what it could look like
that's kind of my entry point into the language nice not a good we have judging
the language again
it's not a way of judging anything is just a way to try to
she take something we all know and apply to something else
than fortune in which I will look at a use case was the main use case
iPhone for the language was a few does a few what do I dislike
what do I I like about its and where to start if you want to learn the language
so let's start by go goes in English by Google
there was released a few years ago it's a call by language
um is a structural type language so what that means is that
instead of iving functions
taking a typed arguments
the functions would save will take objects that respond to a certain
structure a certain way
the object is defined so-called pretty weather means that you can define a
function
that would that could be applied to any object that
respect to certain interface an interface is basically saying
this are the criteria for bio project that needs to be respected so I can call
this function
on up goes also no object oriented language
which might be surprising if you reading study go
up but it's a fully object-oriented language but it's a lightweight
object-oriented
language and they're really revisited the way object-oriented
a programming works and they they took a different twist on it
is also fully functional language to get higher order functions
%uh you have anonymous functions you have all these things
arm what you sow gym do this morning in a keynote you can also do that
we've with go I not sure why you would want to do it but you can do it
you're earning go is actually easy to normal
I'm if you have any bargaining see slightly easier because there's a
constable the pointer
and you might not know what a pointer is but up because language is very small
you actually you getting the language really quickly and you can have fun
up pretty fast so here's an example of
the room because I should to you at the beginning 42 Ruby
so we define the package which is the name of the application where an
basically the library then we import the library which is like requiring Ruby
um then we create a new class which the commander for class
it's a type which is a strike that I sent you %uh members name and topic and
both of them are strings
and then we define dysfunction start that can be applied
to appoint a presentation class so here it is
now we could change that she would prefer to have an interface
to well on what's going on sorry
um so we have the start method the real return a string
and then we concatenate string based on the two
um a a very order to members name into a pic
for destruct then we have the function main that gets cold at the beginning
when the program starts
we create an instance of talk passing should difference
um arguments so mats and go for name into a pic
and then we print the output of the function
it's not too hard to follow us is pretty simple
doesn't have all the semi-colon sick kind of political will be like Ruby
but not too much so what's the main use case
um for me the base to skip the best use case will go
is concurrency and also that you
by are showing the example the sample code I wrote
and the idea was I want to call three web sites at the same time
and I want to concurrently Fitch 3 resources wait for it without blocking
and then get all the responses coming at the end so the code it
again we define a package we imports three libraries
then we define an REO strings that as three different your else
we define you type %uh which contains three
elements URL response which is
0.22 HTTP response which comes from that the shitty
and then in there so we can and look at the area if we
having their then um this is the entire
code for my application and a highlights
do you see of concurrency in go
so we have this function that takes to a bar on
which is in re: of strings and Reese will a setback
issue to be responses a narrow vision to be responses
and we create what we call a channel Anish channel is to wade kudos
concurrency
you basically have this this concept other channel that's in the middle
and we're gonna rights this channel and richard is channel so we don't
share memory by talking between the different threads or
however we do concurrency we talked through this broker in the middle
um which is a channel to create a channel thats Burford with a certain
length
and we create a on unnamed CRA for the responses
and then we looked through the Urals that were being passed
and we start this girl function so this is an anonymous function
that's a good function meaning that its a sink to get started
did separately can mean different threats or not depending on the system
resources
and this function would sector URL will print its
then you doing this to keep you get up the URL
and will respond with a total which is the response object
and will be the area code um that might happen if
the resources not available and once we have that we create this
object issue 2p response object that we um
defined before we create an incense so that and we
push it into the channel so this is the channel we have here
I'm finally we call this this anonymous function by
passing the URL that was coming from
um looping with you through the URL's
then once we do that we do a for loop so we just look
through which is basically loop and we say if there's anything in the channel
get it for me and if we have something
will Prince the URL that was that was coming from the channel
and then what up in the response to the IRA and if
we r all the responses based on the length the URL's
were returned that otherwise what we'll do is just print a little dot
and sleep a little bit so the loop is not too tight
so that's a that's the entire code to use it wherever main function
and we say call this your call a get all the URL's
and for his show them we're gonna print its and see the results
when we come by this code so in goal you call by two mission could directly
so you just a good deal this is the fight I have and you print that out as a
as a a binary as a machine code fide
and you can see actually comes back I I so want to fish this URL this really
this URL
but the order their comeback is actually different
so we implemented a very nice way we were sharing memory
of doing concurrency and go is really good at that who is also
good a lot of other things %uh but for me that's the main use case
forgo arm the mexican currency easy
so what's the future is a few of the language well out
really good choice to be the new UC
its tries to be on
a very simple very brief language you don't have to write a lot of code
you keep is very isolated he fits in your brain and its following the UNIX
philosophy so taking the
UNIX and see as an anguished next level which is concurrency
and that's really what a/c is trying to do what I don't like about this
about a good sorry what I don't like about go
is that it sometimes to be true low-level sometimes
I wish you was a bit higher level um so we could do things that would be more
accessible for more people
I'll there's also the fact that good doesn't have a really good garbage
collector
see if you compare with the JVM from of course the garbage collector is
not as good its descent and you can get really good
performance as also limited adoption
so that's not really true anymore since 1.0 good released
and I'm a lot of people start using its hempton captain
who roads how more amused that in this company for very interesting project you
should talk to him about that
Google uses it also install the and um
they replace a bunch of c-bus postcode by go including
arm a project that they have to let you don't know chrome
every time you go and you don't chrome the binary arm
day at issue plus plus front and that was taking all this request and using
conference it to fit that in the replace that by go
%uh the other thing I don't really like it comes from the standard labor
sometimes showed some weird conventions are be surprising to me coming to the
language
I guess I'll just get used to it so what do I like about go
well the specs of the language are so simple
I actually can't get them to fit in my head see if you compare with Ruby
ruby is a very complex language and
trucks we for the specs is is hard because you have a lot of pics to be
taken to a lot more things
who is simpler and I actually enjoy that when I write simple code because I know
exactly what the language will do
and I know what to expect the senate libraries a
of gore really really good you have everything almost in the standard
libraries
from up up put to go for aren't you all the
the net issue GP a rhythm libraries you have
a up you have Jason yet you have everything I can run looking for
specific when I can remember it
you really find most of what you need you'll find it in the standard libraries
and they're really trying hard to do that
a concurrency we so that's your this concept of Guru teens and the channels
that are very efficient
and a very simple way of thinking about conference without having to use walks
and new taxes around a lot of the conventions are actually sensitive
even though it sensible even though I complain about it the first
the first light I'm you'll see that when you start using go
that so you this is organize your language even have a tool that tells you
how to format your code you can run it
and basically reform its you code so it follows the convention
um MX thinks easier when you get started and then when you don't know the
language and it also helps when you have a team
of people trying to the follow the same conventions
competition is fast you can call but a very very big go up faster than you can
starts a good up Rails application so it's really really quick
a real city so but up is still really fast
was on no it's not setting a very high bar
%uh it's basically a almost as fast as running a scripting language
are in some cases so it's its is really fast you don't really feel like you have
to wait five minutes y compris
um do we organize the code is fixable you don't have to do with the the Seaway
that this concept of package in a way that things get called by then
the linker is really smart it's very nice way of a fuck doing it especially
when you come from a scripting language
um take on object-oriented is actually very interested in a dean of time to
respond to a lot of time
on that but I would really challenge you to look at how they
thought about object-oriented and how you can of types and
more or he married since the way they do it which not the usual way
and how you can share functions between different object types
you also have all the features a functional programming that we love
coming from Ruby
on the air handling is actually very interesting in Ruby
oh you know in go because coming from Ruby
from Java we use to raising exceptions everywhere a few israel's
you know if you don't find a resource which is raise an exception and then
we'll do some control flow
in go if I just go by quickly um
you can see here I was
returning I do initiative to get and if
got returns in their these value would be
field with with the air on the ways will be no and I cannot
actually nor its in the idea is that um
if you raise an exception you will need to catch it at a higher level
and now you actually rich concerned that the suppression of course earns
because code that's above needs to know about because that's an uneasiness you
know how to handle it if there's a problem
and it's not always the right thing to do so what they do in goes that you
actually have to end all manly there
which seems a bit odd at first when I really like it and I'll talk about its
towards the end what one I will explain what a change in the way i right
would be code documentation is really good for go
are and you can go in all the packages you can see how their rights their code
in go
any mix things are it makes it for really good way of learning
I'll to go syntax and how goo
authors writes their neighbors so you get started
%uh the website for goes really good going that or the other two were you can
follow different steps to do it in the browser you don't need to install
anything
%uh get started you have a bunch of books a the book on the right is a cheap
book that was
it's a community book at that was written by
a somebody in the community the other ones a professional books
it's pretty easy to get started I would suggest you spend a few hours just to
see if you like it or not
and us if you can challenge you
I let's move on to something totally different we're going from she will to
release
scheme wall and we're gonna talk about closure
through who actually knows but of course her have if you're in okay so
actually bunch of you already tried quarter so let me share with you my own
experience and you might disagree with it but that's my experience
so closure is a call by language its dynamically typed but you can also
mention on types so you can say this is a function
anyway actually return a specific type to the computer can up to my six
what is free to dine with dynamically typed language
it's a functional language that tries to be as fun trust pussyboy everything
should be
a least everything is that up it's not technically reach you all the time but
they're really trying hard
it's also object-oriented so that's what people don't always
know about a quarter and actually push people we like to say that but
also to you it's also object oriented because
a quarter tries to be a practical implementation of scheme and sometimes
object-oriented programming
makes a lot of sense the learning curve foreclosure is normal to nightmare
and the reason why I put that is because starting is action not to two or twenty
you get
you stop thinking about C programming and you understand how to you
write code it's actually pretty easy to get started
but the problem I had with closure is as I was learning more and more about it
you need to know more and more functions and you need to have all this think fit
in your head
and you need to be able to score tix switch back and forth and that becomes
really hard
out for me at least in the long term
so again example
awesome example is the beginning we define here a protocol
so this is not an implementation this is just documentation by per ake was cool
talk
and as a function call start thats I will return the speaker on the topic
then I create this record which is basically like a class
call presentation that us a text to arguments in a release that name
Anto peak then here I implements I basically say I'm implementing the
particle
call talk and I define this method core start
that doesn't take any arguments we don't care but was being passed
and would return a concatenated string of the Seas I they seized the name
that's being past year and I will talk about the topic
then to create an instance love this record
we say they have talked that's going to be my instance presentation dot
it's the dark here as a presentation Matt and and closures so this is
the least there will be a Scooby um
extracted here and get these two variables and then I call start
talk so you can see are scheme reads from left to right
okay so this is the example in object-oriented programming now most of
the time when you write closure you don't really write coli got I just
wanted to show it to you
because that's what I did for languages so the best use case I found
foreclosure is that %uh processing um
data processing is basically the idea of we have data we want to go through the
data extract some value of that
and our process it and and had to wait and do something special with it
%uh use case for that is I want to count all the words in a singles
a fine name and this is a tremendous I won't go through it because
if you've never seen closure up or skinny might be a bit hard to understand
how things work just for the record I had to actually Google that
this here operators cause thrush operator
and that's it I just had to kuwait I want to share it with you to show that I
know something and I learn something
are so thrush operator great up
so in this case you can see the code is not too big
and word processing data and we're just passing it through different functions
so what's the philosophy of course her
well defuse a fee is policemen scheme
are really good really like this language is we like functional
programming but we want to get something practical
because fully functional programming languages of some
but then it's hard to build concrete things with them to do something really
I'll efficient we don't have all the libraries on its not efficient
you're not the libraries you don't have up potentially good garbage collector
you don't have all the things you get from the JVM so
incentive reinventing the wheel is just put yourself on top of the GVM
try to get all the Java developers to come over learn some
arm some skin but also offer some other flexibility
of calling doing the Interop going into Java
um and also doing some object-oriented programming if needed
so why I don't like with closure is the fight that
I was lied to I felt I thought you would be very simple
I thought 0 I'm gonna be able to get disclosure thing done in a few weeks and
then I'll be an expert in closure
which turns out you know it took me a while and I want I even took classes
and I still feel dumb when I write closure I just getting the namespace
right
I just never get the syntax right which is another point because it's not always
consistent
even though he tries to be courses that is actually not always consistent
the other problem I have is that you need to know a lot of functions mike was
need to know what did you
you have a really good command line tool that would give you the documentation
for it but
I find myself having a very small brain and having
a hard time keeping all that in my head and I have to look up for functions
all the time so great if I was writing closure every day 8 hours a day though
probably
after couple months or years are probably should be able to handle that
but right now I've been having a hard time with that
a small issue at as I I was thinking a.m. gonna write web services enclosure
I'm gonna do cool stuff I'm doing with Ruby but I want Corkran see something i
right
closure code instead and turns out that the corner community
is not very web oriented it's really about data processing
so even though you have a few libraries and few frameworks are interesting
most people don't really care too much about doing normal web
will be stuff they would you web related stuff good morning the data processing
is
sense of of the word
another big problem I had is the mental context which
if you go from closure to Ruby from quarter to Skype from closer to anything
you you always have to take a few minutes and just think we would
this is closure this is high right in when you go back to the other language
to something
and finally one thing I really hate and this i really hate
I really wish with fixing closure is the error stock absolutely meaningless
ship any problem with coarser you have an exception of something happening
there's no way you could guess what it is and I for stuff I was just repeat so
I asked experts in like arm
finished let's look at this was gonna wonder said what you did wrong
and that's not really the point about being your stocks
so that's a primary wish they would so
up quickly so what do I like about closure
well I can tell you for data processing this is beauty
awesome you keep you could very simple very focused
up you get it done its you really isolate things
and you get good performance you can also use a giant Europe so if you need
the library
are you need to do crypto you can actually end up using a Java library
you have libraries for a lot of things and you can deploy this thing really
easy
on the JVM so it's it's something I'll
the fight it's easy to use its an easy scheme that's practical
and really good for data processing so how do you
are you get started we have a burn venture books are really good
I personally recommend um you go to this URL
on um you take the cat so this to basic a bunch of exercises that teach you the
name which
by going through step-by-step a sewing small problems learning how to write
scheme in quarter basically and that's really good way of learning
and then just take a small project and try to do its
enclosure alright this move on to the last night which
scallop so Skylar is probably the closest language we are from Ruby
I this from my perspective um
before I get too far into that I just want you to stop in and explain to be
one got
about Scott skies a combine language is static
inferred dynamic types are an actual so structural typing
so most of the time you do start again in for typing in for typing means that
if the compiler can guess the type of the object
you don't need to mention it so um
usually what you do is when you write a method you say
this means that they disarmament and you would you find the the argument types
and the return you might also want to document it and you
all the ways you can be guess most of the time when you actually
implement the method inside the block usually don't
type it you don't have to actually said the types so
if you come from Java if you don't have to have a you know how annoying it can
be to
or even objective-c I've to to settle the type of all the time
and special income from Ruby um sky comes from
basically brings that kind of notes in a TV love in between these two things
the dynamic typing is a new feature you can actually turn on dynamic typing
and just out Skype being written like Ruby
not sure why you would want to do that but you can do it
it's a a fully object-oriented language like Ruby and a fully functional
language
like Ruby the yearning four score is between
the learning curve is between no more in heart I think to get started with sky is
pretty easy
because you can rights come out the way you write Ruby code um
its or Java code it's actually interesting because you end up writing
this code it looks exactly like
you Ruby code you like oh yeah I can rights Cup
and then you take this code and you some that US can I experts
and it looks I'd like to this is the worst car ever don't do that
out but he helps you because you feel pretty you start writing code
I'm so I I was really a purse strings can i buy
Mar so we know from from Twitter any Kennebec became my mentor well i right
would be code its car which is bats can I basically
and I sent that to him in sac okay this is what you gonna fix you do this this
way this with this way
and MX alerting faster however
arm skies a very complex a very rich
which and you have a lot of things that sometimes you might look at night what's
this superior what does i mean and its it's a bit of putting in this was a bit
harder to learn it's not as easy as go for instance
so how does he look like well we define a close call presentation
that text to arguments a named arguments
name into a big guy strings here we say their value and basically what that
means is that once their past they become
immutable very values in the class so we can call them from outside the class
and they won't be change my name in the topic one chance through the
presentation so that's fine
are we could use variables but I skies trying to encourage you to use imitable
tight if you can
then we define here instead of defining a function we could define a function
we don't have to we can about value that
abtech all these parents and that's a constrictor
creates the start object which is a value
then we say I want in your presentation pressing matter in Scala
and on then I call rates talk that start
and evil return the string so what's the use case
can scratch my head on that one I'll basically
it's good for service-oriented architecture and its whenever you need
more enterprises Ruby
so enterprise you would be some pretty bad for a lot of people
um but if you come from Java and if you need some other things
are you having shove it. structure built a big thing that needs more than one
rubican provide
Scott I is a good alternative I'm not saying you should
pics kinda in so Ruby what i'm saying is in some cases it might make what upsets
there's also a lot of it that you might enjoy the language and
the academic approach %uh the design is actually also interesting
so to take an example I'll talk about how Twitter
use chemical so finley's library that we wrote
to and all the service-oriented approach and this is how they do it
and I don't work a Twitter so I might be wrong and explain to me off we are
iight I learned property when you send an issue to be request goes to an issue
2p proxy which is returning scalia using finna go she's the library
and that's being pasts into the API Twitter dark arm
and points J shit EP and here it's a US for all my tweets
they're gonna split the requests and they're gonna send some other request to
the user service
so they can get some information about you and host another thrift
requests to the time line service to get other information
and then from there they gonna make some other requests with the back ends
and then everything will come back and get a group together and come back as a
as a response for the user so
they build a system using futures and pipelines
so what's the future what's a pipeline well the future is basically saying
I will return something in the future but not right now so just
wait for it it's like a a system goes up to over promise basically say
I'm sending something you'll get it but not right now just wait for it
and the pipeline is basically saying you get a bunch of you send a budget request
at the same time you get them back
and then you you you create one response to send back some work
so the way they implemented incidence cut-up should be the sky code is like
that
say this is my with indicated user would return
future over user and do that we call user daughter into Kate we passed email
the password to that
looks like normal reba code but what will happen is that
in this specific case in one region right away would return a future object
but the value user is not yet available and then to look up the tweets
would get future of a sequence of tweets you can think of it as as an RA of
tweets
and for that week authenticated user which is the object we created before
would you flat map which is that like Ruby um
and then we have land that we have a block so it's basically like a map in
Ruby
but in surviving a the two pipes I
should be fine user use a user and then you have the facts are 0
and we're passing the very the value that will be returned by here
inside this call to say whenever you get to it then skated user
Senate strict with fine bye old user passing this user any will come back
better way or more dramatic we love writing this code in Skara
is to use the four yield operator
in here we say on get this
whenever you get that get that um user
put into this user object
or variable and then call this would find all user and pass the tweets to
response about
in the subject and then gonna yup that so that's how you do
a sink code I was cut out in the Twitter
library so you end up we've a single walking or not going and what you want
futures
you get the flu I'll the the frontal programming aspect
and the object or object-oriented aspect
other sometime arm this is just implementation of a server I'm running
out of time so I won't go through it
but I'll we basically define a service we defined in the address
and then would build a server bypassing
the name the codec we want is going to be issued to be said of Thrift
then we buy need to be addressed and then it will link its or build its
using the service so the request will be sent to the service
there I'll coming from Ruby
you will see that skies a lot of things we already know you have the cross above
innumerable which is functional programming basically so you have all
the maps the inject
are the partition DC police things unanimous methods already miss functions
you have default arms you can do me to program the you get a new method missing
which
you probably should not do in Skopje you can do it duck typing
a you can use make sense they have actually across above traits which is
like a different and make since but its
my same and turns out because a lot of Ruby people end up
ended up doing Scutaro and because a scar community just liked it I guess
they picked up a lot on testing so you do it you have good
I'm testing library like r-spec that's being poured it just kinda and
on you also have a built-in testing from one that's pretty good
what you do get that you don't have sorry shut up
the first one at least we got in your methods so it's kinda funny when you
turn Skype because you define a first method to say
def through and inside that you can define
def bar & Co it from inside but it's basically scoped inside this method
so you end up writing code their lives in the sky above the method
that's actually quite as a gun when you get used to it
you also a Bleezy a bus and streams which is equivalent to of
Ruby 2.0 a louisiana Merkel's see can create infinite loops
or infinite streams or collections
and you just keep on going through them and so you find what you need
and day valuation is done if you remembered what jim was saying this
morning
in Ruby um we evaluates the arguments right away
in Skudai you can choose to evaluate them right away when you pass them
or later on and that's how they implement Ecclesiae vase the day
I was part of the language you have a great garbage collector
which the JVM 1 performance cut I is
way faster than dan Ruby um
looking at very small benchmark in smoke was pouring it was between two to 10
50 types depending on the code you write and what you do arm so
you get a really good performance improvements and you stay more dates
with the same
refuse a fee %uh is also faster at least from what I saw on the benchmark say so
enclosure just seeing if you do functional programming
iPhone sky faster than closure which surprised me but at the same time one is
compile at one is tied to the other one is not so much maybe why
and finally the thing that was surprising was to fight that actually
really enjoyed using an ID
um are using to Egypt cuz thats that's what Marcel to me to use
and I just listen to him and turns out a being able to be inside a function and
click on on a
variable and get the interdiffusion on the variable what you can do with it
is it's nice be able to get its the errors being caught before you
right you run them runtime: is also quite nice because
that happens in Ruby quite often you call a method that doesn't exist on an
object
and you catch it pretty quickly with test but I think the tools
around the language is actually quite nice
if it is a fee of a on Scala is basically Ruby
minus scripting plus started typing that's kind of how I said it's probably
not the way I Scott personal presented to you
but that's the way I see it and it's really for me the academic version of
Ruby
iPhone that's that's car up being written by a professor at the University
of
over goes on in Switzerland has been thinking a lot about what he wanted to
do you were the first one of the for
one of the first compiler for job either when I still being used and you played a
lot this knowledge
into the language design and you don't get
the freedom you get with Ruby you get a more accurate version of it
so what I didn't like: with an anguish is that first has accused her face
learning all the types the collections to operators all this thing actually
take some time
I'll they're not really hard and if you have to have an alleged much facets much
user but it's actually a huge the learning curve can be a bit impressive
at first
you get started you excited and then you want to do something be more complex and
you realize we I don't know what to do here
the syntax is often abused or he feels abuse you love
a the con carne with plus a big inning plus on the other side will do different
things
have all these different things out a bit hard to to learn
the documentation not a great I
it's funny but it's just coming from something I can make you would expect to
have good documentation and I found the documentation not be that great
I not coming from Ruby we use to that or we were used to that's not a big problem
I felt that scott try to do everything
and nothing in the same time the fight that you mix object-oriented
and functional programming I find myself with the same issues I had with would
get the beginning which is
I have 15 ways of doing this thing which one is right way
and if you do Python you know in part the only have one wielding one thing
but Matt's was really nice and said you know what in my language I don't want to
force you to do anything
and your you're free to do it because I don't know exactly how you gonna use it
which give us this powerful language but when you learn its and and that's my
case was cut up
it's always a bit hard to know when do I do this how'd was too wide we love doing
it
and is there right way I'm not sure about
and um finally the JVM is something that I
I like it and it's my next five minutes sometime I don't like it I wish I had
something smaller
that was I could just ship in my application that would be just
lighter and now the screen is a big thing I don't fully understand
so what do I like about Skype were first I feel really close to Ruby or Python
I feel like when I write sky I'm not lost it's not a different world it's not
like when I write closure what's different meant
mental shift um it does a lot of work which offers because you can you for
sure programming
the same we doing course you can do in in scar so I find that
4 thinks we're not really sure if I want to flee from
entrepreneur not I would have a tendency to go to scuttle because I'm more
comfortable with Scott and I
with closure because it's more fun in your its easy to get started because
again it's close to what we know
in for types are great because when you start writing you cut
you don't feel like the type I just getting in your way or they don't get in
you as much as if you write on the language its
start that strongly typed statically typed
up the functional opera is flexible you
really a focus on parle is a min concurrency which my knob in oil other
languages
pattern matching something I don't have time to talk about but if you come from
earning
you know what it is um it's something you have been scarred that I find very
interesting
the ecosystem sky is quite reach iPhone love libraries
a probably because of people like LinkedIn and ska and Twitter and other
people using its
the community is rich and you can
used the GVM and the CLR which I didn't realize until I study the language you
can actually run Scallan dotnet
which I wanna do it but you can
school so how do you learn its well
um your district we discuss course Twitter Road
they have this this all curriculum truants a sky when you join
Twitter and they actually published at you can actually do that and good food
is it or scallop which you can go when you find it that works you through
learning the language and you have the coarser online class
%uh which is which is just finish and is really amazing was seven weeks
of classes there were taught by Martineau this key the languages I nur
and if the matter of Skara and are it was a lot of fun be good exercise you
can probably will probably start again and get
don't think losses available probably online
so I'm running a bit of time sorry about us how did all this learning
affect the way right repeat because again over the asteroid will be
more than I write all the languages so somebody asked me this question and I
was thinking about it as I
you know I'm not sure %uh in a discussion with Brian help camp
because he was writing some the code any was doing in object-oriented where I
said you know what we should do that in functional or
which actually use federal program in this case and we had this discussion
about why and how
the first realization I add I am engine really sure that this morning during his
keynote
is that Ruby is ask motion or as it is object-oriented
nice not currently functional maybe what I just said is wrong
um its it is if it's a it's a functional programming yup
a functional programming language you doing enough to our imitable types
to be a functional programming language and
on often when we think about Ruby will anything about the 00 aspect of it
we do use blocks we do you slept as we use um
we use functional programming but we 10 up don't want qualified
we want to do everything object-oriented and I realize well
this is too bad because we have this two-part dikes and we should really
embrace them
because the language designer beyond that wanted us to use district things
because there's value in both
and they are both complimentary we can find we just need to find the right
place to use to write
heard I so when do you do that
and I don't know who really good answer I can just tell you what I came up with
which is based on the feedback at from the scallop community
and I'll articles I read from different people
and basically the concept in sky cleese is
functional programming should be used when you extend your program
with new operations when you extend your program with you did up
use object-oriented programming instead so
said differently if your date up doesn't change
you can use functional programming if you deduct chance and evolves
then you probably should use object oriented programming
if you want more arm information about that when I came up with common find me
at the end send me a tweet we can
we can discuss about it %uh I'm not quite sure
I can actually write a blog post to explain with specific use cases
um but I find this guy committee was a good community to you
to discuss these issues and i think that I spotted the Ruby community we should
do the same thing because we have the same tools
also something we probably all know um it's not because you can do something
that you should do it
it seems logical but when you look at whatever because we write
we have a tendency to do a lot of crazy things just because we can
and are I would like to thank mats giving us all the slicks ability to do
all this crazy thing
because it's a lot of fun and we can explore its but at the same time
remember there's an implementation unit one language
upon implementation and if you care about performance if you care about
I think the people maintain you could you need to think about the way you
organize you cut which is not specific to Ruby
but think about side effects thinking about me to programming
complex code up wanted to do object oriented everywhere
there's a cost you that she need to think about it because it's not because
Matt's allows you to do it that you should do it
that's a very good guy a very nice guy wants you to do everything you want
doesn't mean you should typing
I realize I actually like typing arm I remember a few years ago was thing I
would really like to %uh octial typing
in Ruby I would like to have this option because in some cases
if you have a phone a method this method takes an argument call name
seems logical to you that he might be a string but he might be action object
that represents
string that's something else being able to define an API and be able to have
this
API contract saying my API Texas arguments and they have
this type would they will respond to this methods
some we go does its up and
I would actually I put this type of information is very useful
in specific cases especially when you write libraries
if you right way BP ice its actual so very good thing to have
now that's different topic but typings actually not that bad and evil the lot
and now we've in for typing
with him tight big what structural typing you get a lot of value
arm that you don't have one you just have to read dynamic typing
also realize that testing is not documentation
so a lot of people talk about that I won't spend too much time on it
I'll but when you don't know language going it s and try to understand what's
going on
is a nightmare arm when you go and you look at this was could have language and
you see exactly
what the input is expected with the output is
actually he helps a lot you should keep on testing issue right says put
don't forget to also document the way your software
you program be apes and what is being expected I'm not explaining I'm not
asking you to document everything line
or the inside of the method but X ache explain the outside of it
error handling I talked about that when we will look to go I have a tendency now
she will return the stillborn RA of two objects
one is the object that comes back from my method and the other one is a
potential
air that can be raised that can come from the object
so you can actually create an exception object and not raise its you can the
senate
and lets other people above it handle it so usually opportunist do that in my
library's the way I do it's
so I won't make a request if something goes bad I'll return it as an object
and I will decide if I want to raise an exception or not Wi Fi want to just pass
this information back to the people will use this library and they can decide
what they want to do
I'm not for sure it's a good idea I just feel like using exception
for control for his not the best idea ever all the time
sexually probably a bad idea but in some cases were you make sense
so let's move on compilers
actually I realize computers are much fun front much more fun than they used
to be
arm they don't get in the way as much as they used to
like this maybe I just got better um and I also realize that
if my code can be optimized for the Comber sick if Mike
compiler can understand the way I write my code and can process that
he also means that my brain wassup should be able to handle it better
so II said it's changing will be the way I write code
an ike study keeping my structure simple so if you have an RA
in Ruby you can put any type thing re: you can actually start passing different
type
objects um and
if you have a comprender usually compares the light that unit just to put
a special thing you object when you send out
and I realize well I could actually right will be the same way would rights
cutoff for instance
and just its choose one type and stick to it most cases
and that it would actually keep my could much simpler
I don't have to check on the type of the object is being passed around to all
these things
I end up with simpler code dad
um actually ends up running also faster
and this is when I realize a once again simplicity matters
and Ruby gives us a lot of flexibility a lot of options to do
really complex code but will solve the functional programming aspect %uh
Ruby which forces you to keep it simple because you cannot build something very
complex with while you could
but he looks only really quickly and everybody would yell at you if you do
that if social programming language
but if you have 10 there's about struction nopee
people one really complain about it if you can love Ruby code we have this very
complex code with 10 different abstraction layers
and people think was good look at my method is only five nine two three lines
of code
but actually it's not that simple because when you look at the object
graph
and how you call this method it's very complicated
social programming is one way of helping that and and what I'm trying to do now
is when I can I keep my code simpler by
sometimes switching to functional programming for very specific
use case so %uh utilities journey
iced then I find myself please because I came
show you what I find I some limits Ruby
which is good because in everything you have limits and
if you understand this limits that means I can peak what's best
when is the best time to do that and I came up with three points
for what I think the limits Ruby are
performance concurrency and freedom
so performance is an issue we know and it's actually a heart problem because
its very much like on currency is based on the language design
you cannot everything is a compromise and you cannot
of something very flexible and also very performance
or you can but it's really really hard and would take a long time
I'm so you need to choose not performance is a word that means
everything and nothing I i realize that
up people think what that means for be slow
well rubias lawrence kudlow then go enclosure
well you know what its most of the time is fast enough
and I write web services and I did that for Sony Playstation
and I do that now for Living Social and we get a response time between five to
fifteen minutes seconds
writing would be code this is fast enough
I cannot justify even though I would love to just play with this other
languages and write some of my services
I would not get a much much better performance gain by using other
languages
icon currency is where it gets a bit more tricky and a lot of people talked
about that
I want go too deep into it bought it
there's a bit of a problem with rubia this at this level
you can get conference in different ways it doesn't mean you can't
im just saying that languages I came after ruby
like this we were just 30 they have day when they were designed the thought
about concurrency I'm sure when Matt started designing
would be in 93 a when you release the night
e83 was not thinking well conference is a big deal
and that's going to be the future of programming he had threats
NES we have a lot of cool things in ruby that allow us to get conference we can
use multiple
interpreters we can do a lot of things but that the language was not designed
the same when you're languages
our Design and the last one is freedom
freedom is what I get when I write Ruby
freedom is me is basically max letting me Mac
any sex I want and not getting in my way it lets you explore what I want to do
you
the way I walk but there's across this freedom and I need to be willing to pay
it
in most cases I'm willing to pay it in some other cases
I can't afford this freed on and I would choose to restrict this freedom by
choosing another language
that makes compromises that a different so at the end of the day
looking at all these things I realize I'm not a repeatable for any more
actually I'm not even the devil per I'm
a problem solver but actually that's what people like to say and I thought
about it and
arkansans bat I can I can imagine this guy
you know this small desk in white room with a small window just solving
problems and people just bring
their problems to him there's a slight type yeah i fix this problem
and you know if that's my life that's a bit sad
because I don't want to be stressed solving problems all day long what I
want is to build products I want to build something
I'm and I'm not talking about the start up cost up to I want to have this
up and I can make millions of ovett I just want to build something something
that
that would change the world for me or just a few people
something that would make my life easier somebody else like easier
so you know what the language you use is just a detail
you can use Ruby can you Skype can use PHP whatever language you use you can
build a great product
the only difference is that if you don't choose wisely the language
the way we will solve this problem will be affected because languages as we saw
at the beginning
shape the way you solve problems and solving problems
is the way you build products so choosing language
can affect the end result of your product
so you need to be curious pic any need to learn new languages
and the reason why you want to do that is because you want to think about how
to build products differently
you want to solve problems different ways seek an end up
we've or the results and there's nothing wrong with looking at other languages
and going back to the one you know I can say you know what's right Ruby
there's nothing wrong with Ruby or in this specific case
I'm gonna take another language because the Solstice prime deferred any big sets
what's very valuable ways when you learn other things and you go back to write
do with you right Ruby and no you're right Ruby code in a way that's even
more efficient
or that seems to fit better your brain it just really good feeling
so go and bilawal some stuff with whatever language you want
design or language of fun with it understand the concept behind it
and just enjoy building stuff
thank you
well

Show more