Hello! We continue a series of interviews with speakers of the
RubyRussia conference. Aaron Patterson (aka
tenderlove ) is a member of the Ruby core team and the Rails core team, a lead software engineer in a small startup called GitHub.
Pavel Argentov talked with Aaron before his second trip to Russia.
Let's start with the standard question. What is your personal ruby ​​story? How did you get on this train? Tell me about your achievements? Did it make the world a better place?I discovered Ruby in 2006. I was a Java programmer then. Let's start even earlier: I was a Perl programmer, and then I became a Java programmer, but I didn't want to be a javist.
')
Why?When I wrote Perl, we already had our own web framework. There was a lot of what is in Rails: you could just change the code, reload the page and check what happened. Everything just worked. When we switched to Java development, it became like this: you need to recompile everything - it will take 10 minutes before you can check all the changes you just made. I like dynamic languages ​​like Perl, more than Java. The release of Perl 6 was expected. And so, while I was waiting for Perl 6, I found out about Ruby. Thought: “Wow! Here's what I need! ”So I started doing Ruby - in my free time, for example, for side projects. You know, just for fun. It all started with this. Finally, in 2008, I already got a job with Ruby.
Was it already Rails?Yes, my friend decided to start a startup. - We will use Rails. Want to work with us in the same company? I am such: - Yes, of course, I will be happy to work on the “rails”! That's how I started.
Honestly, I did not like my work in this company. Therefore, at any opportunity, I wrote open-source right at the workplace. It was done like this: - Ok, the project will take 2 days. Then I finished the case in a couple of hours, and used the remainder of the time for the open source.
What we have called: "Do not strike a man lying down!" I am sitting here calmly, repairing the primus. Leave me, pliz, alone!Aha So, here I began to work a lot with open source. At this job, I started writing Nokogiri and generally working on my Ruby open source. So I generally entered into the open source. I just “made a contribution” until one day I joined the Ruby Core and Rails Core teams.
So how did you end up in the Rails Core Team?We just found bugs and developed Rails applications. Found bugs, I fixed them and sent patches. I just sent patches. In the end, they are tired of the fact that I'm just chasing pull requests.
Like, now take matters into your own hands, right?Yes exactly! Overall, it was like a brute force attack!
Sounds reasonable! So what's your total contribution to Rails?I worked a lot on almost all parts of the framework. Basically - over Active Record. I especially like to make bug fixes and improve performance. The reason for this attachment - it makes someone's applications better. Everyone is happy if the application is better, and for this you do not need to do anything. That's why I like working for it.
You do some "small" refinements that make everything work. And the “big” things did not have to be architectured?Usually, whenever I do something architectural in Rails, it's something inside. For example, the architecture of working with URLs, associations, and things inside the router is something like that. None of these things will necessarily be noticeable. They can be seen by the user, but this is not in the form: “Here it is, the real Thing!” I try to adhere to this style. I think that this is actually good, because David (
DHH - PA) likes to make New Brilliant Beautiful Features. Rather, I say to myself: “Well, let's make these your Beautiful Features. You look, and the truth will come out beautiful! "
Yes, someone has to do all the manual work. For example, your presentation at the conference will be about certain deep engineering parts of Ruby in general and Rails in particular. What is the presentation really about?In fact, I'll talk about Ruby internals. Until the end of the whole speech is not invented.
GC, performance, everything, life, the universe, 42?I think to talk about the garbage collector, the Ruby compilation process and the bytecode. Basically, about bytecode in a virtual machine and how it relates to the garbage collector. About some performance improvements that I made in GC. I don’t have much to say about Rails.
Our conference used to be called "Rails Club". Our organizers thought, and renamed the whole undertaking mainly because Matz said that he never attended the conference with the word “Rails” in the title. So now we are “Ruby Russia”!So, I will talk about Ruby internals!
In your opinion, what should Rails programmers do to achieve better performance in their code?There are several strategies. First, in general, - do not do anything special. Just write your application. Launch it, get customers, feedback, etc. Immediately analyze the detected bottlenecks. Never work with bottlenecks until real work with customers reveals them. It’s a waste of time if you are dealing with bottlenecks that really aren’t. This time could be used for new features. However, I think many would say the same thing, so let's talk about what really affects performance. First, just look at the database queries that the page makes. This is the first line of defense - try to reduce the time spent on certain requests. Requests themselves - to automate and reduce. You will not believe how often we forget to just add an index. Ha! So at least make an index in the right place.
I conduct technical interviews and imagine how people even forget about indexes in general. Why do you even need to worry about it ... Well, what do you say about other things that the rubists should know? What technical things the rubist should know to do his job better?There are a couple of these pieces. The first one, I think, is to know the Ruby language itself. Learn the language very carefully. The second is to understand UNIX well.
You are the first "my" speaker, who says that you need to know UNIX. I personally came to Ruby from the UNIX world. I worked on Linux, FreeBSD, and tons of Perl code. I came to Ruby as another Perl in order to do my sisadmin affairs, and only then I discovered that it was also a web language. And so, you say that you need to know UNIX. How and why?It is important to study the POSIX standards and how they interact with the operating system, because you will encounter this as soon as you start scaling. You…
... should know who General Feiler is and why is he reading my file?Haha, yes! You need to know what changes performance. It may not be necessary to memorize it specifically, but you should know that they (system calls - PA) exist, and how to google them, because you will definitely encounter this economy. They will be important because the application is deployed on a UNIX server, so you need to understand how the application will interact with the OS on which it will run. Another important point is that if you have acquired this skill in UNIX, you can apply them, for example, in other languages. If there are any problems, you can always start from this place. This is perhaps the main thing that I recommend to programmers to learn.
Do you think it's useful for a rubist to know some other language? Is it possible to be a good programmer in Ruby without knowing anything outside of Ruby?Good question. Honestly, I do not know. All good rubists I know know other languages. However, I don’t know whether it is imperative to learn other languages ​​in order to become a good Ruby programmer. I think it just happens that people learn other languages.
Good observation! From a medical point of view, the more languages ​​a person knows, the more it delays the onset of his Alzheimer's.Haha
After 40 you have to think about such things ...I'm approaching 40 years! It is useful for me to know!
Let's talk about Ruby itself. Ruby is a language with a great past. Does he have a future? Not so long ago, I was in St. Petersburg at one of the largest IT conferences seen by me in Russia. The local Ruby community was not represented at this conference. I always had Ruby-apologetics: Ruby is NOT SO dead, they still write on Ruby. Ruby has, by the way, the best known web framework, and all that. Every big language on the market now has some tools for web development. Go, Rust, whatever. What is the place of Ruby in this ecosystem and does Ruby with a great past have a future?I think there are several aspects of the answer to this question. There are many different languages ​​for which there are web frameworks, but I still think that if you look at them from the point of view of developer ergonomics, Ruby will be in the top anyway. It is easy to use, and easy to sell results. The problem is that Ruby is no longer "brand new and brilliant." People want to get carried away with something new. They want to take the next train after Rails.
They want the smell of a new car!Yes! About the future ... There are many new developments in Ruby, especially about JIT and what Koichi: guilds works with. I would say that Ruby definitely has a future, but for this everyone will have to work. If we make due efforts, the future will surely be.
Does Ruby have any perspective in other areas besides web development? Or do you know any examples where Ruby is now used outside of web development?Good question! It is difficult to answer, because I only deal with problems of web development.
I ask because it is my personal interest. The guys from the Python community, for example, love to show off their progress in scientific computing.I know that there is a group working on scientific tools in Ruby. But I think the real alternative for Ruby is system administration.
How can we bring developers from other languages ​​to our community?This is a really good question! I think we just need to focus on the ergonomics of development, on what makes the development of web applications as easy as possible. You need to focus on lowering the entry threshold for new developers who are coming aboard and writing web applications. So we will attract more new programmers.
It's time for a holivar javascript question. You know, there is a saying: "everything that can be rewritten in JavaScript will be necessarily rewritten in JavaScript." Do you think Rails will also be rewritten to javascript? We talked about Ruby ergonomics. This is the best thing about Rails. One of the very famous Russian programmers said that "many languages ​​are good, but only Ruby has Rails." However, JavaScript developers tend to question this. How can we compete with javascript? Or should we arrange a symbiosis with him?It's true that only Ruby has Rails. If you look at web frameworks for javascript, I don’t think they are quite comparable to Rails in terms of development ergonomics. The fact is that since we are writing web applications, we will have to work with JavaScript. We need to be part of the javascript community. It is useful for us to have a symbiosis. If you can run any language on the server, why should it be JavaScript? But the language is good, and I think we need to work symbiotically. Convenience development is still on our side, and it is especially appreciated in the Rails community. So, you came to an IT conference, and you had to work there as a Ruby representative?
It was rather informal because I didn't even have a T-shirt about my company or language. So I just found the brightest group of young people who were pythonists, and we started chatting.For us, it’s good if we work together with other languages ​​and not compete with them. Personally, I think that programming in Ruby is much simpler and more enjoyable than in other languages. Why not? We are talking about other programming languages ​​and whether we should know them. I think it is important that rubists learn other languages. Something like Java, Haskell, or something else functional like Elixir or Lisp, something like that. I think it is useful to study different paradigms, because, learning new things, you can drag it off and use it in your language. A good feature of Ruby is that we can use techniques from various languages ​​in our programs.
Yes, we have, for example, tools for functional programming or for executing map / reduce or something else.Yes, we can use it all. If you use a language that encourages these techniques, perhaps you will find the best way to solve the problem. I'm not sure that I need to learn other languages ​​to be a good rubist, but this study definitely helps me. Honestly, I spend 50% of my time on C programming.
Si makes your fingers stronger!I program in C so that others can program in Ruby.
Ruby internals are written in pure C, not ++?On the net. It would be nice if more of this code were written in Ruby, but, to be honest, some of the basic things for performance reasons should be written in C. One of the things I do ... We need improved memory profiling. Therefore, I am working on Ruby memory profiling tools. Since all the guts are written in C, I have to write tools in C. At work, I write a lot of code.
How is Ruby doing with FFI and the like?FFI works quite well if you have a C library in your work that needs one or two functions. If something is more complicated ... then everything is more complicated. When you work with FFI, you basically write C code that is similar to Ruby. However, you still have to do such mysterious things as memory management. I personally find it easier to switch between these worlds if you use C for memory management, etc. And in other cases I switch to Ruby.
In Ruby, do we have interfaces to other languages?Some interfaces with javascript. I saw a guy who was engaged in scientific tasks, so he interfaced with Python.
Did he interact directly with the language runtime?Yes it is. Not the type of Schelling or something like that ... The project is still very experimental. When he gives demos, he says that “everything works, but it can fall!”
I know a bunch of famous rubists who went to create Rust. Why do you think people do this, and how are they doing?I like Rust, I think this is a very good language. The reason why people go to Rust ... they want to have a language that has more protection options than C gives. It would be really awesome to rewrite Ruby to Rust. I am personally a big fan of Rust, I love it.
How can he be useful? Is it safer, faster or what?I think safer. I'm not sure if he is more optimized than what C is, but he is definitely safer. This is what I like about him. When I write the C-code, I am almost sure that it is not SEGV-ny, but not 100% sure. But when I write on Rust, I'm sure much more. When I write in C, I am almost sure that there will be no memory leak. With Rust it is clear as daylight that there will be no memory leaks. This is why I personally prefer Rust, not C. I also started to learn Rust, because I want to write Ruby extensions on it. There is a whole project called “Helix” - especially for this. Often, when I write in C, it’s like: “OK, I have a library in C, and I have to access it from Ruby by writing a couple of crutches.” To use Rust for this is a gun on the sparrows. In my ideal world, everything, the whole system will one day be rewritten to Rust. Rust will be our new C. If you need to quickly solve a problem, you write in Ruby. And the operating system will be made on Rust. And all will be Happiness.
Is Rust mature enough for this?Well I do not know. I think quite. In Mozilla, they use it - and are satisfied.
What is the chance to "see the registers" by running the program on Rust?Haha, I do not know! Hope low! See this is not funny.
Especially when you launch something in the browser.Yes. A crash message pops up, and you're like, “OK.” Ha! We have some things in C ++ at work, and sometimes, when I get a crash, I'm just like this: “Hmm ...”
I want to program in a language, not a macro assembler! - it was my favorite joke when I switched from C to Ruby ...Actually you are right. Whenever I write in C, the question is what should I think about. I really do not think about the problem to be solved. With Ruby, I do not need to think about all this (low-level farm - PA). I'm just focused on the logic of the program, and I'm doing business. This is one of the reasons why I love Ruby so much! When I was a javist in the days of Java 1.3, it was before the generics appeared there. Every time you had to write something like a map — for example, collections or iterators, you had to do “iterator.next ()” and then cast the resulting value ... Only then do the desired operation. Then I started learning Ruby, where the map was already in Perl ...
... Oh, miracle! I have in my hands an object of exactly the type that I need!Yes exactly. In Java, I would have to write 15 lines of code in order to achieve what I can do in a single line in Ruby. Would write on Ruby, would finish work much faster! Instead of writing all this rubbish! Understanding this very frustrated me at that job. I spent hours on unnecessary movements!
Existential horror!Exactly! It was a turning point. I needed to find a job at Ruby. I can not saw jaw until the end of my life!
Is it possible to say that Ruby improves the mind of a programmer?I think that if you can devote more time to high-level tasks, the very goals of the program, this will help improve abstract thinking.
You are increasingly practicing thinking about the system as a whole, and not about the tiny cogs of the program. Let me remind you, in C, I have to constantly think about all these little things, and not about the problem I’m solving. Essentially, you learn exactly Problem Solving, that is, top-level tasks. I think it can improve you as a programmer.I remember my own impression when I started in the 90s. I tried to learn OOP. I tried to do C ++. I read books, learned the "holy trinity of the PLO." And then I find myself again in the process of mastering all the same "macroassembler" tricks. Then I tried to work in Java, made some money on Perl. It was only in Ruby that I finally understood how OOP works.You say business.
If you think about other OOP languages, such as C ++ or Java, then not everything has an object. For example, there are still just ints. There are still primitives, and we have to deal with them differently than with objects. In Ruby, in fact, everything is an object. We have to deal only with the PLO. More exercise, more meaning. I really didn't think much about it until you asked.The language is designed so neatly that it just makes you think in the right direction. It shapes the mind. The syntax itself explains what you do.I worked with OO in Perl. This, in general, is just a hack for OOP-like things. Java, of course, implements OOP. But she has among other things non-objects. Ruby in our list is the first language in which everything is really an object.What words would you inspire both young programmers and old ones?Good question! I think this is what is suitable for young and old rubists: Personally, I think that Ruby is the only language that fan gives when using. Young programmers who have already mastered other languages, try Ruby, because it’s really fun. Older programmers who have solid experience in other languages ​​can compare and understand how good Ruby is. When you start using something else, you will say to yourself: wow, and Ruby is nothing!On weekends I do small exercises in other languages. After the weekend, I return to work, open my Emacs with Ruby, and say to myself: “Oh God, how wonderful it is to return home!”Yes, I think it is good to switch to other languages, to work there, to accumulate some observations. I always enjoy coming back. I feel that I am at home in Ruby.Ask Aaron his questions personally will be on October 6. So see you at the conference! All the details on the
site .
You can read the original in English at
hype.codes .
And many thanks to the companies that support the main Ruby event in Russia:
General partner -
ToptalGold Partners -
Gett and
CookpadSilver Partners -
Instamart ,
UCHi.ru ,
JetBrains and
QleanAfterparty partner -
TeachbaseBronze Partners -
Bookmate and
InSales