Things Rails Didn’t Innovate Not Invented Here Thank you for coming. We’ll be talking about things Rails has not innovated.
GO FUCKING SLOW
Things Rails Didn’t Innovate Not Invented Here Thank you for coming. We’ll be talking about things Rails has not innovated.
GO FUCKING SLOW
Thompson Before we get too far, Let me introduce myself: my name is Caleb Thompson
I’m a developer working in Ruby on Rails for a consultancy who specialize in web and mobile application design and engineering.
We build other people’s ideas.
We'll talk a bit about Rails
But that's my elevator pitch the thing that got you into this room with me instead of Matt Wynn
You can be more effective
at your job
by not innovating
Rails didn’t really invent much at all. The thing is, Rails didn’t really invent much of anything.
Its success is just a matter of execution and delivery The success of the framework has been based on its execution and delivery.
Not that sort of execution. No, not that sort of execution.
Great ideas brought together in new ways
How we got here
So let’s talk about the history of rails.
In around 5000 BCE, the first wheeled vehicles were invented in Sumeria.
They used a technology that may have been around since 9000 BCE but certainly since 6500BCE - the wheel.
Wheeled vehicles were not widely used for thousands of years - this is because they required relatively smooth roads to be effective.
http://upload.wikimedia.org/wikipedia/commons/thumb/2/27/Ridgeway_mongwell.jpg/800px-Ridgeway_mongwell.jpg Around the same time - 5000 BCE - The Ridgeway began to see use.
The Ridgeway is the oldest road in Britain and has been in regular use since before the Bronze Age.
You can see why this isn’t an ideal road for wheeled vehicles - narrow, unpaved.
The first constructed roads were either in Ur or somewhere in the Indus Valley Civilization.
In 4000 BCE they were planning their cities around grids of paved roads.
This technology probably allowed the Indus Valley Civilization to become the most widespread in its time, covering most of what is now Pakistan and northwestern India, Afganistan, and Iran.
By 3000 BCE, simple carts with wheels had been evolved from an earlier sled made of two pieces of wood joined together to allow things to be carried by dragging.
http://www.rottentomatoes.com/m/paul_blart_mall_cop/news/1791902/box_office_guru_wrapup_paul_blart_segways_ahead_of_the_competition/ A couple hundred years later, we begin to see two wheeled chariots.
These were hauled by onagers, which are related to donkeys, and it is the first time we see animals pulling wheeled vehicles.
http://www.deccanchronicle.com/130501/sports-motor-sports/gallery/sportstars-and-their-four-wheeled-chariots Around 2500 BCE we see very heavy four wheeled chariots.
These were heavy enough that they were not in regular use because of poor roads and we see them primarily near farms.
http://www.bigredcollective.com/corduroy-road-1 This leads us into the need for sturdier roads.
While these were certainly less effective than the paved roads we saw in Ur and the Indus Valley Civilization, in Glastonbury, England we start to see corduroy roads circa BC 3300.
Courduroy roads are roads built by joining together logs and are typically used for crossing shallow bodies of water, flattening dips in paths, or muddy areas.
Coruroy roads improve roads slightly, but are a hazard to heavy animals such as horses or oxen as the logs shift under weight.
http://upload.wikimedia.org/wikipedia/commons/6/63/AlaskaHWY.JPG As an interesting aside, one of the highways in Alaska - where I grew up - is built on top of a corduroy road buried in soil so that it decays slowly.
They just paved right over the corduroy road, using it as a foundation for the more modern road.
http://www.dailymail.co.uk/sciencetech/article-2218396/The-modern-Stone-Age-familys-cutlery-Designers-recreate-ancient-tools-using-modern-materials-techniques.html Back to more primitive roads, by 2000 BCE stone cutting tools made paving much easier.
It meant that even small local roads could be paved, meaning that vehicular transport became vastly more e ﬃ cient and widespread.
http://huskertim27.deviantart.com/art/Minotaur-road-rage-260878537 Around this time, Minoan Greeks paved an unprecedented 50km road from Knossos to Gortyn.
This road is the first time that we see regular transport of good and people across such large distances.
http://vimeo.com/43222290 In the 5th century BCE, Darius commissioned his Royal Road.
The road was 2699 km and was so well-constructed that mounted couriers could convey letters and packages across it in seven days.
http://nplusonemag.tumblr.com/post/27919786178/neither-snow-nor-rain-nor-heat-nor-gloom-of-night Herodotus (her-ah-doh-tus) praised these couriers with the words that are now thought of as the uno ﬃ cial creed of the United States Postal Service:
"Neither snow nor rain nor heat nor gloom of night stays these couriers from the swift completion of their appointed rounds"
Around the time that Darius was building the Royal Road, the Romans began work on what would become a network of over 400,000 km of roads.
Over 80,000 km of those were paved.
They provided e ﬃ cient means for the overland movement of armies and civilians, communication throughout the empire, and trade.
http://seekingsantosha.wordpress.com/2012/10/19/all-roads-lead-to-rome/ These roads, of course, are the origin of the sentiment, “All roads lead to Rome”
http://www.kotaku.com.au/2011/01/the-greek-engineer-who-invented-the-steam-engine-2000-years-ago/ In 600 BCE, we see the first rudimentary railway, the Diolkos.
The Diolkos was used to transport ships overland across the narrowest section of the Isthmus of Corinth.
Rails were used to reduce the friction between the ground and the carts the ships were carried on.
http://mygermantravels.com/2010/12/frankfurt-trains-%E2%80%93-an-autobahn-alternative/ Jump forward 2000 years to the 1550s and we see the first rudimentary wagon ways and tramways being built in Germany.
This sort of transport was used by miners to move large amounts of coal out of the mines - a single horse could haul fifty or sixty bushels, or 330 pounds.
http://en.wikipedia.org/wiki/File:Polar_Bear_-_Alaska.jpg Which is about the weight of a small adult polar bear.
http://compellingparade.com/2011/09/i-think-i-can/ Modern freight trains transport in the range of 10,000 tons across continents by building on the technology from 7000 years ago.
http://redfox.typepad.com/forest/2009/11/fashion-and-geography.html Which is 10,250 polar bears
http://www.mrwallpaper.com/paris-eiffel-tower-wallpaper/ Or about the weight of the Eiffel tower
http://www.spacex.com/hyperloop And even future technologies are based on the ideas that came before.
Haha, what? Okay, so why did I just give you a history lesson on wheels, roads, and transportation?
They weren’t reinventing the wheel The point of all this is that throughout history we’ve built upon the technologies that already existed.
By stealing the ideas of those who came before us, we were able to advance and create new and interesting things - we focused on new problems rather than those which had already been solved.
Rails stole ideas
...but which ones?
What do we think of when we think Rails? Rails was released in 2004
C ontroller was conceived as a general solution to the problem of developers controlling a large and complex data set. Separating business logic and data - model layer
User experience and interaction - view layer
and a bit of glue to connect the two - controller layer
The essential purpose of MVC is to bridge the gap between the human user's mental model and the digital model that exists in the computer. Trygve Reenscrag XEROX PARC 1978-79 TRIT-vee Rain-skau
Active Record The mapping between database tables and business logic in applications happens in
An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data. Martin Fowler Patterns of Enterprise Application Architecture He co-authored the Manifesto for Agile Software Development, popularized the term Dependency Injection, and specializes in UML, extreme programming, and object-orienting analysis and design.
He also recently debated Test Driven Development with DHH. I haven’t had a chance to watch that video yet, so no spoilers.
RE presentational S tate T ransfer is a uniform interface for the web REST is a technology that replaced things like SOAP and Remote Procedure Calls to represent information and activities on the Internet.
T h i s i d e a l i z e d m o d e l o f t h e interactions within an overall Web application… became the foundation for the modern Web architecture Roy T. Fielding and Richard N. Taylor Principled Design of the Modern Web Architecture
Rails didn’t invent REST • Now while Rails didn’t invent REST, what’s interesting is that when Rails adopted REST as its primary interface, REST wasn’t the clear winner before that happened.
• Rails took a technology that was:
• not theirs
• not all that popular
• and potentially just a “cool new thing” that could be a passing fad
• and contributed to its success and popularity through that decision.
Convention over Configuration seeks to decrease the number of decisions
that developers need to make, gaining simplicity , b u t n o t n e c e s s a r i l y l o s i n g flexibility.
defaults JavaBeans config files
ERB provides an easy to use but powerful
templating system for Ruby. embedded ruby
It is ruby
So why is Rails so popular?
http://blogs.huongngo.com/dds/2010/11/15/monday-november-15/ At a high level, Ruby on Rails became a popular web application framework in part because of how easy it makes it to rapidly create a prototype, and then to take the prototype and scale up to a production application.
Execution is crazy important • Rails does a great job of taking the ideas we’ve seen and combining them usefully.
• This means that the conventions Rails relies upon to facilitate rapid development are present throughout the framework.
• It also means that everything works together seamlessly.
• Rails success relies heavily on this execution.
is key 15 blog in rails
Build a blog from scratch
have a running web server in seconds
What can we learn from this? Alright, we know something about Rails now.
I promised I’d bring this back around to making you a better developer, so let’s start with this question.
There is nothing wrong with taking other’s ideas
Rails was built on the shoulders of giants
That worked out pretty well
Keep it simple.
Strong, useful conventions make code easy to find and reduce mundane decision making
Not designed by committee
DHH still contributes • And DHH is still a primary contributor, and has the most say of anyone in the direction of the framework.
• He is fond of saying that Rails is for Basecamp (the application from which the framework was extracted), and that it just happens to be useful in other applications.
• In his “Benevolent Dictator for Life” role within Rails, he makes a lot of the decisions himself about what will happen in Rails’ future.
• These decisions may not always be popular, but they keep things from getting tangled up in bureaucracy.
Released in July of 2004
Didn’t share commit rights until February of 2005 ~6-7 months
strong_parameters parameter whitelisting, protects from query parameter injection in controllers
turbolinks Replaces GET requests with AJAX which replace the body element of the page
turbolinks (not a popular decision)
While we may not always agree with him
It doesn’t matter; he’s doing it anyways
While this can be frustrating, you can’t argue with success
Almost 35 million downloads, and 32 thousand just for this version.
What can we take from this?
I know you want to build.
Interesting problems are fun to solve
but they already have been
Don't be seduced by the problem
You are trying to get something out the door
Buy for parity build for competitive advantage You’ve probably heard of the adage, Buy for parity; build for competitive advantage.
It means that you shouldn’t spend time building things that already exist, but rather focus on things that differentiate you.
123 Main St Anytown, MA 12345 As a consultant, I see a lot of companies who want to validate addresses.
It seems like a simple thing on the surface - you have to have a street address, a city, a state, and a ZIP code.
123 Main St Apartment #5 Anytown, MA 12345 but then you run into addresses with two street lines, which you’ll have to support as well.
123 Main St Basement Anytown, MA 12345 And the di ﬃ culty increases when you realize that there’s no real rules for what goes on the extra line.
c/o somebody else 123 Main St Anytown, MA 12345 And that the order of the street address lines doesn’t affect the deliverability
Bank of Canada 234 Laurier Avenue West Ottawa, Ontario, Canada K1A 0G9 And of course, you’ll have to support addresses in other countries, with weird address formats.
Caleb Thompson FNBA Downtown branch Downtown, Anchorage, Alaska Hell, I once got a coconut delivered to me at work in Anchorage, Alaska from Hawaii.
Caleb Thompson FNBA Downtown branch Downtown, Anchorage, Alaska I think it was delivered partially because of all of the stamps she had stapled to it.
http://theunboundedspirit.com/holy-madness-and-insanity/ The point is, validating addresses is hard.
It’s what we call a core competency: you should only focus on doing it if deliverability is how you make money.
And if it isn’t, you should pay someone else to do it for you while you do the things that differentiate you.
This is a case where you shouldn’t even bother stealing ideas - just let other people take care of it for you.
Are you going to have a better idea than Fielding had about REST? Okay, so back to not reinventing things.
But don’t take it from me
Caleb Thompson @thompson_caleb calebthompson firstname.lastname@example.org
Don’t just sit there. Learn Something. learn.thoughtbot.com SCOTRUBY14 for 30% off a Learn Prime subscription I work for a company called thoughtbot. - I wouldn’t have been able to come to scottish ruby without them.
To thank you for your time, I’d like to offer all of you a free month subscription to Learn Prime - just use this coupon code.
I’ve also got stickers, so if you would like one come and find me. I accept other stickers, cool stories, and drinks in exchange.