- Hired, a placement company for developers is a sponsor
- 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.
- He’s a contractor for Google.
- He and Coby started at about the same time in Ruby.
- “Magic happens at conferences”.
- Audience - most are noobies.
Legacy apps exist.
- Gem revisions change
- Force update to new revisions
Says something about how easy it is to write apps.
How do we build maintainable apps?
You’re thinking about it wrong.
“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.
“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.
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.
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”
- 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.
- Formerly from Mexico City.
- Ruby and Java
How to use Unix for programming tasks
Goal: whet your appetitle
- BSD (Mac) is fully compliant
- Linux is mostly compliant
- Windows is /not compliant
Cygwin
makes it more complaint.
- 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
- 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
display the last lines of a file.
man
name of utility you want info for
Example:
tail -f log/development.log | grep '^Started'
- 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.
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.
- 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.
Each utility fires off its own process. Makes it very fast because can parallelize.
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
ag "FactoryGirl' | grep -o '^spec/.*_spec.rb' | sort | uniq | xargs 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 -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.
- The whole is great than the sum of its parts
- A little Unix goes a long way
Likes destroy all software
- command line
Coming soon:
- Texte Editor
- git
- html
- css
- ruby
- ruby web dev
- ruby on rails
Everything rooted in story/narrative
- 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
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.
Showing variations repeatedly allows reader to start generalizing.
Do not be afraid to repeat information.
Here’s the process:
If you can just get started, you can get going and into flow.
“Comb-over Principle”
Just keep pushing a little at a time.
ex: Ruby data structures
Just dump what you associate with
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.
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.
Can choose to promote material for more prominence.
Often happens 2 or 3 times before showing to the world.
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.
Dare to push out there.
After a large effort, take a break.
- 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”
Take narrative exposition and collect it together all at once.
- tone
- vocabulary
Depends on desired delivery “tone”.
Stable tone w/ occasional exception for levity. Don’t overdo it.
www.learnenough.com [email protected] www.railstutorial.org www.learnenough.com
- JohnnyT
- @johnny_t
Demonstration of a very old ORM project (Gemstone) that originated with Smalltalk.
Got here late; long lunch.
Show show to do migrations on ORM.
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
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.
- Ruby 2009
- “Worst.Ideas.Evar.” a video – she recommends everyone see it.
- http://github.com/thagomizer/examples - where her code for this resides.
Works on Google Cloud Platform
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?
- 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.
Cory Renquist likes to organize people.
- What is it? - is a people-search engine.
- 12,000,000,000 records today.
- 18,000,000 visits/mo
- Rails 1.0 released
- Spokeo’s main purpose as a social media aggregator
- 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
- 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 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.
What he did:
- Documented each line of long controller method.
- Understand each line.
- The best refactor is where you remove code.
- 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”.
- 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.
After good coding practices now what?
- Now have 70% test coverage.
- 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
gem install --pre graphics
He’s looking for a job in Seattle (or remote if awesome).
Chomsky Hierarchy
They don’t fit into Chomsky Hierarchy. Strange slices of other grammars
xxx
- Hackers insatiable curiosity.
- Have to create.
- How keeping things as simple as much possible speeds things up.
Seattle Ruby Brigade - last member of
Setting Expectations
- Keynote? what does that mena?
- Fluffy Feel good stuff
- “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
- Loves understanding
- Pushing buttons
- 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
- 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
- Real artists ship
- Cult of Done Manifestor
- Simple Design, Intense Content
- Simplify
- Do the simplest thing that could possibly work
- Pragmatism
- Occam’s Razor - keep the simpler version
- 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.
- 10 years of wellness data
- Analyze Trendlines, not Datapoints
- health = hacked
- Happy to talk about this later
- Hence, hack everything.
When it passes its tests
Ship as soon as possible.
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.
- 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.
From discussion at GoGaRuCo cucumber