📜 ⬆️ ⬇️

Gardener code


(Picture to attract attention)

Xavier Noria (male in the original), Xavier Noria, is a man who is not unknown in the Ruby community. As a developer from Barcelona, ​​he managed to become a member of the Ruby on Rails core team. By the way, Xavier also won the Ruby Hero award at RailsConf 2010. Perhaps some of you, dear readers, managed to meet him: he appeared this year at several developer conferences in Europe.

Perhaps, the greatest impression on me was made by such a feature of Xavier as “Code Gardener” ( in the original - “Code Gardener” ). He left this phrase in one of the small commits he made more than two years ago.

I recently managed to talk with Xavier on various topics: his biographies, updates to Rails 4, his passion for documentation, and perhaps most importantly, the philosophy of the significance of small changes.

Start


How did your path to Ruby on Rails begin?
')
Twelve years ago, I abruptly changed the vector of my career and began working as a programmer. I was then 30 years old and the decision was very serious, but my love was helped to write the code by taking this step.


(Meet: Xavier Noria)

I started working in a research lab, where I was writing in Java and Perl at the time. He also lectured on Perl for 7 years at the University of Barcelona. In 2005, someone asked me: isn’t there anything new that would catch my attention? And at that time almost everyone was keen on discussing Ruby on Rails. In my first (and superficial) view, he really deserved it. So I thought that RoR looks really promising. Back then, I didn’t have much experience with Ruby, I just “played around” with him a little, because I have warm feelings for dynamic languages.

So, when my colleagues and I tried Rails on a real project, we were delighted. Next was already written a full-fledged online store on some rails. Later we also founded our web project company in Spain. RoR has become our brand.

Who do you mean by "we"?

First of all, I speak about AgustĂ­n Cuenca, with which the joint project began in 2005. Together with it was established the company ASPgems in 2006 together with our other partners.

Work on the Rails core

Tell me how you became part of the Rails development team. How did your journey start?

I participated in free software for 10 years: I worked on some Perl modules, helped as much as I could at IRC, and so on. As for the Rail itself, having found a bug or something else that could be fixed, I always tried to send a patch to fix the problem found. But did not participate in the decision of tickets. When I needed something, I just wrote the code and sent the patch.

It all started with my desire to do Rails documentation. I generally think that there are certain problems with this in the Ruby community, but it also provides excellent opportunities to make a contribution. So, in Rails, the level of documentation at that time did not satisfy me at all. So, Pratik Naik had a great idea to create a project called “docrails” - this is one of the Rails branches for quick changes and corrections to the documentation, which is regularly merged with the project master (main branch). At the very beginning, access had to be contacted, but today there is no such problem: the project has public access.



I started working on the docrails like crazy. The documentation had several directions for development at once: one of them is the description of the content itself and functions, which, as you understand, is very important for the project. Of course, there were other areas that require corrections, such as consistency of documentation: there were no guidelines or rules, but there was a mess. This is where my experience as a proofreader came in handy - I was engaged in reading books on mathematics for several years before I went into programming.

Wow!

Yes! I have a trained eye. If something was supposed to be italicized and it wasn’t, then it didn’t go unnoticed by me!

So, we have established some rules for documentation and I began to actively implement these changes in the RoR project. An impressive work was done, which, in general, was completely invisible to many, but I did not care, I just corrected what I wanted to fix. After that, somehow the work on the code began. The ratio was about 80/20 with a margin in the direction of documentation, of course. In the end, the guys from the Rails development team found out about my contributions and we started to talk more closely with each other, so I began to learn the project more deeply. After some time I was invited to the team.

Congratulations! This is amazing! Tell me what it feels like to work on the Rails core team? It's fun? Complicated? Exhausting?

Working here is very cool! The team could find a balance between working alone and working in a group. For important things we have discussions and try to come to a single point of view. But in most cases we work alone, each on those areas that are most interesting to him. The room in Campfire and the project in Basecamp are used for communication.

Do you communicate with each other in voice? At least in Skype, well, or live?

In my case, everything is written either in Campfire, or in Basecamp. Very rarely used email. As far as I know, José and Yehuda are currently working in pairs, remotely. There is usually enough text to communicate.

Rails 4

Many people wonder what new Rails 4 prepares for us? I know that time is short, but can you lift the veil?

This is a big release with a bunch of new features. In recent days, I was browsing the change log, preparing material for notes on the release of new Rails. First, to use Rails 4, Ruby version 1.9.3 is required.



... And this is due to the fact that you use code that works only in 1.9.3?

There were several discussions among the developers, following which a decision was made to focus on Ruby’s latest stable release in order not to waste time on previous versions. Official support will only be for 1.9.3. Someone may be able to run the Rails 4 application on 1.9.2, but here it will be one on one with its program and possible problems. Absolutely, we will not support Ruby 1.8, since a lot of code has been rewritten with support for only 1.9.

Well, that is clear. Do your tests run under 1.9.3 only?

Yes. Among the new features I like the fact that we now use the PATCH method as a first class citizen.

And what does the method do? Update?

Yes, the idea is just to update their data. Previously, this was done using the PUT method, but, generally speaking, this method should create or update the whole entity. At the same time, as a rule, the full resource is not sent. And therefore, now in the forms used to update the resource, in the hidden parameter “_method” PATCH will be used.

Why should developers know about this? For a smooth transition?

Of course, precisely for a smooth transition!

There is one more thing that many people would like to change. This is a control of the mass assignment of attributes. Previously, the necessary methods were located exclusively in the models and many did not like it, they would like this mechanism to be available in the controllers. So it happened! In Rails 4, this feature is called strong parameters. From now on this mechanism is available in controllers, you can say goodbye to attr_accesible and attr_protected. But if such a desire arises, then the old functionality can be returned using the plugin.



Another nice feature is the API for queues. You can pick up multiple queues and use one common API to work with them. Thanks to this innovation, now you can even, for example, send letters asynchronously!

Really curious!

By the way, another very important feature that we created is called “Russian Doll caching”.

Is it possible to briefly tell about this?

Suppose you want to cache all the partitions in a view, but you have a double or triple level of nesting. In this case, you need to use some kind of time stamp, so that the keys automatically disappear after some time, well, and so on. If you change something from static content in one of the nested view / partials, then the parent container starts to contain incorrect data due to caching.



Before our feature appeared, it was necessary to deal with such problems manually. Now all this Rails 4 decides for you, automatically generating MD5 keys for signing data views.

Another important note. We remove the Active Resource from Rails, since it is used in very few places. It can be installed using the plugin. Of course, these are not all the upcoming changes.

Gardener code

Do you remember my last year’s article in which I described you as “The Gardener of the Code”?

It is very unusual that someone pays attention to small code changes. Such a comparison is very nice!

Do you really spend a lot of time on such minor edits, ennobling the code?

Of course. If something caught my attention and needs correction, then I take and correct. I like the writing of large projects, the unification of code, and the correction of small errors.

I see you like to dig into the details.

I think that such small investments in the project are very necessary, because they give the code a complete form and bring beauty.



I don’t have any differences between tickets — and fixing a small bug and fix bug is just as important as any other change in code. If someone sends me such amendments, they will be accepted immediately, if these are, of course, not monstrous patches. For this reason I like docrails so much - they promoted similar ideas.

Among the people who read this article, most likely there are those who would like to contribute to Rails, but do not know how. What could you advise them?

Open up Github and start working on tickets. Such work includes many features: creating a patch to fix the problem, testing that the patch is still working in new versions, and so on. If you like working with documentation, then you can search for projects with poor documentation (of which there are many) and help with its development. The Rails Guides project is always pleased with such assistance ( in the Russian segment this is rusrails.ru ). This is a very, very important part for any project!

Ruby conferences

You have visited many different conferences in recent months: RailsClub Moscow, BaRuCo, RuLu 2012, RailsBerry, EuRuKo. Is there something in them that you liked the most?

Perhaps, since this year I have not traveled before. On each of them (with the exception of EuRuKo) I spoke. Merry year came out. But I go to conferences to meet people. I certainly like to perform, but this is clearly not my main incentive.

So do you like to sit in the bar? Or do you prefer after-bar pastime?

I love breaks. I admit honestly: I don’t like to hang out, at 1 o'clock in the morning I prefer to go to the hotel.



So early? And I thought that in Spain you are just having dinner at this time!

Ha, that's true. In general, on the second day of the conference, I like to relax. Conferences, as a rule, are of two types: the first, filled with speeches and the second (more rare) with periodic breaks for half an hour or more. I prefer the latter, because in this case I can communicate with people and sit down my pants less.

Are you going to come to any conference in the USA?

Let's be honest - this is too far from where I live. In the US, I was brought only once and then, only because the organizers “offered” after teaching ... That is, because I had to give the award to the Ruby Hero. And it happened in 2010 in Baltimore.

This interview is a translation of: this article
All errors, please report to the PM.



Subscribe to my blog !

Source: https://habr.com/ru/post/161637/


All Articles