Skip to content

Instantly share code, notes, and snippets.

@plrthink
Forked from oldfartdeveloper/larubyconf.org
Created October 30, 2015 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plrthink/89d2bb5714d2e22e8e28 to your computer and use it in GitHub Desktop.
Save plrthink/89d2bb5714d2e22e8e28 to your computer and use it in GitHub Desktop.
LA RubyConf 2015 Notes

LA RubyConf 2015

  • Hired, a placement company for developers is a sponsor

Build to last - Mike Moore - blomage

TL;DR

  • Write code for other programmers, not machines.
  • Code should represent the best understanding of the programmer when he writes it.
  • Refactoring (removing tech debt) is simply the effort to make the code represent the latest understanding of the developer.
  • Code should organize into “neighborhoods”.
  • Tests verify the boundaries between the neighborhoods.

Good presentation for the scope that he’s addressing.

Details

  • He’s a contractor for Google.
  • He and Coby started at about the same time in Ruby.
  • “Magic happens at conferences”.

How to design a Rails app that won’t have to be rewritten in 5 years.

  • Audience - most are noobies.

“the problem”

Legacy apps exist.

“the pain”

  • Gem revisions change
  • Force update to new revisions

Temptation to rewrite it

Says something about how easy it is to write apps.

“the question”

How do we build maintainable apps?

“the answer”

You’re thinking about it wrong.

Waht is Software?

“instructions for a computer to follow”

Emphasis on wrong thing.

https://mitpress.mit.edu/sicp/

SICP is differnce w/ what most people are thinking

Look up first 2 paragraphs of SICP for justification of what software development is.

“intellectual complexity”

Objective becomes to express an idea and/or knowledge.

Challenging but noble.

If we do it wrong, it’s because we think about software wrong.

http://www.lapurtan

“Technical Debt”

“Metaphors we live by”: title of a book that Ward Cunningham read where he came up w/ the term “Technical Debt”.

Change code to make it look easy to understand. “Refactor your code to reveal what you learned while developing the program.”

Always code up to the level of your understanding at the time as best you can.

Ward’s video is very interesting.

https://youtu.be/pqeJFYwnkjE

Technical debt is something you take intentionally (hopefully)

Need to comminicate ideas (intellectual complexity) in a beter way.

A 5 year old app should be pristine because it explains 5 years of understanding.

Have to focus intent. “What are we trying to accomplish with”.

Ruby is a fantastic language at communicating intent.

anthropomorphization - To ascribe human qualities to a non-human entity.

This helps understandable software.

To really truly do this is counterintuitive.

Metaphor is important to consider.

“Code neighborhoods” - Rebecca Wircks Brok

neighborhood is like the functionality in a gem. Draw boundaries around your neighborhoods

Domain modelling is important

Showed anthropomorphization example.

Tests

Important to clarify neighborhood boundaries.

Test around your domain, not within the domain. Results in testing less but having much more value.

ActiveRecord is a private domain to your neighborhood. Instead be sure those are covered in domain methods.

With this approach, testing is fun, once you get the hang of it).

Each neighborhood should have its own tests.

“Be a wise master”

Practical Unix for Ruby & Rails - Ylan Segal

tl;dr

  • Examples of powerful batch scripts using a subset of the Unix utilities.
  • Shows how to set up running rspec seamlessly using a bash script.

Opened my eyes to the next level of bash programming.

Details

  • Formerly from Mexico City.
  • Ruby and Java

How to use Unix for programming tasks

Goal: whet your appetitle

Unix

  • BSD (Mac) is fully compliant
  • Linux is mostly compliant
  • Windows is /not compliant
    • Cygwin makes it more complaint.

Ths Unix Philosophy

  • Use small, sharp tools
  • Do one thing, do it well
  • Expect th outplut of one program to be the input of another, yet unknown, program.

The Unix programming Environment, 1984, Brian Kernighan and Rob Pike

Bash

  • A Unix shell is both a command interpreter and a programming language.
  • You already have it on ac and Linux.
  • On Windows: Use Cygwin or VM

Tail the Log

tail display the last lines of a file.

man - How to find out about unix commands

man name of utility you want info for

grep - file pattern searcher

Example:

tail -f log/development.log | grep '^Started'

Standard streams

  • stdin
  • stdout
  • stderr

Everything is a file in Unix. You can connect files to any of the 3 standard streams.

Presenter shows tail output stdout into grep’s stdin.

Endpoint hit count?

Shows the outpout of the “^Started” logger.

Only want the part that’s between quotes

grep '^started' log/development.log | grep --only-matching '".*"' | sort | uniq

uniq needs sorted criteria.

Extract Info

  • sed
grep '^started' log/development.log | grep --only-matching '".*"' \
| sed --regexp-extended 's/[0-9]+/:id/' | sort | uniq -c | sort --reverse

results in sorted counts of unique relative URLs.

Processes: Unidirectional and Buffered

Each utility fires off its own process. Makes it very fast because can parallelize.

ack - Find Inside Files

grep has competitors: ack and ag (silver searcher; ack writeen in C)

These list files’ paths that are containing text and what lines they are found on. n integrate editors w/ these.

If you pipe ag, it will put all of the output on the same line.

Hence

ag 'FactoryFirl' | grep -o '^spec/.*_spec.rb' | sort | uniq

xargs - Let’s Run Some Specs

ag "FactoryGirl' | grep -o '^spec/.*_spec.rb' | sort | uniq | xargs rspec ...

Different Flavors of RSpec

Problem: jruby boots slowly

All the ways to run rspec:

rspec
bundle exec rspec
bin/rspec
rspec --drb
jruby --ng -S rspec
zeus rspec

Run bitsub if we have them:

chmod +x smart_rspec
cat smart_rspec
*!/bin/bash

# Looking for binstubs
if [ -f ./bin/rspec ]; then
  RSPEC="bin/rspec"
else
  RSPEC= "bundle exec rspec"
file
CMD= "$RSPEC $@" # Passing all arguments on to rspec
echo $CMD
$CMD

lsof - list open files

lsof -i :3000
COMMAND PID USER ...
ruby ...
echo $?

return result is zero if successful; else false

Looking for sport server:

cat smart_rspec
#!/bin/bash

SPORK_PORT=8989

# Looking for binsubs
if [ -f ./bin/rspec ]; then
  RSPEC= "bin/rspec"
else
  RSPEC..
file
# Looking for sportk
lsof -i :$SPORK_PORTd > /dev/null
if if [ $? == 0 ];  then
  RSPEC="$RSPEC --drb
fi

if [ -S ./.zeus.sock ]; then
  RSPEC="zeus rspec"
else
  # ... do what shown previously
fi

Benefit: by writing smart_rspec, he can run rspec w/o worrying about support.

Conclusions

  • The whole is great than the sum of its parts
  • A little Unix goes a long way

Likes destroy all software

Writing Tutorials - Michael Hartl

tl;dr

Learn enough to be dangerous

  • command line

Coming soon:

  • Texte Editor
  • git
  • html
  • css
  • ruby
  • ruby web dev
  • ruby on rails

Learn enough totorial writing to be dangerous

Everything rooted in story/narrative

General Priniples

Meta-Themes

  • Structure & Motivation
  • Structure: what goes where. Hard to get right.
  • Motivation: why are you covering this?
  • General principles
    • Defer as much as you can.

ON the defered material; identify that you’re deferring and then provide a reference to where it will be covered.

Also polite to go back.

Why Hartl built www.softcover.io

Concrete Examples

Showed ls progresively

ls
ls -l
ls -a
ls -rtl
ls -hartl

Make them just the right level of detail to improve user’s sense of flow.

Want to be right on the edge of not too easy and not too hard.

Imagine youself in the mind of the reader.

Repetition

Showing variations repeatedly allows reader to start generalizing.

Do not be afraid to repeat information.

Successive Refinement

Here’s the process:

Activation Energy

If you can just get started, you can get going and into flow.

“Comb-over Principle”

Just keep pushing a little at a time.

5 Steps

Free Association Step

ex: Ruby data structures

Just dump what you associate with

Content Throwdown

Take what you did in previous step and block around data. Don’t worry about polished writing; just “dump”.

If it feels like too much work, defer.

Consider preconditions, flow, etc.

Main Exposition

Now actually attempt to explain what you’re teaching. Can reference previous material that ended then; makes current material more relevant.

Foreward refernece that are broken are prompts for implementation.

Polishing Passes

Can choose to promote material for more prominence.

Often happens 2 or 3 times before showing to the world.

Shipping

Important to get it out there to see if it works.

Michael released HTML version for first review. Not taking peoples’ money yet, so okay. Get feedback.

Promote

Dare to push out there.

More Polishing Passes

Promote, now for sale.

Tricks of the Trade

After a large effort, take a break.

Lots of Figures

  • Can be irrelevant but intended to grab user’s attention.
  • It’s fun for the reader (and for the author). “Feel better for working on this now”

Tables

Take narrative exposition and collect it together all at once.

Develop a Voice

  • tone
  • vocabulary

Depends on desired delivery “tone”.

Stable tone w/ occasional exception for levity. Don’t overdo it.

www.learnenough.com michael@michaelhartl.com www.railstutorial.org www.learnenough.com

What if Shakespeare wrote Ruby?

tl;dr

Action Round

Data Migrations with Maglev

  • JohnnyT
  • @johnny_t

tl;dr

Demonstration of a very old ORM project (Gemstone) that originated with Smalltalk.

Details

Got here late; long lunch.

Show show to do migrations on ORM.

Object become

Smalltalk has this capabilities. Changes class just like Ruby can.

Example: change class and what attributes are used.

blogPost.all_posts.each do |post|
  new_post = Blog::Post.new post.title, ...
  post.become new_post
end

Was Gemstone. Development on MagLev has largely stopped.

Presently at version 1.9.3.

MagLev is open-source. Maximum of 10,000 connected sessions.

2 gig shared page cache.

“Single Stone” - scales vertically. Not horizontally. Large sites have beefy machines.

Not super easy to get started.

  • Docs needs work
  • Install procedures need work

Stupid Ideas for Many Computers - Aja Hammerly @thagomizer_rb

tl;dr

Some wild ideas about doing goofy things in the cloud across many instances. She works for Google so this is more possible.

Actually showing bad ideas for how to do load testing.

Just back from lunch, so I faded in and out.

Her history w/ Ruby

Works on Google Cloud Platform

Stupid

Load Testing

Really STupid TM Load Testing

She’s a wizard Mechanize.

“Computers are just the sum of their parts”; it’s weird - what are the limits?

thagomier@google.com

Hacking Development Culture - Austin Fonacier

tl;dr

  • Invest in your engineeers. Treat them like grownups. Don’t micromanage them.
  • Lead by example.
  • They hired non-Ruby programmers. Have to convince them of tests.

details

Cory Renquist likes to organize people.

Personal Story

Spokeo

  • What is it? - is a people-search engine.
  • 12,000,000,000 records today.
  • 18,000,000 visits/mo

Back in 2006

  • Rails 1.0 released
  • Spokeo’s main purpose as a social media aggregator

2010

  • iPhone 4
  • Las season of Lost
  • Pivots
    • Upgraded to Rails 2 - People search industry
    • traffic grew exponentially
    • lines of code grew exponenetially
    • Austin was hired

Austin Initial impressions

  • Lots of tech debt.
  • “We need to move faster, so don’t worry about tests”.
  • Default rails routes were used. Lots of hidden routes.
  • Hundreds of lines in a single controller method. Ton of nested if statements.
  • No tests

I.e. things were a mess.

Depressed about development culture.

How do you steer a culture when you’re only one developer?

  • How do you sell Rails 3 upgrade to stakeholders?
    • Communication
    • Google Effect - Google search revealed Rails 3 answers; not Rails 2.
    • Security Patches - Rails 3 patching will be getting stopped.
    • Rails Bugs Fixes - only security patches are are taken.
    • Hiring effects - no one wants to work on Rails 2.

Project to upgrade Rails approved.

“Your group is only as good as the expectations and patterns set.” - Austin

So Austin rewrote some text to take technical debt out.

Benefits

What he did:

  1. Documented each line of long controller method.
  2. Understand each line.
  3. The best refactor is where you remove code.
  4. Look for patterns.

So he created a different controller where he extracted common actions.

AFterwards still 84 lines long from almost 200 lines

To finish it, refactored into helper object.

Each function is only 3 lines.

Had to understand schema.

“Leading by example is 75% of leadership.” - Austin

Had a meeting to assert that the refactored code should be the new “best-practices”.

Lessons Learned

  • Good is good enough
  • Code reviews
  • Change is slow
  • Have high expectations

Code reviews are the most impactful way to change the culture.

Roll w/ the punches.

Going Beyond

After good coding practices now what?

  • Now have 70% test coverage.

Democratic Decision Making

  • Switched to angular even though he liked backbone.
  • Encourage side projects
    • Allow experimentation
    • “palate cleansor” - people are excited to work on mainline stuff.
  • Spike projects

Botany w/ Bytes - Lito Nicolai

tl;dr

gem install --pre graphics

He’s looking for a job in Seattle (or remote if awesome).

Chomsky Hierarchy

L-Systems

They don’t fit into Chomsky Hierarchy. Strange slices of other grammars

tl;dr

xxx

xxx

Keynote - Ryan Davis - Zen Spyder

tl;dr

  • Hackers insatiable curiosity.
  • Have to create.
  • How keeping things as simple as much possible speeds things up.

Mind of a Hacker

Seattle Ruby Brigade - last member of

Setting Expectations

  • Keynote? what does that mena?
  • Fluffy Feel good stuff

Talking about Myself

  • “I hate it”
  • Quippy Title != not good
  • LOves food and cooking
  • Grew up in Lousiana
  • Once in a while cooks something so good he can’t believe he cooked it.
  • Loves sharp and good tools
  • Doesn’t like recipe books because no technique (why).
  • Loves cooking technique shows

What makes him tick

  • Loves understanding
  • Pushing buttons

What is a Hacker?

  • Hackers by Steven Levy
  • Insatiable curiosity as to how things work
  • Making
  • Want to understand
  • Need to create
  • Raised by surrounded by artists

Not talking about breaking things

  • What isn’t a hacker

What type of stuff really turns me on?

  • Long walks on the beach
  • Cranes that put up cranes.
  • Machines that make machines that make machines
  • Software that writes itelf.
  • I.e. bootstrapping
  • Meta-tools
  • thinking about thinking
  • Dreyfus model of Skill Acquisition
  • His 4 stages of competence
    • Wrong vs right
    • Analysis vs intuition
  • Consciously levelling up
  • Any level of granularity
    • R: very little
    • Mathematica: 5%
    • Scheme (Racket): Can do it
    • Ruby: easy
  • Find your level
  • Prioritize what you want
  • Plan of Attack
  • How he things about hacking
    1. Real artists ship
    2. Cult of Done Manifestor
    3. Simple Design, Intense Content
      • Simplify
    4. Do the simplest thing that could possibly work
      • Pragmatism
    5. Occam’s Razor - keep the simpler version
    6. To attain knowledge, add things everyday; to obtain wisdom, remove things everyday.
  • He’s happy w/ minitest coz there’s nothing left to remove.
  • Simple designs often come after the project has been running for a while. - Ward Cunningham
  • Focus on the goal right now.
  • http://www.artima.com/intv/simplestP.html
  • Variables in a formula: the simpler the better
  • WWSMW? “what would Sandi Metz wear?”
  • YAGNI - YOu Ain’t Gonna Need It
  • Treat every problem as if it can be solved with ridiculous simplicity. The time you save on the 98% of problems for which this is true will give you ridiculous resources to apply to the other 2%.
  • Measure measure measure - be objective.
  • Measure once, cut once.
  • Repeatable numbers.
  • Author of flog
  • Benchmark, then optimize. We’re terrible at identifying where code is slow; use tools.
  • Measure
    • you
    • team
  • Started working on rails because AR was slow & crufty w/ bad design.
  • Arel was inefficient and excessive.
  • Quickest feedback loop wins.
    • Fail fast
    • Why we pair
    • Tests
    • Continuous deployment
  • Scratch that itch.
    • LOve good code.
    • Love to hate bad code.
  • Nokogiri was written because hpricot was non-compliant and _why ignored it.
  • I made ‘graphics’ because GOSU & ruby-sdl are a mess.
    • game graphics have inverted y-axis. Makes it very difficult to visualize.
  • vlad = 6 thug programmers, 6 dozen cookies, and a plan. Replaces capistrano.
  • Anthrompomorphize technology
    • Helps you keep extraneous interfering details into objects.

Health and Numbers

  • 10 years of wellness data
  • Analyze Trendlines, not Datapoints
  • health = hacked
  • Happy to talk about this later
  • Hence, hack everything.

Questions

When to ship

When it passes its tests

Ship as soon as possible.

When do I abandon a project?

Doesn’t abandon as much as de-prioritize.

  • 5 levels of priority
    • weekly
    • two weeks
    • three weeks
    • five weeks
    • seven weeks

All 90 gems shipped because of having the itches? Answer yes.

  • one offs
  • jokes

They were all itches.

Can you make a hacker?

Answer: his parents did.

REal answer: he’s like that to be true. Get him to have the spark. Doesn’t have a good recipe but would like to have one.

To get commitment: meet every week. Consistency is the most important. Reduces cost of missing one to a minimum.

Why ruby?

  • Most like smalltalk.
  • Most like how his brain works.

Postmorten - Coby Renquist

  • Feels cookie-cutter.
  • Really likes this area; regrets that he probably won’t be able to move back here.
  • Folks have moved on.
  • One year had no speakers from Los Angeles. Overreacted next year.
  • Want to be more motivated about what to do the next time.

Notes:

Ryan has opinions on Cucumber; should discuss w/ him

From discussion at GoGaRuCo cucumber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment