Aikido, Controller Tests, and LinkedIn

26
@mdenomy Thursday, January 16, 14

description

This is a talk I gave at Launch Academy in January 2014 at Launch Academy, a developer bootcamp in Boston. The talk is geared towards preparing the students for life after graduation, and things they can do to continuous improve themselves and continue learning.

Transcript of Aikido, Controller Tests, and LinkedIn

Page 1: Aikido, Controller Tests, and LinkedIn

@mdenomy

Thursday, January 16, 14

Page 2: Aikido, Controller Tests, and LinkedIn

Aikido,Controller Tests,

and LinkedIn

Michael DenomyLaunch AcademyJanuary 16, 2014

Thursday, January 16, 14

Page 3: Aikido, Controller Tests, and LinkedIn

Aikido,Controller Tests,

and LinkedIn3 things that seemingly

have nothing to do with one another

Michael DenomyLaunch AcademyJanuary 16, 2014

Thursday, January 16, 14

Page 4: Aikido, Controller Tests, and LinkedIn

What’s This All About• Get you thinking about life after

Launch Academy

Thursday, January 16, 14

Page 5: Aikido, Controller Tests, and LinkedIn

What’s This All About• Get you thinking about life after

Launch Academy

ABGB

lwayseettingetter

Thursday, January 16, 14

Page 6: Aikido, Controller Tests, and LinkedIn

Trivia Question

Who is this, and why should you care?

Thursday, January 16, 14

Page 7: Aikido, Controller Tests, and LinkedIn

Alistair Cockburn• One of the Agile Manifesto authors- http://agilemanifesto.org/

• Introduced concept of Shu-Ha-Ri to software development- Term from Aikido about 3 stages of learning

Thursday, January 16, 14

Page 8: Aikido, Controller Tests, and LinkedIn

Shu-Ha-Ri

http://www.infoq.com/presentations/cockburn-bury-not-praise-agile

Shu-Ha-Ri comes up at ~31:40, but entire talk worthwhile.

Thursday, January 16, 14

Page 9: Aikido, Controller Tests, and LinkedIn

What Does This Mean For You

• You are in the Shu phase- Don’t cherry pick what you think you should do- Learn a technique from your masters

• Someday you will leave these walls- Evaluate different techniques- Be open to other ways- This is Ha, incorporate different techniques

• Someday, you may get to Ri

Thursday, January 16, 14

Page 10: Aikido, Controller Tests, and LinkedIn

A Practical Example•When I learned Rails....

• Started with Hartl Tutorial- When I did it there were Controller tests like

these

Thursday, January 16, 14

Page 11: Aikido, Controller Tests, and LinkedIn

RSpec Docs Reinforced That

https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs

Thursday, January 16, 14

Page 12: Aikido, Controller Tests, and LinkedIn

That Was Me in Shu Phase• I’d learned one way of doing it

• It worked for me

• Provided a safety net“Test-driven development is a way of managing fear during programming. I don't mean fear in a bad way-but fear in the legitimate, this-is-a-hard-problem-and-I-can't-see-the-end-from-the-beginning sense.” Kent Beck - Test Driven Development By Example

Thursday, January 16, 14

Page 13: Aikido, Controller Tests, and LinkedIn

Then A Few Things Happened

A perfect Shu response

A Shu comment

I reviewed some code for a Launcher’s final project

Thursday, January 16, 14

Page 14: Aikido, Controller Tests, and LinkedIn

And Another Thing

Thursday, January 16, 14

Page 15: Aikido, Controller Tests, and LinkedIn

Dan Calls Shenanigans!

Thursday, January 16, 14

Page 16: Aikido, Controller Tests, and LinkedIn

Time for some Ha Thinking

• Polled some people in the industry

• Thought about my own practices

•Made some changes- Take more of an outside-in approach- Start with a feature test- Explore data and models without being bound

to the database/migrations- Add in model tests and migrations- Mix of controller and feature tests for edge

cases

Thursday, January 16, 14

Page 17: Aikido, Controller Tests, and LinkedIn

Controller Tests I Don’t Write

• Testing the framework- e.g. index action rendering index template

• Testing template via controller test

• Assignments

Thursday, January 16, 14

Page 18: Aikido, Controller Tests, and LinkedIn

Controller Tests I Do Write

•Model/association creation on posts

• Redirects on invalid data/conditions

• Flash messages

Thursday, January 16, 14

Page 19: Aikido, Controller Tests, and LinkedIn

Controller Tests I Do Write

• External APIs- in conjunction with stubs

Thursday, January 16, 14

Page 20: Aikido, Controller Tests, and LinkedIn

Summary• There is value in controller tests

• Starting with feature tests help me keep perspective and explore

• Risk vs Reward- Every line of code costs $- Every line of code is a potential liability

• Always be open to change

Thursday, January 16, 14

Page 21: Aikido, Controller Tests, and LinkedIn

Bonus Tracks

Deleted Scenes

Alternate Endings

Interview with the director

Personalized LinkedIn Invites

Thursday, January 16, 14

Page 22: Aikido, Controller Tests, and LinkedIn

Bonus Tracks

Personalized LinkedIn Invites

Thursday, January 16, 14

Page 23: Aikido, Controller Tests, and LinkedIn

140 Characters Can’t Describe My Sadness

Thursday, January 16, 14

Page 24: Aikido, Controller Tests, and LinkedIn

140 Characters Can’t Describe My Sadness

Thursday, January 16, 14

Page 25: Aikido, Controller Tests, and LinkedIn

Good Networking Etiquette

• Send follow-up and thank you emails- Stand out from the crowd

• Get out there and talk to people- Tell them what you have done, not what

you want to do

• Personalize your LinkedIn invites

Thursday, January 16, 14

Page 26: Aikido, Controller Tests, and LinkedIn

@mdenomy

Thursday, January 16, 14