What I Have Learned from Organizing Remote Internship for Ruby developers

Post on 16-Feb-2017

130 views 0 download

Transcript of What I Have Learned from Organizing Remote Internship for Ruby developers

Remote internship for Ruby Developers

Ivan Nemytchenko, @inem

Developer Advocate at GitLab

http://inem.at

Software developer since 2002

2008

→ SOLID principles→ Design partterns

→ Refactoring techniques→ Architecture types

→ Code smells identification

"From Rails way to modular

architecture"

"Stop being Rails Developer"

RailsHurts.com

Don't be the best student in class

What intern gets:→ project in portfolio

→ development from idea to production→ teamwork experience→ remote work experience

Technologies

→ Twitter Bootstrap→ Haml, Sass, jQuery

→ Rails, Sinatra or Lotus(Hanami)

Requirements→ basic ruby/rails knowledge

→ 20 hours/week min

Need a test to choose the best!

Test → Aptitude test

Part 1 requirements→ registration

→ list of products→ create product→ show product

Part 2

Part 2

Part 2→ 3 different types of users→ different registration forms→ different types of products→ different permissions

Part 3

Part 3→ Ability to "purchase a product"

→ Work with external API→ Complicated "purchase" logic

Final result:

validates :avatar, presence: true, if: "role == Role.with_name(:shop) || role == Role.with_name(:administrator)"

validates :password, length: { minimum: 10 },if: "role == Role.with_name(:administrator)" validates :name, :last_name, :passport_photo, :birth_date, presence: true, if: "role == Role.with_name(:administrator)"

validates :shop_title, presence: true, if: "role == Role.with_name(:shop)" validates :password, length: { minimum: 8 }, if: "role == Role.with_name(:shop)"

validates :password, length: { minimum: 6 }, if: "role == Role.with_name(:user)"

def buy @product = Product.find params[:id] if @product.pro or not @product.user.is_a? Shop or current_user.email.split('.')[-1] == 'com'

flash[:alert] = "You can't buy this product" else photos = RestClient.get 'http://jsonplaceholder.typicode.com/photos/' photo = JSON.parse(photos).sample thumbnail = photo['thumbnailUrl'] url = photo['url'] thumbnail_color = thumbnail.split('/')[-1].to_i 16 url_color = url.split('/')[-1].to_i 16 if thumbnail_color > url_color flash[:alert] = 'An error happened' BuyMailer.admins_buy_fail(current_user).deliver_now! else flash[:notice] = 'Success' BuyMailer.user_buy_success(current_user, url).deliver_now! todos = RestClient.post 'http://jsonplaceholder.typicode.com/todos', {} todo_id = JSON.parse(todos)['id'] BuyMailer.admins_buy_success(todo_id).deliver_now! end end redirect_to :back end

def buy @product = Product.find(params[:id]) if current_user.can_buy? if @product.sell_able? photo_url = get_photo if photo_url.nil? flash[:alert] = "Sorry, _you_ can't buy this product. Try again later" AdministratorMailer.buy_error(current_user.email).deliver_later redirect_to :back else post = HTTParty.post("http://jsonplaceholder.typicode.com/todos") post_id = post['id'] AdministratorMailer.successfull_buy(post_id).deliver_later UserMailer.successfull_buy(current_user, photo_url).deliver_later redirect_to(:back) end else flash[:alert] = "Sorry, we can't sell _this_ product" redirect_to :back end else flash[:alert] = "Sorry, _you_ cant buy _anything_" redirect_to(:back) end end

Common mistakes:

1. Ignoring levels of abstraction2. Gemification

3. Nowbody knows about service objects4. Put business logic in random places

5. Bad naming

Next steps:

1. Group hangout codereview2. Lecture about patterns

3. Refactoring4. Cross code review

Project work

Project work:

Results

railshurts.com/quiz

Internship automatization

github.com/lenshq

Problems

Problems→ collective irresponsibility→ inability to communicate

→ lack of motivation→ a lack of mentors

BURNOUT

Mistakes→ Making it free?

→ Too big teams (2 is enough)→ Allowing everyone to participate in

projects

Worked out not so well:

→ Project work

Worked out well:

→ Aptitude test

Today

Junior needs→ real tasks to work on

→ some achievment to put into portfolio

→ whole development cycle experience

→ team work experience

Seniors

→ routine tasks→ research tasks

→ nice to have features→ low priority features

→ missing features in their favorite open source

project→ side project ideas

If I do it again:

→ more "tests"→ call for mentors

→ turn mentor's experience into their "tests"

→ reject newbies

inem.atinem@bk.ru

@inem