Ruby Archaeology

In 2009 _why tweeted: "programming is rather thankless. you see your works become replaced by superior works in a year. unable to run at all in a few more."
I take this as a call to action to run old code. In this talk we dig, together, through historical Ruby. We will have fun excavating interesting gems from the past.

Further, I will answer the following questions:

What code greater than 12 years old still runs in Ruby 3.1?
What idioms have changed?
And for the brave: how can you set up an environment to run Ruby 1.8 code from ~2008 on a modern machine?

RailsConf 2022

00:00:00.900 foreign
00:00:12.300 doctors of Ruby
00:00:19.680 no need for decorum today
00:00:23.160 thank you everything is now perfect
00:00:26.340 my name is schwad and I work at Shopify
00:00:30.720 you may be familiar with this company by
00:00:32.940 very popularized mispronunciation of the
00:00:35.219 organization's name and thank you so
00:00:37.800 much for being here with me today
00:00:40.260 uh normally I am a freelance detective
00:00:42.840 in the annals of Ruby history you may be
00:00:45.600 familiar with some of my work I'm not
00:00:48.360 licensed to date there is no accredited
00:00:51.059 body that backs up my credentials but
00:00:53.280 that's the beauty of being freelance
00:00:55.680 however there was one recent Accolade
00:00:58.140 that I'm very proud to receive I cannot
00:01:00.120 accept for tax reasons
00:01:05.339 as of Monday I started working for the
00:01:07.619 Shopify Ruby and rails infrastructure
00:01:09.720 team which is very exciting thank you
00:01:14.100 and this is solid proof that Shopify is
00:01:17.100 invested in my detective work in
00:01:18.960 perpetuity
00:01:22.439 so I've said this term a couple of times
00:01:24.180 about Ruby archeology and you might be
00:01:26.159 wondering what is Ruby archeology
00:01:29.340 I've had an interest in Ruby before my
00:01:31.860 time or older Ruby or for folks who were
00:01:33.960 coding then not old Ruby but Ruby from
00:01:35.759 you know a few years ago and I
00:01:38.280 maintained the past Ruby's newsletter
00:01:39.900 which takes does it in this day and year
00:01:43.020 in history for Ruby so blog post
00:01:44.640 releases discussions and and sends it in
00:01:47.520 your inbox I also wrote the portal gun
00:01:49.140 gem which takes in a gem file and gives
00:01:51.899 you an executable where you can pass in
00:01:53.520 a date and it'll give you a gem file
00:01:55.439 pointing to that point in history I
00:01:57.360 don't know if he's in here but Mike
00:01:58.500 d'alessio since wrote something much
00:02:00.060 much better which is bundler as of so if
00:02:03.060 you actually want to do this please use
00:02:04.200 the plug-in bundler as of so thank you
00:02:05.939 Mike for building that
00:02:08.160 um while going through history I see why
00:02:11.160 the lucky staff quite a bit and for me
00:02:13.580 having never met why why was the symbol
00:02:16.620 of all that was Whimsical and right with
00:02:18.300 programming and I think that Whimsy is
00:02:20.400 quarter Ruby and they care about it and
00:02:22.739 the building and the art and the joy and
00:02:24.900 a lot of people have talked about just
00:02:26.160 enjoying riding Ruby and this is my
00:02:28.620 first actual rails comp and it's surreal
00:02:30.540 to me to know for a fact that there's
00:02:32.040 people in this room who actually worked
00:02:33.480 with and interacted with why but for
00:02:35.940 this talk I want to go to a quote from
00:02:38.700 why a few weeks before he disappeared
00:02:41.459 and he said programming is rather
00:02:43.200 thankless you see your Works become
00:02:45.180 replaced by Superior Works in a year and
00:02:47.819 unable to run it all in a few more
00:02:50.879 so I say
00:02:52.440 let's run some old code I take this as a
00:02:55.500 call to action for us so today I will
00:02:58.319 briefly talk about setting up an
00:02:59.819 environment for say Ruby 1.8 pretending
00:03:02.760 we're in 2008 again and go through three
00:03:06.120 gems from that that were in Vogue around
00:03:08.760 that point in history some you might
00:03:10.379 even be able to still use today and then
00:03:12.900 show them in that environment and also
00:03:14.400 look at some of the code that I found
00:03:15.840 interesting from around then
00:03:18.540 so the first thing is setting up a 2009
00:03:20.879 coding environment on a 2022 machine I
00:03:23.459 lost a bit of time trying to just do
00:03:24.840 this on a 22 22 machine but this isn't
00:03:28.200 something that you're meant to do right
00:03:29.459 so like Ruby one eight and one nine were
00:03:32.099 end of life in 2014. so that's quite a
00:03:35.700 long time ago and Ruby 1.8 wasn't even
00:03:37.560 the latest greatest Ruby
00:03:40.019 for 15 years but I feel that looking to
00:03:42.659 our past is important we have a mature
00:03:45.060 language with a feature-rich robust
00:03:47.400 ecosystem and to continue to progress
00:03:49.620 forward with the language we must keep
00:03:51.239 an eye on the code pattern Styles and
00:03:53.640 debates of the past to move forward
00:03:55.140 there's a danger to write Ruby one way
00:03:57.239 and I want to make sure that we know
00:03:58.980 that we can express ourselves and
00:04:01.019 explore Ruby in a lot of different ways
00:04:03.060 there's a lot of ways to do this in this
00:04:05.640 particular instance I set up just a
00:04:08.340 vagrant box and if this is accessible
00:04:10.920 for everyone if you're like what in the
00:04:12.120 world's vagrant you can just brunch all
00:04:14.159 vagrant and in it and for this point to
00:04:17.519 an operating system that was you know
00:04:19.979 around and current as of 2008.
00:04:23.280 once that's working in your essay SSH
00:04:25.680 into your terminal the next problem you
00:04:28.080 have is getting packaging from that time
00:04:30.060 because they'll try and point to the
00:04:31.199 present
00:04:32.300 so the next thing that you do is go to
00:04:34.740 the sources.list and make sure that you
00:04:36.419 point to Old repositories so that when
00:04:37.860 you do app get you're getting packages
00:04:40.320 that are germane to 2008. but you really
00:04:43.440 have to go into this archeology
00:04:44.880 seriously
00:04:46.680 um you can't halfway you can't think
00:04:48.419 that you're an imposter so if you see a
00:04:50.460 bug your first house could be like I'm
00:04:51.780 doing something wrong I'm running an old
00:04:53.520 Ruby that's that's the wrong thing to do
00:04:55.680 uh so so obviously I should just give up
00:04:58.620 that's not true you're getting authentic
00:05:00.960 bugs from the past so you need to Google
00:05:03.660 or search or DuckDuckGo or whatever
00:05:05.820 search engine you're using with the time
00:05:07.800 stamps that are appropriate to what
00:05:09.180 you're trying to spoof and then you'll
00:05:10.800 get the results that are germane to that
00:05:12.540 time
00:05:13.500 and since I never want to change my
00:05:15.300 version of Ruby in this box is actually
00:05:16.919 pretty straightforward I just did
00:05:19.699 apt-get install Ruby Dev 1.8.7 came in I
00:05:24.360 did install rubygems and get core but
00:05:26.880 that was a bit more trouble because it's
00:05:29.400 trying to talk to Something in the
00:05:30.960 present and the protocol and
00:05:32.520 communication isn't very good but I did
00:05:34.800 have an idea I do have tools and I can
00:05:37.500 MacGyver a few things and rubygems does
00:05:39.539 allow you to manually download a DOT gem
00:05:42.300 file so that's what I did here I just
00:05:44.940 downloaded a gem file and Gem install
00:05:47.100 local works I'm totally fine here and
00:05:49.740 then I also macgyvered this into another
00:05:51.960 executable to make it a bit easier and I
00:05:55.080 also include this slight bit of
00:05:56.220 recursion but then I realized I didn't
00:05:57.600 want to rebuild Ruby bundler for myself
00:05:59.759 in the past and like I'm not that smart
00:06:01.560 so I just left left it at that
00:06:04.199 and the only other thing I'd say here is
00:06:06.840 uh remember this is like when you you
00:06:08.759 always forget it's like when you get a
00:06:10.020 new Mac you gotta install install loads
00:06:11.520 of stuff so it could be app getting
00:06:13.020 everything
00:06:14.520 um so yeah
00:06:16.139 so let's put this to the test I've set
00:06:18.120 up a little thing and by the way there's
00:06:19.740 people much smarter in the audience than
00:06:21.180 me to say actually here's the 10 better
00:06:22.800 ways to do it but this is a way that
00:06:25.139 denies the law it did work
00:06:27.840 so let's put this to the test
00:06:30.180 the first gem we're going to look at
00:06:31.740 today is markabi who has used Market B
00:06:36.419 I am happy that it's a non-zero number
00:06:38.520 uh markabi was a ruby gem written by
00:06:41.819 this very snappy dresser
00:06:43.560 uh why the lucky stiff and it was
00:06:45.960 unveiled
00:06:47.220 and decided to do one dependency from y
00:06:49.199 right so I was unveiled to the world in
00:06:51.060 January of 2006 to much acclaim
00:06:53.699 the immediate discussion actually was
00:06:55.139 about using this in rails it lets you
00:06:57.060 write more Ruby and rails it's markup as
00:06:59.340 Ruby and if you get the time you should
00:07:01.319 go back and look at the announcement
00:07:02.580 that's still there there's an
00:07:04.020 interesting discussion with a lot of
00:07:05.220 people you'd know like Dave Thomas in
00:07:07.380 Portland's late uh great as resignment
00:07:09.539 was
00:07:10.440 here's a little bit of what that code
00:07:12.240 ought to look like
00:07:14.220 and it's quite nice you maybe some of
00:07:16.139 our handle fans in here like oh the
00:07:17.699 shapes are kind of similar you know but
00:07:19.259 then you have the ends but you know
00:07:22.020 but you probably could visualized this
00:07:23.699 in your head the second I said markup is
00:07:25.199 Ruby
00:07:26.880 but you probably just want to see it all
00:07:28.620 right fine
00:07:30.120 I'll work it on the machine oh that's
00:07:32.039 the oh no spoiler alert ah okay so this
00:07:35.580 is a pre-recorded code demo from my
00:07:37.620 vagrant box because no way on Earth am I
00:07:39.720 gonna do a Live code and uh railsconf
00:07:41.880 and then I can alter the speed so you
00:07:43.620 don't know how slow I type so I SWOT
00:07:45.720 install markabi 0.6.6 it installs I go
00:07:49.020 into IRB I require markabi which doesn't
00:07:51.060 work because 1.8 you had to require ruby
00:07:53.580 gems before you could require Market B
00:07:55.680 then you require markabi and you get all
00:07:57.419 this stuff because you know warning
00:07:58.680 warning warning and then you initiate
00:08:00.780 the Builder and then you just author it
00:08:02.280 as you think you don't even have to
00:08:04.460 beautiful DSL is like we got from y you
00:08:07.319 don't have to think how it should be
00:08:08.400 written or go to a manual it'll just
00:08:10.259 work as you think the blocks ought to
00:08:11.880 work to spit out the text that you think
00:08:13.620 it should be and you can write a
00:08:15.539 beautiful HTML page here and enjoy it
00:08:18.840 and that's that's real that's had uh
00:08:20.879 2008 fake machine
00:08:30.240 uh so a few of these and I'll mark the
00:08:32.820 commit and I'll mark the location and in
00:08:34.860 the point in history from the commit
00:08:37.140 um something that we see a little bit of
00:08:38.640 is uh nested methods and I was reading
00:08:42.240 about this and thinking about it it's
00:08:43.320 like it's bad you can do it and it
00:08:45.180 doesn't do anything expect here's
00:08:46.920 actually okay because you're redefining
00:08:48.959 a method against object an instance of
00:08:51.600 object there but there is an interesting
00:08:54.120 like use case I thought of that I don't
00:08:55.740 have for the demo here of actually
00:08:58.080 hiding methods inside a class by
00:09:00.180 wrapping them in a method and then they
00:09:01.740 don't appear until you call that method
00:09:04.380 um if there's some colors today that
00:09:05.580 aren't accessible I I vocalize some of
00:09:08.700 these Concepts so it shouldn't so if
00:09:10.560 there's a problem I apologize
00:09:13.920 and then this this I found really
00:09:15.420 interesting
00:09:16.620 um and I guess I'll point to what I'm
00:09:18.000 talking about here so it's the Builder
00:09:19.920 that we use to create this this DSL and
00:09:23.279 it actually inherits from Builder Blank
00:09:24.899 Slate but even though this is Builder to
00:09:27.000 RB this is not uh a file in in markabi
00:09:31.800 this is something that was popularized
00:09:33.420 by Jim Wyrick around the time uh which
00:09:36.000 was the blank slate class which this
00:09:38.700 inherits from to do a lot of its cool
00:09:40.140 work and you actually see it around and
00:09:41.700 uh some of David heinemeyer Hansen's
00:09:43.860 projects some other of wise projects and
00:09:46.140 around the community which is this class
00:09:48.440 which uh allows you to just because this
00:09:51.899 is a problem if you're setting up a ruby
00:09:54.600 library that allows people to hit method
00:09:56.700 missing and do whatever they want in
00:09:58.800 like whatever word they want and build
00:10:00.899 something really cool you're going to
00:10:02.519 run into like things that are already
00:10:03.959 taken and it's going to break you
00:10:05.940 probably experience this in real life so
00:10:07.980 what this does is it actually goes and
00:10:09.959 hides everything except underscore
00:10:12.300 underscore ID and underscore underscore
00:10:13.860 send an instancy Val which are needed to
00:10:16.380 exist that's pretty neat and you should
00:10:18.720 play around with it
00:10:20.279 so let's do
00:10:21.720 another one
00:10:24.060 all right who has used insta key
00:10:28.140 all right these are my best friends or
00:10:30.839 might be in sticky yes and sticky and
00:10:33.779 sticky I don't know where the emphasis
00:10:35.940 is on this allowable this was unveiled
00:10:38.399 by David heinemeier Hanson March 31st
00:10:41.120 2004 a very young I'm guessing David
00:10:44.100 heinemeier Hansen it's a straightforward
00:10:47.100 Wiki that runs on its own server servers
00:10:49.980 and Ruby has a little sqlite file as a
00:10:52.500 database and it's shocking to me that
00:10:55.019 this is never talked about like dhh is
00:10:58.440 still here you know I mean in sticky
00:11:02.300 instacie used to be something in his bio
00:11:04.560 if you look at the old stuff like I do
00:11:06.360 or it was like creative rails
00:11:09.000 creator of insta key Le Mans class race
00:11:11.459 car winning driver it's like like so it
00:11:13.380 used to be way up there but we don't
00:11:14.700 talk about it but it's still used so the
00:11:16.380 University of Texas physics department
00:11:18.180 is using it today
00:11:20.339 um now to use this on a machine I've
00:11:22.019 leveled it up right I did something
00:11:23.279 simple hey we spit out some formatted
00:11:25.079 text that's really easy haha look how
00:11:26.640 smart Nick is so now we've got to
00:11:28.740 configure our box and whatever setup you
00:11:30.600 use you'll have to do this to talk to an
00:11:33.180 outside Network honestly you're going to
00:11:35.160 want to share a folder so you can use it
00:11:37.019 in your actual editor unless you're
00:11:38.279 crazy good at Nano or vam or Vibe and
00:11:41.100 use that to communicate with the outside
00:11:42.600 world but the beautiful thing is once
00:11:45.240 you have the code down there's two steps
00:11:46.920 bundle install and Ruby insta key and
00:11:50.579 that's that's it working but you're
00:11:52.260 saying okay fine one more time let's
00:11:55.620 show you um this
00:12:00.180 and today
00:12:02.040 didn't practice looking over my shoulder
00:12:03.540 all right so we sign in and create our
00:12:06.120 first set of admin credentials we create
00:12:08.040 we're here in the real Wiki we're
00:12:10.500 building our Wiki style uh I believe
00:12:13.079 this is textile it supports everything
00:12:14.640 by this point in history and we create
00:12:16.740 our landing page and you're wondering is
00:12:19.140 this going to work I use a Wiki word my
00:12:21.300 personal blog at the bottom I change the
00:12:23.040 author and it exists but immediately
00:12:25.980 I've created a reference to a page that
00:12:27.720 doesn't exist remember that for future
00:12:30.000 and then I'm going to create another
00:12:31.860 random page because I just feel like
00:12:33.240 ranting about something that's super
00:12:35.820 secret
00:12:37.680 that I feel like I can share with you
00:12:40.200 today because you're all my close
00:12:41.220 friends but I'll get to that another
00:12:43.200 time never mind never mind don't have
00:12:44.639 time all right so now we have a page
00:12:46.980 that's orphaned that's not referenced by
00:12:48.540 other pages and a page that's asked for
00:12:50.459 so we're going to try and handle this in
00:12:53.279 one go here and I'll see if my timing
00:12:55.920 with my demo is actually is actually
00:12:58.380 working
00:13:00.120 um this is the problem with doing a
00:13:01.620 non-live demo is uh then you have to
00:13:03.540 like remember how fast everything was
00:13:04.920 because you're not doing it
00:13:06.540 um so this is just like my third and
00:13:07.860 final entry for this demo uh which is
00:13:09.899 going to link in my personal blog which
00:13:11.760 was called for and it's going to link
00:13:13.019 back to rant so it's not orphaned
00:13:15.120 and that's that's what that's how Wiki
00:13:16.860 works like that's what you're doing here
00:13:18.120 this is the thing that's neat and cool
00:13:19.980 and I wish more people knew about it
00:13:22.139 supports basic features and even the
00:13:24.360 search just works you know pulls up
00:13:26.459 stuff pulls up stuff that doesn't exist
00:13:27.839 so that is a web application
00:13:31.459 2008.
00:13:33.420 all right now let's go to this code
00:13:36.120 I feel like since I'm at railsconf I can
00:13:38.459 kind of cheat a little bit and there was
00:13:40.680 some vendored rails in the 2009 version
00:13:42.660 of this so that you know went back to
00:13:45.120 2004 so maybe not vendored then and
00:13:48.720 um yeah so so uh I I really like this we
00:13:51.959 all know try like we use try probably
00:13:53.579 all the time in our rails uh
00:13:56.360 applications but what I really liked
00:13:58.920 here I and this isn't here anymore I
00:14:00.600 don't think because otherwise why would
00:14:02.040 I talk about it
00:14:03.480 um but we have the try method on object
00:14:05.700 which means anything right like can just
00:14:07.680 send the method to itself and then we
00:14:10.139 have try on nil so it can just nil out
00:14:12.000 you know whenever what I really liked
00:14:13.980 about this is that it defines try and
00:14:15.720 then immediately removes it so it
00:14:17.880 doesn't exist and it does it the way
00:14:19.260 that you ought to where it sends aliases
00:14:22.980 it to underscore underscore send
00:14:25.320 because send can be redefined elsewhere
00:14:27.779 but underscore underscore send in
00:14:29.579 convention ought not to be
00:14:32.040 let's look at a little bit more here
00:14:35.279 so okay if you've been writing Ruby for
00:14:37.860 more than five or six years or three or
00:14:39.180 four years
00:14:40.620 um nothing here probably looks odd to
00:14:42.540 you and maybe the colors all vocalize it
00:14:44.399 and I'll point it out but we've got a
00:14:46.380 bunch of ands and Knots and and Knots
00:14:48.600 and ORS well not nor but just about
00:14:50.220 everything else
00:14:51.480 and uh you know I I quite like a lot of
00:14:55.079 older Ruby used and not in ore quite
00:14:58.680 frequently and it wasn't a sin and it
00:15:01.019 wasn't like knocked down by RoboCop but
00:15:03.480 you're already like talking over me
00:15:05.160 saying but their hierarchy is different
00:15:07.800 and and this is the meme I will use
00:15:09.959 whenever somebody disagrees when I'm I
00:15:11.940 have something to say but I'm going to
00:15:13.680 quote avdi Grim has to say about this
00:15:15.720 here he says I think their reputation
00:15:17.699 for being confusing stems from thinking
00:15:19.920 of them as Boolean logical operators at
00:15:21.839 all if you think about them that way
00:15:23.579 then you have to keep your membrane how
00:15:25.139 they differ from pipe pipe and amp amp
00:15:27.420 whereas if you think about them as
00:15:28.980 control flow operators only and in the
00:15:30.959 same vein as if and unless then they're
00:15:32.880 more self-explanatory or I kind of think
00:15:35.519 of instead of next if Foo equals one it
00:15:38.699 can be Foo equals one and next
00:15:41.579 I posted on Twitter about this recently
00:15:44.220 because of the hierarchy and I said what
00:15:46.079 if I had a gem that reversed the
00:15:47.699 hierarchy
00:15:49.260 and Ruby committer Victor shepalev also
00:15:51.720 known as farak said in all caps why
00:15:54.120 would you do that
00:15:55.440 but then he educated me more than what I
00:15:57.600 just said to you he said the problem
00:15:58.920 with precedence is not that and has a
00:16:01.079 lower one in pi amp amp has it you know
00:16:03.480 higher that's right for code flow but
00:16:06.240 the problem is that andanor have the
00:16:07.680 same precedence but uh amp amp and pipe
00:16:10.079 pipe dome but if you keep that in mind
00:16:12.899 he did agree and has been fighting for
00:16:14.940 this for about four years to have the
00:16:17.220 poor and an ore and not come back into
00:16:20.279 like Ruby reality where it's something
00:16:21.899 that we use like we did quite a while
00:16:24.300 ago and if you feel the same way as I do
00:16:26.399 you can go to Ruby style guide poll 7 30
00:16:28.920 and let them know what you think as well
00:16:30.720 four years later
00:16:32.100 still going
00:16:34.320 here's another one in app models so most
00:16:36.959 of these are like active record objects
00:16:38.519 by this point in history by 2009 but I
00:16:41.040 thought this was quite interesting
00:16:42.060 because you have something you have an
00:16:44.399 object that inherits directly from
00:16:45.839 string
00:16:46.980 and I was thinking well okay yeah that's
00:16:48.899 very interesting that's like how Ruby
00:16:50.459 works right you're like I've got a thing
00:16:51.839 I'm not really doing anything
00:16:53.220 interesting with it it's a string
00:16:55.019 because it's a name but I also want to
00:16:56.699 know the IP address and instead of
00:16:58.079 writing just to poro like plain old Ruby
00:16:59.940 object with like two attributes like no
00:17:02.100 I'm going to inherit from string and
00:17:04.199 just do it completely that way and from
00:17:06.000 the oldest commit 2005 that I can find
00:17:07.980 this is there
00:17:09.480 and it's still there today so you can do
00:17:12.059 whatever you want in Ruby and it and it
00:17:14.160 will work and I love it and that's what
00:17:15.419 I think makes the language very
00:17:16.799 beautiful but if you actually do it
00:17:19.380 wet
00:17:21.860 oh boy I'm enjoying myself too much here
00:17:24.480 sorry it's fun talking about these gems
00:17:26.339 uh all right I'm in Portland last one
00:17:30.419 who here has used
00:17:33.179 merb
00:17:35.280 all right these are all the people who
00:17:36.840 I'm going to get a beer with after
00:17:39.120 um okay
00:17:40.980 so I'll tell you a few things about mer
00:17:42.900 if you haven't heard of him I imagine
00:17:44.520 more people have heard of Mer but I'll
00:17:46.559 give you a little discussion so remember
00:17:49.140 this is all this stuff is a little
00:17:50.760 earlier right so I'm using 0809 where
00:17:52.679 things were established but a lot of
00:17:54.539 these things came into the world years
00:17:56.039 before so they were established by 2008.
00:17:58.620 uh Merv came out in October 2006 by the
00:18:02.580 late uh great portlandian azra
00:18:04.799 sigmundowicz who's one of the
00:18:06.240 co-founders of engine yard and it ties
00:18:08.760 in Mongrel and Erb herb providing basic
00:18:12.059 controller and view templating its core
00:18:14.160 competency was being lightweight and
00:18:16.080 plug-in based some of you who use Rhoda
00:18:18.900 by Jeremy Evans it kind of makes me
00:18:20.280 think of that in a little way might be
00:18:21.600 familiar with some of the style of
00:18:23.039 approach and to quote the famous Ruby
00:18:26.160 Herodotus who's still with us today uh
00:18:28.260 Peter Cooper where Ruby on Rails is a
00:18:30.419 Big Mac merb is a McNugget
00:18:32.580 or as they uh marketed themselves in
00:18:35.460 their words they were built for Speed
00:18:36.660 lightweight and Powerful
00:18:39.780 um but you also might be thinking to
00:18:41.400 someone else when you think of merb and
00:18:42.780 you think of Yehuda cats you who to cats
00:18:44.580 join the team and a lot of other core
00:18:45.840 contributors some may be in this room
00:18:47.580 this happens to me uh last conference I
00:18:49.860 spoke at I talked about a library in the
00:18:51.780 maintainer as an audience so like you
00:18:53.400 know that's absolutely terrifying being
00:18:54.900 at these big conferences
00:18:56.460 um and getting schooled by the audience
00:18:58.020 but uh once Yehuda joined it took off it
00:19:01.980 became a legitimate Contender to rails
00:19:04.320 in 2008 a popular survey that went out
00:19:07.559 saw it was the number two preferred
00:19:09.360 framework in the community
00:19:12.480 there was a division people were little
00:19:15.000 it wasn't really a war oh I wasn't there
00:19:16.799 by the way I'm just doing this like as
00:19:18.179 reading the ancient texts but so some
00:19:20.580 some of you could educate me a bit more
00:19:22.080 on that as well who who actually used it
00:19:24.000 but there was like at least an Evidence
00:19:27.360 a bit of a where this community you're
00:19:30.240 that Community but then something
00:19:32.100 happened in December 23rd 2008.
00:19:37.559 the merger
00:19:39.240 the murder Nation
00:19:41.039 the murderer
00:19:45.000 there is a joint announcement from both
00:19:46.799 core teams that the core team of merb
00:19:49.380 was joining the core team of rails and
00:19:52.200 they were going to merge Merv into rails
00:19:55.200 what did we get out of that merger
00:19:57.299 well first a United Community and there
00:19:59.880 was some discussion at a panel I was at
00:20:01.620 yesterday about how we have just rails
00:20:04.140 but I think of the merb merger
00:20:06.419 as like a really good symbol of how we
00:20:08.700 can work together and have an
00:20:11.220 interesting framework that can support a
00:20:12.780 diverse community
00:20:14.039 some of the things that we got out of
00:20:15.539 the merger were you know
00:20:17.880 things can be broken up we do have
00:20:19.799 conventional configuration and we do
00:20:21.900 have the rails way but everybody in this
00:20:23.400 room knows that you can have different
00:20:24.780 rails news right like different
00:20:26.340 components different bits of rails that
00:20:28.020 you want to use
00:20:29.160 um it has a publicly documented API it
00:20:31.860 has certain parts were Rewritten for
00:20:34.080 Speed and Performance and also we had a
00:20:36.840 lot of tremendous contributors join the
00:20:38.820 the core team and uh yahuda cats
00:20:42.240 actually documented this over a long
00:20:45.000 time I believe the final release they're
00:20:47.400 looking for it to be about six months
00:20:49.020 but I think is a year and a half maybe a
00:20:51.660 little over a year and a half to get
00:20:52.740 this merger done and it was documented
00:20:54.840 by Yehuda with every little part so if
00:20:57.480 you want to do a deep dive into that you
00:20:58.980 can learn more there and there's also
00:21:00.900 which I referenced a minute ago a really
00:21:03.299 good writer by who yahuda only two years
00:21:04.919 ago about the merb story which is a bit
00:21:07.380 deeper than what I've covered today
00:21:09.179 and I'd like to take a moment to just
00:21:11.100 like
00:21:12.059 talk about why I think this is so cool
00:21:15.840 um the last decade we see code Wars all
00:21:18.120 the time
00:21:18.900 right
00:21:20.100 like we see Frameworks fighting each
00:21:21.660 other we see people getting fomo we see
00:21:24.059 people thinking is blank debt is blank
00:21:25.860 debt is y dead
00:21:27.660 um you know is this or that dead and
00:21:29.400 this was a situation where two
00:21:31.559 communities realized they want to do the
00:21:33.059 same thing so rails three was looking to
00:21:34.740 achieve a lot of the things that Merv
00:21:36.659 was looking to achieve and when they
00:21:38.640 went and talked to David and the team
00:21:40.559 they realized that the things that they
00:21:41.760 wanted to accomplish the core team
00:21:43.440 wasn't against it's just as we've heard
00:21:45.480 today there's only so many people
00:21:47.880 only so many priorities that can be
00:21:49.679 prioritized and just because the thing
00:21:51.360 you really care about isn't prioritized
00:21:52.740 doesn't mean it's it's not allowed so
00:21:55.200 when people come together they're able
00:21:56.940 to make these two Frameworks become one
00:21:59.400 framework and that framework was rails
00:22:01.020 three which a lot of people got to enjoy
00:22:02.760 and I think a future where they stayed
00:22:04.860 split would have been a pretty
00:22:07.679 uh difficult one and I think we have a
00:22:09.960 much more beautiful framework today
00:22:11.100 because of people who are willing to put
00:22:12.720 down maybe a little bit of Pride and
00:22:14.220 work their butts off together so thank
00:22:16.020 you to all those people of the past
00:22:17.280 thank you
00:22:19.260 um
00:22:22.580 cheers that's my sentimental moment
00:22:25.980 so you thought I had an orange
00:22:27.179 handkerchief I just could be like laughs
00:22:28.860 right no I'm quite a Sentimental person
00:22:30.659 so all right let's go to the coda merb
00:22:32.640 though like I got a couple more Cody
00:22:33.960 bits to talk about I'm not completely
00:22:35.700 done uh merb was interesting though
00:22:38.220 because there was merb Corps which just
00:22:40.500 the stripped out kind of like rail
00:22:41.700 skeleton uh and then there's merb more
00:22:43.919 right which had all the extra treats
00:22:46.980 um so this was in merb slice and uh
00:22:50.520 again if you're if you're writing Ruby
00:22:52.020 for more than or four or five years
00:22:54.539 you're like this is just code why are
00:22:56.220 you putting this up this is a waste of
00:22:57.360 my time but if you're writing Ruby a
00:22:58.980 little more recently you might be like
00:23:00.020 multi-line Curly blocks what
00:23:03.960 and uh this is I'm gonna go to avdi
00:23:07.020 again
00:23:07.740 um talking about our use of curlies this
00:23:09.659 is like our we're getting to like
00:23:11.039 RoboCop mind right like anything that's
00:23:13.140 shoved in the rubicop is like now the
00:23:14.700 truth and I'm not distant RoboCop I I
00:23:16.679 think it's a really cool tool but uh
00:23:18.600 something that Avi had said was one
00:23:21.480 approach could be to use curly brackets
00:23:23.100 for functional blocks where the primary
00:23:25.140 purpose is of the block is to return a
00:23:27.179 value and they could use do an end for
00:23:30.000 procedural blocks for the primary
00:23:31.500 purpose is its side effects whatever
00:23:33.780 it's doing that is the block is intended
00:23:36.539 to change the state in some way and the
00:23:39.120 others uh and then the ones to perform
00:23:40.980 output but avdi in 2011 11 years ago was
00:23:44.820 saying but this isn't my idea this is
00:23:46.740 just a thing I know in the Ruby
00:23:47.940 community and he wouldn't look deeper
00:23:49.080 and deeper and deeper the earliest
00:23:50.580 reference he could find was from the
00:23:52.080 late Jim Wyrick April 30th 2004 who said
00:23:56.220 very similarly the big remaining
00:23:58.200 question on Ruby coding style is when
00:24:00.659 should you use curlies and duet and his
00:24:03.059 guideline was curlies for returning
00:24:05.460 values do end for executed for their
00:24:08.400 side effects he says this is and this is
00:24:10.919 something I want if you take one thing
00:24:12.000 from this talk this has the advantage of
00:24:14.280 using the choice of block delimiter to
00:24:16.200 convey a little extra information
00:24:18.960 you know we're all excited like I use
00:24:20.940 sorbet at work it's so cool to have that
00:24:22.500 extra information about what's going on
00:24:23.940 right but what about the extra
00:24:25.260 information about when Ruby when you
00:24:26.760 could do things two clearly different
00:24:28.080 ways that do the same exact thing you
00:24:30.900 can in your organization or in your
00:24:32.520 style convey an extra bit of information
00:24:34.620 to the engineer and and there's a lot of
00:24:37.200 different ways that you can employ this
00:24:38.400 in Ruby and because of this being the
00:24:40.500 earliest reference avdi referred to it
00:24:42.600 as The Wyrick convention and I've heard
00:24:44.820 others call it the white convention and
00:24:46.740 so I will as well
00:24:49.320 another little snippet remove code here
00:24:51.960 we have a few more lines so I'll
00:24:54.299 highlight this one out to you and you're
00:24:55.679 like okay what's going on here did they
00:24:57.960 forget to up case their their class or
00:25:00.600 something like what's what's going on
00:25:03.480 well actually no this is just a colon
00:25:07.020 method call for uh calling a method and
00:25:10.260 I think this is a bit more rare I don't
00:25:12.299 think people really know that you can do
00:25:13.860 this but this is exactly what I just
00:25:15.299 sent it to there are so many ways to
00:25:17.220 call a method and you probably know 12
00:25:18.539 of them right like all the weird funny
00:25:20.580 wild ways and you hack on it with your
00:25:22.140 friends and do a quiz but Colin Colin is
00:25:24.299 a valid way to call a method
00:25:27.059 but it's a bit unknown it actually if
00:25:29.340 you look at the blog 12 ways to call a
00:25:31.020 method in Ruby by Gregory whitak it's
00:25:33.240 not in the list so when I when I came
00:25:34.860 across this I'm like wait am I actually
00:25:36.179 doing this right is there or is Colin
00:25:37.980 Colin doing some weird like c-level
00:25:40.320 crazy stuff that I don't quite
00:25:41.760 understand but I know it was right I did
00:25:45.000 Pitch this over to Gregory and I said by
00:25:46.980 the way you can just do Colin colon and
00:25:48.900 it'll call the method as well and he
00:25:50.820 said after 12 years of using Ruby he
00:25:52.679 didn't know that so it's now added to
00:25:54.360 the list of ways to call a method Ruby
00:25:57.840 okay let's take this one more step
00:25:59.700 further
00:26:00.720 how about defining a method in Ruby so
00:26:05.220 what is self first of all self is the
00:26:07.260 thing you know like uh there's a game
00:26:09.720 showing here yesterday and you couldn't
00:26:10.860 use certain words and you had to say a
00:26:12.539 word Ruby I don't know if anyone else
00:26:13.679 was at that talk
00:26:15.120 um and so so that's what I'm thinking
00:26:16.620 here self's just a thing right like self
00:26:18.240 is the thing that you're in you can't
00:26:19.860 use any fancier words so deaf HTML
00:26:22.740 method is the same as deaf self and
00:26:24.600 normally you'd see deaf self dot reset
00:26:27.539 but this is deaf HTML method colon colon
00:26:30.299 reset which is just as valid again your
00:26:31.919 linter will cry because there's only one
00:26:33.360 way we're allowed to write Ruby anymore
00:26:34.559 but
00:26:36.299 it is is valid Ruby but here's the thing
00:26:38.700 it can kind of get us close to solving a
00:26:41.100 pet peeve if you if you start writing
00:26:42.779 Ruby for the first time you see this
00:26:44.880 stuff right we don't we don't use any
00:26:47.400 hashes or pound signs like when we're
00:26:49.679 calling or defining or invoking a method
00:26:51.840 so we just all have to have extra
00:26:53.340 knowledge in our head like that we've
00:26:55.140 tribalized and built into our band like
00:26:56.580 oh yeah this is the Syntax for like the
00:26:58.260 method but like how about this this is
00:27:00.059 actually like how we're calling it and
00:27:01.919 then we then we Define it in the same
00:27:03.539 way so I think um kind of my moral on
00:27:06.600 that
00:27:07.620 is that there's a lot of different ways
00:27:09.659 to write certain very mundane things in
00:27:12.000 Ruby and uh our old authors used to use
00:27:15.299 these tactics to convey extra
00:27:17.820 information or even just have more fun
00:27:19.380 or art in the way that they wrote things
00:27:20.940 and you should consider that in your org
00:27:23.720 I don't know what you'll do with your
00:27:25.559 linter I don't know you'll have to
00:27:27.059 figure that out yourself
00:27:28.860 but wow three Three Gems that I've never
00:27:31.440 talked about before in the history of
00:27:33.000 Time ruby archeology is super fun it was
00:27:36.779 by the way you're like where's my verb
00:27:38.340 demonstration that's an hour talk by
00:27:40.020 itself you're not getting that for me
00:27:41.700 today I'm sorry like I did I've cut
00:27:44.039 enough content
00:27:45.559 but there's a lot of gems I didn't get
00:27:48.000 to use today I actually researched 22
00:27:50.940 gems a digital ocean I'd like uh pulled
00:27:54.600 out a 32 core machine that I ran a ruby
00:27:56.820 script in parallel to check patterns
00:27:58.620 against every single commit in history
00:28:00.000 to like literally find the Snippets that
00:28:02.039 I wanted for today so if you see any
00:28:04.380 gems on there that you haven't goofed
00:28:06.000 around with or heard of just like Google
00:28:07.320 it and go go have fun today if that's
00:28:09.360 your thing
00:28:11.039 um future considerations I love I love
00:28:13.860 any excuse to look at you know gems from
00:28:15.960 oh wait come on we could go even older
00:28:18.779 in history so I think that I could
00:28:20.580 definitely if your organization or
00:28:22.559 Meetup would like a talk and I don't
00:28:24.779 even have to go into like how to set it
00:28:26.279 up and I can just talk about old Jones I
00:28:28.080 could probably do this forever but I
00:28:30.059 think besides me like I'm just one
00:28:32.220 person I think you should become a ruby
00:28:33.840 archaeologist there's billions of lines
00:28:36.000 of Open Source Code out there just
00:28:37.919 sitting there hosted
00:28:39.539 ignored unused that you can use
00:28:43.440 um and contrary uh there's one gem from
00:28:45.900 why that didn't show today called
00:28:46.980 bloopsophone it was written in Ruby 1.8
00:28:49.559 it plays music way before Sonic pie and
00:28:52.620 it works on Ruby 3.1 unedited so some
00:28:54.840 code does stand the test of time
00:28:57.360 but I think you should go explore and
00:28:59.279 see the ways that people used to write
00:29:00.419 Ruby and have it and think about it I
00:29:02.460 think things should be easily uh
00:29:04.080 readable and shareable and we should
00:29:06.720 have conventions but I think we need to
00:29:08.580 also remember that Ruby's a sharp knife
00:29:10.140 and we should know how to use the knife
00:29:12.299 instead of just chopping broccoli
00:29:14.640 so my gift to you
00:29:16.260 is a vagrant box with all the work done
00:29:19.200 so you can just go vagrant in a schwad
00:29:21.960 ruby archaeologist vagrantop you can
00:29:23.760 have Ruby 1.8 you can have all the old
00:29:25.740 dependencies you can have everything set
00:29:27.360 up even a few Frameworks are in there
00:29:29.640 and you can just enjoy yourself
00:29:31.380 so I say to you go forth go learn more
00:29:34.380 about our amazing language and share
00:29:36.480 with others uh thank you so much for
00:29:38.100 being here and let's connect anytime I
00:29:40.020 love being at this conference thank you
00:29:41.580 everyone
00:29:41.830 [Applause]