Wednesday, October 05, 2016

RailsConf 2015 - Opening Keynote


are
are
are
well welcome on
it great to see so many people here in this year
on even I can actually see you I'm imagining that you're all out there
on so this year
we're going to release railed by on
pics here
love people clapping for what they don't actually know what they're gonna get
around
both the whether you're clapping at the end hahaha
and surrounds live is is
as the numbers suggest the Fed major release
up Ruby on Rails in 10 years we have
release the major version of rails every two years
since 2005 I started working on
rail-thin 2003 and it took us about two years to get to
1.0 and then I'm somehow magically as clockwork
we managed to push out to release every every two years self i think im
maybe last year we can look at the rescheduling said I'll we've been now
releasing a arm
major version every two years let's just say to dad that was the plan
related to your schedule I love yesterday's weather
it somewhat easy to predict I'm
but there's also something out I'm
funky about 5 I don't know why didn't I realized certain numbers feel special
but it feels like a milestone maybe it's because it's
sorta 10 years a major releases sir
or whatever is but when I started thinking about
1i wanted to talk about I at this ralph clark which i think is
with the 809 I remember
I think 2006 was only sir we drill comp I thought about this
this question on I think about
why and particularly sought him out
a personal y why
am I still doing this like
it's been 12 years it's been the majority of my
adult working life I've spent building
will be in health & products with it why
I why am I still here show
that question so does goes to
to the route have something I find so interesting about software which is
shoppers about people and
people are about motivation would drive them
I what other values and
I where they come from and I think
if you understand dad you have a much better chance to understanding
to have the software comes out that I'm
for peeking behind the curtain and looking back to NC like what were some
of the stuff coming from
I spend a lot of time and an often tried to
sort of do that too at the soccer project
I look at a piece of software and I just be fascinated
arm and how did you arrive here
I how did you amass in the early days 2009 to XML configuration like what went
into that process
i'm just fascinated I want to understand truly
I'm and %uh process and I mostly use to
to comedic effect in sorted poking and other up
communities ruling the supreme works or whatever so I got
on this sort of fifth major release I should to appointed in work still
and look at my own motivation and why I'm still doing the stuff
and what is it that actually drives me to do this and
there's some obvious answers is not just one answer is with just about anything
I'm one reasons obviously site what the community
I love what we have here I love the interaction that I have
almost on a daily basis and get help pull request in
on the mailing list stir
on Twitter or campfire any other channels that we have to
to Air Act and thats that's a lot of fun but
that's not bad not the whole
reason i buy the community some involved with and they're fun to
and I didn't necessarily be spent 12 years
pouring in tons and tons of my my time into that
so they can be a fulfilling wholesale
argument that another argument
which is for the 1i usually go to is that sort of
hedonic motivation abuse I just enjoy this this is a pleasure to do
writing the code is is a privilege and a pleasure and
I really enjoy doing it so that's reason enough in itself then he got very
compelling I'm
but there's also other things like to bring and if
again other things where do poured in that much time
show as I could have got deeper and deeper
on in the introspection on on widest and I'm still here
on I came to some things are a little more primal
perhaps and
that should've been part is switching motivations I guess that's been
happening over the years for me
is that when I so now I would rail C wis
it was Donna just enjoy doing Ruby anyways
sort of necessity I needed to
to build rail to bill base camp in we'll be back in the day
but over time dose two things to Ruth
a 1 per kilo been a routine and the other thing became not really necessary
anymore like now I work with a bunch of great programmers a base camp in
I don't necessarily need to do everything myself but
as that was happening arm
I also started
to casually stuff in the accumulation of stuff
to me houses beautiful
that's great like it's great to build the company it's great to build up
popular product it's great to use rail to do all these things
but the dark side of that to me at least
is it comes with this invitation to appear
to a growing fear that all the sudden you have something to lose
and if there's one thing I absolutely
fucking hate aids that nagging sensation of having something to lose
biggest immediate wanted the prime drivers who fear
in fear
there is one of the prime drivers have also too bad decisions
also to on
short-sighted conservative
said I have thinking
that's about defending stuff and
I think onto that beat is a I've watched that happen to
by the people I'm nor observed another company's
what happened to companies and people when they have something to lose
I talked about this a bit in in 2012
a keen about progress show I can develop this many fear
the fear of the fear up losing something
and I can't decided
part came through in Spurs respecting arrived at the fact that I've decided
that
was not to succumb to that I'm one is a river
great discoveries for me personally over the last couple years about
have been no to reading about stoicism
and stoicism is is all about finding your tranquility in your life and sort
of content nissen
and to happen is I'm by racking and fear
I reckon if you have all kinds and
the way to do that is to address them head-on
and action vitamin and so have a look
I want those fears is a distinguished this fear of somehow waking up
and it was all gone like all the stuff that I
spent the last 10 years building gone
something terribly happened either through my own
screw-ups or force majeure or
meteorite hit a data center in Basecamp which wiped out in
always or whatever bad thing you could imagine that that would happen right
is not necessary because you thinking any through
I directly about these things as as
you sending this fear but is there aunt
that we're sure if this
notion of but
today I work with 47 wonderful people at
at base camp in and I join that so much I'm always talk about to go to lynne
Kennedy this so it's great to work with these people for ten years and so on
and again in that building up this something to lose
right so if I'm going to tackle this personal fear
mine that all the sudden I'm
it's gone and and I'm just left all alone again
break if I'm going to tackle that
well first I'm gonna should have accepted and like that could happen
like that could totally happen I people time thing I had this is just gonna
the gravy train is going to continue forever and it's gonna be wonderful and
we live happily ever after and did something happen in did
they don't rate so I can open about this
mentality bad you probably have
address the fear that I could be left alone
in this world just me I had to become the proper
I had to become
self sufficient and not dative
calamity struck I have my backpack and was locked and loaded
and ready to go once more just just me
just like 2003 you're left to your own devices and you gotta figure shit out
that's what brought this to me
it's Mike prepper backpack it were a prude
all this stuff that I'm like yeah I the world is gonna end in the Sun be a cop
apocalypse is gone awry damn well better have my shotgun
or might turbo links or my active support
all our my Active Record and they'll be locked and loaded and I'll be ready
but so the paper
mindset which I really find fascinating on
I read this interview a while back with with the sousa preppers
and I thought it's so easy to
look at that and it black like period
the Samba Cup popular not actually gonna happen you do know that right
but that's not really what about fears of in this
irrational thing and punter people walk around the entire life
with all these fears Polop and they never dress and they never
verbalizing here's a group of people who willing to say I fear the zombie
apocalypse
or nuclear fallout her do act is going to end in some way and I'm gonna be read
attacks commendable your addressing your own personal fear head-on
been trying to tackle that on good for you
the one thing perhaps a place where I i disagree is that
that preppers at least as as perhaps they're typically a line
like they're happy with this I that
shit like aftershock gone in a have my dried fruits and might
can match the ball pen my shed and
been upset like hey I'd actually kinda fear that like that's not my
idea sorted salvation so
to get a hand like a
I'm greedy think doesn't have to be that my backpack is good enough that I can
build
tallest building in the world most luxurious thing and and I can live there
ever after in some little Island in the Middle East
on I just want to be able to recreate things to a good state
I could just build my own little personal
house again and it could be a place where
love living once more thank you wonderful like that some thought a
modest
at least in my you have the world
approachable goal but I can have on
secured to aspire to but not so unrealistic after like that never gonna
fuck happened because better shot if you should because this is all an illusion
anyway
right hopefully um
that I'm prepared for this so doomsday I just want to be able to
to not recreate Internet scale
web-scale I somebody else could do the for
seventh star hotel equipped galley nanoscale I just would be able to break
when he thinks again
which is really what the backpack a Braille
is all about and all tuned towards this on a middle
successful bad middle tier up
companies up applications on
again something that sort of stretch goal
yes but theoretically attainable
recipes to me I could not directly attainable but I'm gonna
as a single person bill Google
right like that that's not gonna that doesn't work for this
illusion I'm dreaming up for myself one is a fighting chance I
I i'm not going to just sort of go down fall over
to my peers and and let that ended up
I want a fighting chance I want that backpack to be ready and packed I want
to feel good about it and I want to feel good about
reich go with it okay
showed that sort of the value I'll
on is a deal of self-reliance
but that should be possible but somebody today
should be able to pick up this backpack and I've assembled for myself but I feel
good about they can take the backpack
and as one person they can have a fighting chance
I don't actually care about building software for
sort of teams have hundreds I
that's not what fires me up that not what
he passion about open source is not what gets me
excited about doing another twelve years I love pull requests
and arguments about the bike shed
on were fight me up is about that one person
dat is starting out
from scratch with nothing everything either ended or they just begun
on and they have a fighting chance so
if that's the value the key principle
that I i and choosing to derive from this
sort of what the actual product like this is also a little
party AC guiding
motivation stop but with that actually mean was that actually do
was that actually lead any
for me the in Leeds through
integrated systems this is how
I feel that there's a chance
to have a fighting chance but I'm not gonna compete
on if I'm going to
you send an architecture in approach to software development that requires me to
build all these separate
individual entities better serve optimized for being very neat n nice to
cut off and separate and and perhaps have a whole team around
a that that's know what's going to do it that's not what should be in the
backpack
the backpack should be into what the difference is
what I mean by integrated system so through
working on base camp for
a decade on think europe grew
a bid from just being a website right like today we have to
not only make website we have to make your website for small devices we have
to make apt for small devices
we have to have all these outlets for for the application to be able to make
the kind of sorta nice little house
absence i'm talking about. nice low base camp and I thought get up in a closed up
by
on if you want to do that through
obviously have time to wait to do them right on
a very common ways is to say okay well we'll have the website that's one thing
got that whole thing going to start one more time and I'm gonna build
all nothing we're gonna build up and I went to okay
to figure all that out bill all that contract ok shit and right fuck
and thought about that let's go back to some
need another sort of team around him own damnit
iPad I like different mentions gotta go home to think that too
that's not a stretch cool to meet that issues
and unplayable mountain like that's not gonna happen
on my own I can't delude myself into thinking that I could build all the
things from scratch
on my own so
I go back to what can I felt I double one system I can make a damn good
I can make a brief stop and I can make it do all the things very well
a good enough which sounds like
sort of in Aaron Patterson thing like adequate software
it is adequate and which is fine
I'm actually a big supporter adequate software on
and I think about this and as
sort of I'm going to think about it so what is integrated systems means that
II love this quote not quote law
every every quote a sort of work if something is up for the moment has to be
a
law I have exactly lighting system
nice cool but organizations with the sign systems are constrained to produce
the signs which copies have to communication structures have the
organization's
I usually use this quote to the ride and poke fun
overly complex enterprise the SOA
architectures have sprawling mass as suburbia
but it can also be pointed in words and describe why we'll have to wait is
because
the organization structure of self-sufficiency and self-reliance
is the number one right to investing keeping your optimizing for
got to my think very differently then if you're optimizing for building software
completed by hundreds of people on
interfax that's on the philosophical angle of it
and if it was just that I wouldn't be so
bullish on the point is also the practical England bid
on about maybe five years ago
on we were playing with what
now come to be known as a micro services with Basecamp
I we came up with this features like I basically a text
document inside a base camp and we want to use that featured multiple APs
and like I thought to my Christmas
tactic on now I finally have a chance to
sprinkle HTTP out over everything and it's going to be
correct I am so
week we put it first made it as a stand-alone act called right for dot com
than
put it into Basecamp unlike here been put into
backpack another product we haven't the time and I was like triple year
like this now work three times this is wonderful
right on until sort of
like that with the party NN and making the hangover The Hangover was sort of
trying to operate this keep this thing in sync
dealing with the dependencies between three different apt moving in 3
different paces and
Inc to handle was not a fun at the party
like it really is on
but that was not a part of what you have to sort of moment
in you career in your life crap that with
cut the scar and then help direct your bike
yeah I'm I'm not going to do that again and you just say what that was just one
case and maybe you were just
stupid than did in a poor way here been up the tools that we have now and will
be wonderful
I don't know I don't think that's the case on
which varies me to say thank you very sad music anything
because you get can respond so I could just keep talking and making
proclamations up where which is really what I'm doing to do
cell bit old for many suiting the uniquely well
on and aside I'm
friend sorta I can
I didn't come up with I'd chose this notion integrated systems because that
sounds cool
that sounds great like yet integrated systems like
things working together and like the sign to sort of have some knowledge
which other and
the flip side or the negative term for dips damn same thing
is modeled right that's third-term up the racin the people usually use
to talk about
things they think you're sort of to pick
and and model is usually implies that I'm
sort of there's no cohesion arm
and there's all quibbling coupling I'm not
note that work on and ensure that that's a that's a strong man
or the argument for it right like that wireless router
just poor suffer thine be they're just the big ball
spaghetti mud it actually looks
I don't think that means anything like a big bowl of spaghetti much I think that
legitimate
just stick I think Majlis
are fucking awesome I think they're really cool
but I'm also sorta accepting that the word has now been
tarnished and damaged so been rebranded
that's what we usually do in the software industry whenever something is
that have tarnished in
one out would you slap a new name on it sell the same damn thing and you're
gonna love it
integrated systems
that's where that I'm
and I think this comes back to want to talk about
last year which is as a as an industry we constantly searching for this
recipe is recipe that's going to talent exactly
the right does that this thing and not being in design make delicious of work
if I can just follow the recipe back in just find the magic
recipe then I everything to be wonderful
so when you look at them sorted
whatever supper brought your on right now and you like Jesus this is a model
and you say that would reach in and yet
sort of this is would you really mean is that this is just bad sophomore
right make your fucking monolith
doesn't look like this if it looked like this you wouldn't be complaining because
that is the majestic modeling I am
and I really I like how architect would be put it best
I see you have a poorly structured modeling would you like me to converted
to poorly structured data micro services
where
which really gets to the core bottle is which is that
you just have crappy software right but that kinda sucks to admit that you just
have crappy software so if you could just come up with an excuse
you can eradicate the fear that he was somehow
your circumstances are your ineptitude to your liking
experience for your just bad idea that I could now because I've had plenty of all
that
that took you to poor direction and you ended up with bats of when you wouldn't
because
you made one application and it's not going to get better because you make 10
applications
okay arm
right cell
I kinda to might get a little carried away sometimes and
it kinda by up about on
integrated software but at the same time
if that would you want to do if that floats your boat fantastic
route 5 the mother
of frameworks for micro services
for if you want to use rail through
to create that set up and have a lot of different
things bets are off derive of 180 I base and it's really neat unstructured
that's wonderful we have a get into real five and
you're gonna love it and a5 and you're gonna hated and a
year too but that all good because the meantime
you'll be blaming me and from
we get to work together I think that the other
that's the thing I'm I really love about the the ruby in the res community
is that even if we feel so passionate about certain things and I feel really
passionate about the
majestic model is an integrated software and how wonderful it is to pack your
prepper backpack I can also think
well that's fine but if somebody want to collaborate
on Active Record I don't give a hoot
which deity day choose to prey to
at night whether that is the altered microserver sister or
the one true model ed on
week it's not a any could still be wonderful and we can still progress
on and that's great so
rounds five gonna have a slimmed-down
freshen up the bass default when you want to start just an API app doesn't
have any views doesn't have anything else
on can use be used as a backend for Klein side NBC
on
it can be used as
sold anything and we can collaborate in all these other
a tools and frameworks where that's all shared
and that's wonderful arm I
which tell you a secret that is not the feature necessarily a Browns 5-10 I'm
personally most excited about so let me get a dose
I'm
and now to release for some people in the audience they're gonna think
East rolling now is in the arm
Tamblyn
braid I know
I know some people call me like
Paul
have arm and the only reason I don't have like
stronger reaction to is
i've seen it so many times before
on as we go through things as ASCII development
from scratch in as sort of an idea starts in one place
and by the time to love and %uh federation said
gone through it we end up somewhere else entirely and on some people love it
rest Butler
piece for some people yet the pipeline
for small subset perhaps cop script
on they're sort this
transition phase which I find is
strongest with people who was a Roth arrived at like yes
okay I have my setup now I pack my personal backpack
my personal property back back in a consistent these things tonight
got this duct tape and put these things together myself and I
really like it and now you coming up with the thing that kinda summit the
same things that I already had my backpack
I i don't like it pic I have my thing
that's working well yet that that the great
on
in it's a toy not suitable for writing real modern
ambitious sophisticated web applications at
that the quote I just made out because that sorta in bed now I process
sometimes the feedback up what I'm hearing
on about troubling said and I i think
yes most things start out as as sort of a toy
as an experiment something fun how's that a bad thing
with the fact that toys become like the terrible
president Abdul you're not serious enough
if you play with toys pic I love toys I've always liked or didn't bad with toy
sorry we don't have choice
we just the dole shit
no thank you cell
here's Johnny I am
to release three is as the
number suggests the third major duration: general even with me that it
sort of
talk about like by witnessed 5 me wifi
special I think in any way take
again it's so much not about the software like that version numbers reply
to think do you mean anything
we just christening this committed but this is the one
why wouldn't want before the one app nope this is the one
I'm but the social thing it's how we talk about things that how
we get excited about things like you guys just
helping transpired I don't know what did but could be great
and that's exactly the kind of duty as a man to power the version numbers have
and its it's magical
on a way soap
tumbling three ran to get the code now
it's up to them could be any code but this can pick up the thing about Emily's
3s
it it's getting greedy traveling with one into started out we soar over
modest hope that okay while
we we want the speed I love sore single-page applications we want the
responsiveness have that
publishers to know the whole page becomes the first experiment right
knows the first staff and first approach a bad and I worked very well for subset
of applications where you're not keeping anything permanent around from
sorta page to page just about making the transition between the pages really fast
what not all applications are like that right
so their plan your applications were simply good look at toppling think we
p.m. like bbm maybe usually not but
idea maybe but it doesn't work for my app temple in three
is expanding sure if the circle the app's that this will work for
I'm by making it possible to absolute ease release valves
in places where you can have some persistent Dana
sums client-side state and mixing it would stop the Disney in
so this is up typical example right
are you making any comers ap artis a catwalk the cam lock
is stat everyone sees the same catalog everyone sees the same product
descriptions images and so on so forth
that stop you really want cashed
your dispatches possible to said
everyone seems something anyway perfect case for caching
you have this card the cards per you sir
picard is on buddy this example
kar stable across the pages and usually the problem then is well
fuck now i cant make Nike taxes pet
pages right is that can unlock a good catch that
but the page also has to cart now I can cash it boo hoo
I'm gonna make the whole thing as a single page application no
I'm in
usual we're going to do
show in the caps lock being
the gallant so sections article two products and and links to put it into
your cart all the senior stuff
which %uh please now we're adding a new attribute called
data turbulence a permanent permanent means that this
part up to Dom will survive page changes
the same bed will get moved over as you move between pages
if the same element is present now the really cool thing about this is that
when you send out the initial page there's not going to be anything there
it's going to be an empty block waited to be lazy what it because that means
that the initial page request to be fully catch super duper fast
and in you subsequently request a lacy noted
cock its gonna fill in the side and when you've done that first initial request
which only happens on the first
sort of visit to the store is now carried over
she can keep that state which means that you can
sorry keep displaying the products that somebody's put in the car down in the in
the sidebar and
and that's great on pics can
live on from page to page that's a pretty big level up from what
turbulence have before it's much closer to what a lot of people within
perhaps prior hopefully have chosen sale I have to make this as a whole
sick project and the way the flow goes is so
you put something in the cart it's just to promote I
link which leads to a controller
budgets creates an item in the cart and then the controller
what have you you could've done it with the view I like this fall
I like this flow because there's nothing specific to the on to do I'm just
calling a link
to put in cart remote there's nothing specific to the use I don't need any
jobs from that side
I'm what I do do with the JavaScript is I set up this card right
so this has a little little bit up the client on a PC right
like we're keeping the car around from from page to page which the dash
or sprinkle that's the word I'm
and then ukraine an item for the card and goes into your cart and then
respond with the pizza beats him out the same PC based email
the rendering a design in the goes into the car did you can reuse it other
places
this is for were coming back to this idea of degraded system
did you never have to recreate any here
templates and you're reading using the same it's over and over again
you only applying to sort of expensive fancy
arm client site ABC JavaScript techniques when they're absolutely
necessary and when they're not
up as in the case a percent in the catalog you don't
you boil it down dumb it down as much as possible to straight up a female
on and much faster much easier to deal with not accept a
streaming video session for example this I don't even know on conference side
whether they have like comments
I've seen on another site it's a typical example of have an app that
invites you to build it in as a single page app right
Tony bill despite turbulence 3 so if you
again imagine that this a stream going in there's a live comment
thread on besides being up there you can add to it other people can add to it
you get updated if you look something like that
and streaming video section then there's the you decide which is the comments
seen under this is actually marked up with any specific tripling its
on decorating
then when you add a comment something interesting happens
good usually the problem with the streaming video thing is if you submit a
form
and then it reno to go to new page month in the video is not really playing
anymore right
reloads and it resets in like that doesn't work well with this
you can use troubling to say I only want one part at the pizza chain
I'm remembering the whole damn thing by
I'm only changing in the DOM comments
see change comments that matches the
ID obvious I thats ID comments
so in look at those two things and say well out
I'm only gonna change was one element of the DOM a keep the video playing
this is gonna feel bath consistent
no hiccups in the video in Toronto for awesome this
by the way is sort of why I think perhaps
turbulence this time around has a a greater chance have
striking resonance with people with pooh-poohed the idea in the past
is that there's been another sort trend in the JavaScript world that
popularized this idea that know what maybe arm
too weak binding and maintaining all that crap was not the greatest lady in
the world
right react rear ender
the whole damn flow whenever something changes do not try to manage an update
these individual
little bit to stay if you subtract a bad idea
tip-links is much the same thing just happening from a service I perspective
is that apply to perspective on
which my world means a great system means I can use will be it means all
these other beings
I'm that I hold dear did we can share the same sort of
philosophical underpinnings that sound as the reactor approached us
don't my hope that hopefully this will on sort of
take a summer that way another common example
about the page that in the past you got problems
representing well in now
on on which Apple Inc and in with that
traditional approach to to engage in a moment is
content with a personalized navigation so you have something that says
high demand or we have impact counter you have all the pieces and bits of
information on a per-user
and they're paired with this generic content that you wanna cash for everyone
well again much the same on
approach as what we did with the cart you tag one-party element data
turbulence permanent
it stays from page to page you can lacy loaded
and then all the rest the content you can't read as though it was shared for
everyone
and the app is much faster awesome so
good we've been working on this stuff
I'm went down got him a job if I they've been doing a bunch of work on
hunter believes lately be used to have a a client at NBC
framework all da Batman TAS that down
after a couple years they decided sees
its appointee will have to tell the search because like I can't get too
giddy
about like I want a phrase that and they're like are shipped a crazy to
bracingly then people get think like
now you just kinda rubbing it in she gonna be a little more
diplomatic about it that that trains
going to time ahead so decided it was not right for them
um
to use client-side mp3 for for their particular situation
with their group of people on and their stakeholders
can use cases snow baby I'm
said pocket we're proud and we're gonna try to tripling since that
and that's why we've sort of that's why 2.3 is here
because the great group of people at the head shop by just invested
so they've been doing all this work with turbulence permanent and
they obviously have cases that are all looks a little similar to that first
example love our
can lock in a shopping cart on
then we've been at Big Ten trying to get it from another angle which is
part of this problem
the integrated system in a in a world where on
the iPhone and Android and all the some things exist is that
bet a lot work to recreate that all that stuff again
and we'd don't want to do that so good
traveling three we're working on basic creating
native versions of the app which is when I think native versions I mean it's a
WebKit and whatever the hell with kids called in and write
rappers that work whip I am
temple length: says bed links and so on are automatically intercepted
you can do these super duper fast page changes it feels
amazing and it's very hard to tell the difference between
ok this was a native PAGE this was not in a two-page big it all in
you can release it as open source because it's awesome
so bats 0.3
I'm pretty excited about it I hope that down even if you didn't like
the concept initially maybe react has change your mind on
the with them two-way binding San
and so forth ended may be subject but no luck
okay so
being that's great I'm
this is greater action cable
so everything we're going to stop
at the moment which I mean that I get to play with new
tact in a way that I otherwise wouldn't have it to revisit some sort of core
foundational assumptions um
and and play with you stop which is always a lot of fun and when things have
been playing with a bunch
is WebSockets so WebSocket server
pretty damn cool and during recent
sort of I don't think it's obviously choosing loan applications already
I don't think jews nearly widely enough and it's because
dealing with WebSockets so on the metal is a pain in the ass
is a pain in the ass currently for some at the same reasons that
JavaScript used to be more pain in the ass because there's different
implementations
there's different ways different browsers keep the connection alive
whether you can tell somebody is locked offer or not and all the sort of
different ways of working with the WebSocket is it is kinda painful
so where they're working on what doctors for this new stuff I'm working on
on I thought this can't be describe a great application I can just rip off
it much easier if somebody has done all the work for that and we just look at
something else and we can rip it up
i no such luck unfortunately
so
actually left on time teacher I did rip some stuff up from
from Phoenix in Alex here is done to really need work on
sum this up and you'll see some other reflections in it but I can never
anyway broadening the horizon
making integrated system capable of dealing with more
types of things using the same system
not home when I have to build an additional
element you just want it all in a row to I'm
this is that this is Pinterest and hats one of those exams I was using before
for turbulent
where it has 8 punch up stuff that's common
perhaps I can be cast a reason in this case we watching it in your pager
somebody engineered
collection and the math is building up in the corner it's really hard to tell
on the screen but the inbox
and has a number it says like you at three new thanks
well does three new things I'm
obviously those are the ones that are special to you
and have to be updated all this other stuff the blue stuff his older stuff but
sneered well to update that counter a hot how do you do that
they could updated only when the person changes pages
well that kinda sucks if they're just on a long page and something comes in they
don't see it
well you could do polling if you're interested you to polling
that probably sucks till I and it said he's not real time is not bad I actually
having to be
sort of thinking police is a reasonable thing to do in a lot of circumstances
pot if you can wait make WebSockets
even less work and polling why would you do it
I would you want to live if you could get a lot another example
if you want the on Nigerian Prince
span as soon as it hits your inbox anyone know about it right away whether
you also have the opportunity
love getting twenty one million dollars from somewhere in Nigeria
then
I would not have patience is a really great way to get that doesn't require a
native app but how do you say peace out
nothin of course the whole purpose if what medications is that they show up
right away
your notification about something live how do you deliver them
with notification or with sockets
again is a great way of doing that you're striving to
something that since them down and you get them right away and then finally of
course
the prototypical example is used in every single WebSockets
tutorial is the chap right that even more interesting than the other two
examples because the other two exams were mainly just subscribing examines
this is both receiving and sending stuff
now we made our
I i cant find 2005 and
use polling at the time you know we polled once every three seconds and
surprisingly that about the resolution the people don't even notice that
on but that was ten years ago
we base you haven't touched it since so
that's another good example something like okay Nick
work grown up to 10 years with the Pacific better and even better
what if there was something we could take all these three use cases
even in the same app and use the same system to build it
not that would be really cool that's what action cables
so action cable
it is concept I've ever you sir
creating one connection to the application
one cable that cable
it's a WebSocket connection you run one per
tapper browser per native app for whatever so when do so can have multiple
but
one single session will have one connection over that cable
we lay our different channels those different channels for the individual
use cases
I just showed you three different channels there's a chance for the Inbox
there's a channel for the web notification and there's a channel for
the chap
no reason for us to great three separate
WebSockets connections to deal with that we just need one
impinges in to leave the stuff it's kinda similar in some ways to
what ATP to is gonna be like where you just have to one connection
UN relief stuff as it comes in much faster
much better way to do things and finally got the concept that the broadcaster
the mechanism on the server side that sends stuff
through these channels to the use it
and back in action in
action cable is using red is pops up because red is
is amazing and super duper fast
and pops up is just stupid simple an easy to use
on is greater so
this is basically my very sophisticated into pricey
on diagram explaining how
action gable work I let's look at some co so
him when action cable on
as I said to create one connection power session per tap
for whatever you happy when you make that connection after indicated
met when they think they're not really this is certainly not well dressed in a
lot of other
WebSockets sorta set-ups I'm
the way we're gonna dress it is that to initiate a WebSocket connection
you just finishing an ACP connection and then it switches over
so you can do your authentication in exactly the same way you would do you
have indication
on a regular web request you choose to cook it
to support for part number is already locked and but they already would be any
way to see the Inbox to see the chat to see so and so forth
so this connection on
it looks kinda like a little bit like a control right a good looks a little bit
like I
before action filter something like that artworks different here is that
with the before action stuff that only last a lifetime that single request
what a point about WebSockets are is the they're consistent
the persistent so when you set this this is a long livid
or long living threat no longer just a throwaway
day now let's go back to the table at the ER up the Inbox and walked through
that all the way
so activity with this
I'm set up you need a couple different
you that initial cable connection issue yet that's just there to do with
indication is this issue said with the current user
then you need a channel to say I want to consume some stuff here want to consume
what's going on in the Inbox
and needs to happen in javascript so the JavaScript says I want to nap
and then on the on the server
you need a broadcaster something to push stop into the inbox right
so this is kinda
what the JavaScript I have stuff look like right now is all a cop a script by
the way
Ivan and
a work in progress and so on and so forth but
cook you create a new JavaScript side
on channel by descending from
action cable channel on that channel as a as a specific name
I'm in this case were relating that channel two on
I'll to DOM element that was that little
icon up in the corner that says to right now that saddam ailment
I we like to do it with the behavior so call that day to behave your inbox
to win over way to refer to it when we set up the document initially
we can instantiate is some this channel as a
sorta a persistent thing we're just gonna put in in the namespace
ap inputted whenever you want to this old Saurabh structure and setup can work
would
pretty much whenever preferences you happen to jobs website
I we like to do just with plain old
copy script is no additional framework here except for the fact that for sure
inheriting from per metre cable now with this thing here is that the one method
called received
so when you make them when you stand she ate this inbox channel
it basically subscribe to the service centers I want everything that's coming
in
to this inbox for the current user
right with something does come in you get a call back to get received
and that if you dated the Danish is the jason is the hatch
up this topic comes down and in the case of the box all we want to send
is when there's a new thing when I can permit the counter I'm
great we have to have a corresponding channel on the server side
that actually that's how you set it up to taiwan the connection is made what
happens when
this instances in fancy or this class is instantiated
it creates a connection to this inbox channel its rotted
automatically we have a sordid little built in router that's where the channel
name goes through
I'm at automatically
matches up with Tian with the impact channel be called connect
at the first thing I'm just like when you're creating there
cable connection crapped out great or connect when you create any additional
connections to the channel to cost like the natural
and all doesn't this case subscribe to at specific
I red is pops up channel and that red is pops up channel
we have an Aimpoint we just pick a name of the current user
you see here at the channel for the channel 4 users just
inbox underscore the idea of the user to just be one per
per user so you have something to send to Ivy caps made it here
in a in an inbox class I'm which both
is responsible for being the broadcaster sending stuff down to the client I'm
but also responsible for keeping the the state that the sandbox keeping the
counter
this exam on just keeping the counter as a in reticence while
I'm I really probably think the pair very well with redness
like a lot of these things with the WebSocket stuff not only from the pops
up
perspective of having a cue to send things out but also from the perspective
of having any sort of data store for transcended
read it issued phenomenal fantastic on
it so good it back that usually my first instinct whenever I see a
sort of raw piece have axis middle is like I'm gonna build a framework in
Parliament
I'm red is very well the first thing to have not felt that like the data
structures themselves just expressive enough that
I haven't identified in the could be extracted out
you as an aside in this case what happens is that there's something out in
the system for example when you
send a message or whatever its gonna call are inbox
increment for that user it can be a call back
it can be a specific game controller can be wherever you want to have it Ill call
incremental when something new comes into that uses inbox
Dell Inc ferment the counter in readiness and will broadcast the count
back out
and that count is going to hit the I
received it can I pick the tax and pool
you see K
is kinda seemed it's funny when I went through talking like
seems complicated right like this 3 moving pieces known zone
and they remember back to all compared to writing this
directly to the metal it's extremely not complicated on
but it to register when the nature of the beast let's extend it a little bit
let's be able to send something back the other way to so this inbox at first they
could just receive stop that's nice
but perhaps you also just want to be able to clear the count I don't want to
deal with the
a box come right now we have a little except in the corner whatever
what we're going to do here is is on the jobs from side gonna
method called clear consent that back what does yours is called action
clear which is basically a remote procedure call
is gonna call back to the in Bachchan on call clear on that extended the impact
panel here
282 same thing I'm still a little further where you can see with connect
again these channels too long live
the frets so you can act he said instance variables
and refer to them later when you get these are the call back to instantiate
the Inbox
and in a clear which is cochlear in the Inbox and
the inbox when called clear system clear the readiness
and is gonna said the broadcast counter by zero back down
with new about this set up base on the client side
we don't actually maintain the state there it isn't clear
it was naked when it the cleanup because that cleanup will happen automatically
when the practice it back out because cirrus and back out
so all recipients are going to get their sandwiches are not think it's really
neat about using this
approach especially with on
multiple clients so if you have the same tap open
across five different things they all at the same connection they all to practice
in channel
they'll clear on at the same time okay need
on not a quick example here our prom up the wet notifications
again that's just to receiving channel on
hears 8-year-old called II ripped it straight out of what I'm currently doing
to to put it in there but all that's needed to to make these notifications
no case is gonna be sent down -ism again as the days on
title body you're out I'm using turbulence to go straight to it so when
you click
want to these notifications ill use tripling to go straight to
to that page that its notifying you about if the if the thing is open and I
i focus on the screen okay
at for check
the more media example so
inch and I'm just taking one last pic you because chad is actually a larger
problem that
that take a lot more clout than this but let's just look at at one example which
is up
receiving data from the chapel so in this example
on I can receive to tap different active data I can either receive
at typing hint which is the will better
information that says our jason is currently writing and you
percent that perhaps about the Inbox fielder or something i think thats not
want I but they they can get down
genotype support new chatline on and when I wanted to
heard basically show here was how we integrate this again
with the whole system what we sent back and forth over the channel does not need
just a bj some
or getting back and forth over the gel could be entire its email fragments
on so in this case when you receive a line
the client that is not responsible for constructing what many see now look like
you just get that from the server because it's reusing the same partial
that is going to use when he renders the transcript in the first place
it's gonna be used when it presents a snippet up man you have this one partial
you can use over and over and over again
arm and then has a lil bit Logica a partner with local I'd like you won at
perhaps a hint that you added something locally known you
place it when you get something back from the server okay
again the channel you think on to connect to it at first
a crappy instance to the chat room that's the way you interact with up and
post up to it
and then subscribe to the room channels do you get update from the chow
in this case different from the Inbox case this channel is sheer
so there's one channel perch at room and everyone's to try to get the same thing
to you only need one pops up cue to deal with one
channel not one per person pretty I'm
is that example love abusing the lines
sending goes down s fall its email
snippets not as Jason again the whole point when all this
the whole point but I'm back to deliver its estimated you reuse
and leverage the peace issue already half the tools you
already packed as much as possible you want that
Swiss I mean I've in your backpack to be able to do all sorts of things because
you can only pack a few things
right is back in an infinitely large if you wanna carried as one person
an hour really tortured this metaphor to
that but I'm that sort that the debtor
the concept of an enactment I get but that's not the general way the people do
things right
Mike the general way that we construct these things is generally global
that on pure sending it came out just back and forth
hold snippets is not the way to do it you should just send data back and forth
because if you send data back and forth you can reduce the server to just being
an API
and in this very land that's a maybe I matches perfectly for what you need for
your
native application with what you need for your on
single-page ap on I Underwood on
on the desktop and usually doesn't go like a on
the underpinnings have this is we use or two-way serve
up dealing with it I N we have any machine
that handles just the connection logic
creating and disconnecting these I
whips sockets themselves that's great but it's not great track you running
application logic inside because web or an interesting places all these
restrictions
on the kinda stuff you can run
and it's gotta be non-blocking and and so on and so forth
so we paired up with threat so when you see something like
receive that's running in the thread is not running in
event she on and Candice do whatever he wants to do when you can use whatever
existing models that you already have it again another example of using the
integrated system you're using all the same models
huge issues in a min channels you calling the same models in the
controllers you're calling the same models in the
mailers her you calling the same ol wherever you're going to use them
so it basically
it both these to tools
are examples I love the self-reliance
using the integrated system to get on do amount have leverage
to be able to have tiny teams
they can create these full-service full stack
full breadth for all spectrum up devices
applications without having dozens of people
and that really fight me up
on I'm really excited about even
12 years into this that we can still expand that spectral there we can still
make it
more more capable just how much stuff to do with that we could keep up
that we can keep having a fighting chance just one percent worth tiny teen
to make something that spans the full gamut devices which is worth coming
table stakes at this point
and now
to take up the fight to teams that might have
10x the number of developers
10x the amount of money I'm all the BC in the world
so fucking what have a better idea have a great toolset
be prepared and now we take up the fight thank you very much
on
on
cool

No comments:

Post a Comment