Tootle returning to rails

19

Transcript of Tootle returning to rails

Page 1: Tootle returning to rails
Page 2: Tootle returning to rails

TOOTLE: RETURNING TO RAILSANDREW GRIMM ROROSYD JUNE 9 2015

Page 3: Tootle returning to rails

MY CAREER SO FAR…

Page 4: Tootle returning to rails

UNIVERSITY OF SYDNEY

• Bachelor of Science (Bioinformatics) Honours Class I (Biology)

• Final undergraduate year half biology, half computer science

• Honours year involved a bioinformatics project

Page 5: Tootle returning to rails

CHILDREN’S HOSPITAL AT WESTMEAD

• Worked on RettBASE, an online database of mutations to MECP2 which causes Rett syndrome

• Biological knowledge important, plus general computing skills, but not much programming

Page 6: Tootle returning to rails

MARINE BIOLOGICAL LABORATORY

• Work related to the Encyclopedia of Life, a website aiming to have a series of pages for each species known to science

• ~ 6 months PHP, 6 months Ruby on Rails

Page 7: Tootle returning to rails

UNSW AUSTRALIA

• Analysis of mutation in HIV

• Used Ruby (without Rails)

Page 8: Tootle returning to rails

CURRENT POSITION

• Back-end Rails developer at a large product company

Page 9: Tootle returning to rails

CHANGES FROM PREVIOUS TO CURRENT JOB

• Solo development => Group development

• Research => commercial environment

• Ruby => Rails

Page 10: Tootle returning to rails

PULL REQUESTS

• Have to get two approvals for each pull request

• Advantage: Source of feedback

• Disadvantage: More work when you thought you’d finished

Page 11: Tootle returning to rails

PACE OF WORK

• Previous job involved weekly or twice-weekly meetings

• Now daily standups and JIRA tickets

Page 12: Tootle returning to rails

RUBY TO RAILS

• Bit more magical

Page 13: Tootle returning to rails

TESTING

• In previous job used test/unit, real objects, and tested actual results

• Now use RSpec, factory girl. Techniques include mocking, and testing that one class is calling the correct methods on other classes and objects.

Page 14: Tootle returning to rails

COMPARISON OF TESTING TECHNIQUES: SCENARIO

• A product has a delivery postcode, which must be four digits, and must be to a location we deliver to

• ‘Sydney’ is not valid, because it isn’t 4 digits

• ‘0800’ is not valid, because we don’t deliver there

• ‘2000’ is valid, because we deliver there

Page 15: Tootle returning to rails

TESTING TECHNIQUES: REAL OBJECTS

• Is a product with postcode ‘Sydney’ invalid?

• Is a product with postcode ‘0800’ invalid?

• Is a product with postcode ‘2000’ valid?

Page 16: Tootle returning to rails

TESTING TECHNIQUES: MOCKING

• Testing that Product successfully uses postcode format validation

• The format validator says that the postcode does not contain 4 digits. Is the postcode valid?

• The format validator says that the postcode does contain 4 digits. Is the postcode valid?

Page 17: Tootle returning to rails

WHY THE DIFFERENCE?

• Can’t do dependency injection

• Have to intercept calls to objects or classes

Page 18: Tootle returning to rails

INHERITANCE

• Delegation (as opposed to inheritance):

• spreadsheet = Library::Spreadsheet.new

• spreadsheet.serialize(@spreadsheet_filename)

• Inheritance

• class MutationSpreadsheet < Library::Spreadsheet

• end

Page 19: Tootle returning to rails

MAGIC

• Ruby-only style:

• length_validator = LengthValidator.new(dna)

• length_validator.valid?

• Rails style:

• validates :dna, length: true