 Hai, semua. Saya akan bercakap tentang rebuat-rebuat untuk Rupiah Reels. Saya boleh nama untuk begini kerana saya mempercayai begini. Jika saya salahkan sesuatu, saya akan mengatakan bahawa saya mempercayai begini... ...untuk mempercayai keselamatan saya sendiri. Jadi nama saya sepatutnya... ...saya sebenarnya boleh mengandalkan kata-kata. Saya hanya tidak dapat melihat kata-kata. Sebelum dua bulan lalu, saya membuat perjalanan semasa... ...di syarikat syarikat terkenal di Silicon Valley. Saya membuat perjalanan Rupiah dan Rupiah di Reels 10. Saya mengatakan bahawa saya mempercayai begini untuk mempercayai begini. Saya adalah perjalanan mekanal di NUS. Jadi itu perjalanan saya. Saya hanya mempercayai begini sepanjang bulan lalu. Jika saya mempunyai sesuatu yang benar-benar seronok untuk anda... ...saya akan mempercayai begini. Saya yakin cyvari dengan cepat dan kuat apabila saya terlalu maling. So jika anda melihat saya bercakap dengan cepat dan kelihatan... ...saya akan mempercaya untuk mengarahkan saya jika saya ber Ini akan menjadi厲害 berkoya uso. Menurut kalau saya merongkake tempat agud bagi bahagian jam saya, saya juga berusaha kmicaman untuk membuat pengalaman. Saya akan meng abuse segi kebenaran sebab saya cuma akan men�kannya pakai so highlight. So feel free to stop me anytime and ask me any questions, just raise your hand and I'll I didn't think it would break my flow because my slides are in like chunks So I'll start off with a bit of my experience as a Google, some of course student So I applied when I had about a year of Ruby and Rails experience It was quite a leap for me but what I wanted at the point in time was really to learn about Rails itself So everyone says Rails has a lot of magic for you But then to me I feel like you really understand the tool that you're using, Ruby and Rails in general But you currently treat it as magic for the rest of your life So I really wanted to dive into it So I applied, what I did was I actually started contributing patches based on the list of projects So I just started contributing to Solvay But then the project that I was contributing patches to, I didn't get it They preferred someone else But then I was offered to work on another project, the ones that were left So I just randomly picked one that seems like the easiest because I'm a beginner So I picked unifying controller and integration test So at that point of time what I thought I was getting myself into We're just making all the internal tests in Rails All the controller tests, just map it to integration test So the internal test case will no longer have controller tests And everything will just run through a mock request of integration test So when I just started, I didn't know what I was doing Because when I met my mentor, I didn't hang out with him for the first time He explained to me new performance benchmarking of controller integration test And then you're supposed to duplicate controller test So one of the plans, I think DH spoke about it Don't write controller test and just do integration test So that was sort of my job for Rails itself So I have no idea what I'm doing But I think at the end of it, not knowing what you're doing is actually a good thing Because it actually forces me to learn a lot I've got to read, force myself to go and learn about benchmark stuff In Rails itself And what I wanted to give you was I think I watched the anti-keynote by Aaron Patterson, RubyConf 2014 I was talking about how you wanted to make Rails better So that more people can use Ruby and have jobs of it So I thought of, because I'm a mechanical engineer And I went to Silicon Valley So I want to become a software developer And I think Rails can give me that opportunity So in order to ensure that I have a career next time when I graduate So I want to make Rails better So that's why I want to give this talk And we hope more people will contribute to Rails So one of the thing is that reading Rails Like looking through the source code actually makes you, forces you to learn Like if you read through Rails, it's a lot about method programming in Ruby But at the time when I applied for some amount of code I didn't even know method programming I didn't know Ruby well Or if not read any books on method programming So when I wanted to start on it I really had to read the whole book on method programming in Ruby So that I could understand what was going on in the Rails code But then I think this applies to any open source code in general You just read open source libraries, it'll make you learn So one of the question is If Rails is such a large code base How can you start contributing to it? So the simplest one is just CIS deep documents So just read through the documents Look for errors, spelling mistakes and just fix it I mean it's still colleague building It makes it easier for the rest of the people to read it So like this is just an example One of the method was test hate programs as thing So just add R in and then submit it And you get one from it So the next one was Even simple just remove code from Rails Just look for stuff like this So Rails itself is a pretty large code base So as many developers contribute to it You realise that it's not perfect, there's a lot of bugs in it So for instance, this was just a parameter That was no longer used You can't look in the method itself app It's not used anywhere So there was no need and just remove it So there were other instances You know like require mini test I think that was one like this Oh you don't need it because another power was required I removed it And then someone reported a bug Because if you open up the console And you type Rails You'll throw the error that mini test is not there So don't remove code Like randomly, like what I did So the next one was improved performance I'll just give like this example So while I was reading through Like how a get request Because I was benchmarking A get request in integration test Versus a get in controller test So I realised that in In your actual request This is the router So it's trying to find the routes Previously what it was doing was that So you look in the method get routes As case So what I was actually doing was It was taking all the get routes And then creating new routes Route object for them And then setting the request method to hit So it's like you're doing it For every single request Like post whatever It's going to do the same thing So my simple fix Was just Unless it's a hit request You don't do that But then the patch got accepted But then the thing was I wasn't still very efficient I mean you get about 3% Like from 90 You get about So 90 iterations per 100ms To about 93 It's like 3% sort of So But eventually what I did was After patch got accepted I looked at it again I realized all I had to do was I would just match it against the get routes If there's no match Because I mean someone might have a Get route in their route style If there's no match Just set the request method And then match Against the get request Because essentially A hit request Just get request it out And then you do that So this actually got it About 7% faster I mean if I'm just benchmarking A simple get request I don't know Yes but It's about 7% faster So there's an example Of a performance improvement thing That you can look at So I'm going to just I included this because I thought People might get bored So I added the cat It's falling asleep So while I was working on rails I realized there were some tools That helped me Like understand the rails code better So one is Ruby Pro I'm not sure how many of you have heard of it I think it's sort of a profiler group But what I use it for Was actually to do something like this So let's say assuming I didn't know what get Get slash users Actually does If you do like You just read I mean just read The Ruby prof cat Just do You wrap whatever You want to understand Between the Ruby prof code Oh crap Okay man what So what it essentially Gives you is that It'll give you a whole trace Of what actually goes on In that method itself So if you go through the get You'll see You'll hit the integration get And then you'll go to a rack session And then you'll process a session You'll hit your rails middleware And sort of I mean if you guys I'll just show you later How the sort of It's a html So you can just click And go to each step Of what's happening Along the way So this is going to fail too Because I think the next one So I was trying to demonstrate Like if you don't know What user.all did Just wrap it around Ruby prof and then It's supposed to give you The html table Okay so that's that And next one is buyback I mean everyone uses buyback I mean now you generate The news rails app It comes with buyback But then I think What's important here That what I realized was So this was A response Written by Got free charge Is one of the newest Sort of rails core So he was Replying this question To a guy on Y Combinator Had the news at the forum Like if rails is so big Like how do I Get around Understand it So I sort of Bad What I was trying to say So this is A section that I took out So basically What I did What I do now There's like No idea what the code is going Is doing Just put like buybacks Here Then you just type Like what the variable is And then put buyback After a certain method And see what the output is So essentially You don't really have to You can see Like each step of the way Like what the code Is actually doing So I think this is really Helpful So if you want to read Just click on the links So I was talking to One of my friends Was a rails developer As well I was just asking Me about my rails sum of code Like If you don't have a point If you don't know where to start It's really hard to start And contributing to rails If I didn't have Rule sum of code I wouldn't know What patches to start making And everything So One cool way is I mean If you have no idea How to even sub me a patch You just go and You just read this blog post It's basically about What expectations So I have like There's only I think I don't know the number But there's a limited Caught team member So now people that can Review and accept patches Are pretty low So it will take some time For that to happen So Even if that happens You can just Wait for it I guess Ya so That was the blog post I think the next one Is just like contributing To rails Online The rails So it will give you Idea of how we can Set out the environment What Take no off No cosmetic changes Like removing a A comma Spaces between the brackets Doesn't really Isn't really a patch So the next one I think So the next two Sort of things I'm going to show Is actually The rails The rails sum Of code projects That were in my batch And then I realised At the end of the summer Like the students Start working on it And then I think Someone should work on it So this was the first project Of summiting patches too Because So the rails internal test case Are now still run Are ran in run Are still being run In software Or the So it's not random And that's a bad thing Because your tests Are depending on On the state of another test So that's the method That mini test Name it as So Oh crap Bang died Okay so the So the next So one of the cost contributors Actually renamed it And instead of I suck and my tests Are order dependent My tests are order dependent Because no one should No one should suck So I mean It's pretty easy to get started on this Just go into any one of the Action pack Active job Just In the abstract unit It's sort of like the test helper For the rails internal test case Just look for the line Where they set All the tests to run In the software order Set it to random 10 times Write it to a file And see what tests Are failing Just submit a text for it And I'm pretty sure You'll get accepted So you can You can do that And that will actually Help you Sort of explore The Ruby code Because you're actually reading tests And test is one of the best Documentation For the Ruby on Rails code So the next one is Tests are still failing For other Ruby implementations So if you're looking at JRuby and Rubiness They're still failing Someone worked on it But then there's a lot Of things to consider Like you have to Go into JRuby And contribute another text Because it's not Implemented the same way as MI Ruby So this like Some starting point I think At least for these two projects I think it's a pretty good Starting point For anyone who's looking To contribute to like Ruby on Rails And JRuby So if you have any questions You're free to ask Ruby get your keys from Sorry? Ruby get your keys Oh, if the It's giph-wide Ya Ya, so I had I had like Heaps and heaps walls In my previous companies So I'm a big fan of them Any other question? Ruby bra Sorry? It says Ruby bra I think it's dying So basically It's sort of like a Profiler for Different outputs So you can even Look at object allocations If you want So what I was Going to show was It's sort of like It's a stack trace Of all the methods That is being called In the sense We wrap it around So it's It will allow you To sort of step Through each step What's happening So that it's sensitive And why it's careful I wouldn't say it's No, it's not really a key barrier In the sense So it just prints out So it will even show you Like the runtime Of what How long each method took To run and stuff So it's also Like in the sense When you're stepping through You can That was what I used To identify hotspots When I was doing performance And like How I discovered The tape routes And then they Get routes You're still taking A bit of time So that was how I identified But can you Get a documentation What it will be Very simple to use I think Having to go through The code for Rails You have an opinion Of Rails now Like you think it's Good man So So what I wanted To clarify So Rails is really big So where most of My time I spend Was actually just action pack And within action pack I looked at How tests are So that's So I don't know How tests are being run Right now But had About an opinion Of Rails Maybe not No, Rails Is awesome In awesome So far for me At least It was an unique fact Yet My question After the talk Let's thank you