Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Object-oriented lessons for a service-oriented ...

Object-oriented lessons for a service-oriented world by Chris Kelly

Watch the talk here: https://vimeo.com/68760204

Railsberry

April 22, 2013
Tweet

More Decks by Railsberry

Other Decks in Technology

Transcript

  1. This is a conversation about ideas. It is not a

    prescription for how you have to do it.
  2. Lynx (web browser) - Wikipedia, the free encyclopedia (p1 of

    26) #Edit this page Wikipedia (en) copyright Wikipedia Atom feed Lynx (web browser) From Wikipedia, the free encyclopedia Jump to: navigation, search Not to be confused with Links (web browser) or LynxOS. Original author(s) Lou Montulli, Michael Grobe, Charles Rezac Developer(s) Thomas Dickey Initial release 1992 (1992) Lynx is a highly configurable text-based web browser for use on cursor-addressable character cell terminals.^[1]^[2] It is the oldest web browser currently in general use and development,^[3] having started in 1992 and as of 2013^[update], 21 years later, still in use and development. Arrow keys: Up and Down to move. Right to follow a link; Left to go back. H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list
  3. DRY SOLID LAW OF DEMETER seperation of concerns Single-responsibility principle

    Open-Closed Liskov Substitution Interface Segregation Dependency Inversion Don’t Repeat Yourself Encapsulation
  4. Single Responsibility Do one thing, and do it well. Do

    the smallest thing possible, and nothing more. Make things as simple as possible, but not simpler. Cohesive, everything it does should be related to its purpose.
  5. Repeat Yourself Every piece of knowledge within a system must

    have single, unambiguous, authoritative representation
  6. Public Service Announcement Cache is King Network-based software applications mean

    more overhead. Serialization is expensive, do yourself a favor and don’t do it when you don’t have to. Cache-control and etag headers are a services best friend. Caching is a first order feature.
  7. class Orders < ApplicationController::Base def index @orders = Order.all respond_to

    do |format| format.html format.json { render json: @orders } end end end Not a Application Programming Interface
  8. { “_links”: { “self”: { “href”: “/orders” }, “next”: {

    “href”: “/orders?page=2” }, “find”: { “href”: “/orders/{id}”, “templated”: true }, “_embedded”: { “orders”: [{ “_links”: { “self”: { “href”: “/orders/123” } }, “total”: 1337.00 Behavior { { State
  9. { “_links”: { “self”: { “href”: “/orders” }, “next”: {

    “href”: “/orders?page=2” }, “find”: { “href”: “/orders/{id}”, “templated”: true }, “_embedded”: { “orders”: [{ “_links”: { “self”: { “href”: “/orders/123” }, “cancel”: { “href”: “/orders/123/cancel” } }, Behavior { { State
  10. Get a single issue GET /repos/:owner/:repo/issues/:number { "url": "https://api.github.com/repos/octocat/Hello-World/issues/134 "html_url":

    "https://github.com/octocat/Hello-World/issues/1347", "number": 1347, "state": "open", "title": "Found a bug", "body": "I'm having a problem with this.", "user": { "login": "octocat", "id": 1,
  11. Get a pull request GET /repos/:owner/:repo/pulls/:number { "url": "https://api.github.com/octocat/Hello-World/pulls/1", "html_url":

    "https://github.com/octocat/Hello-World/pulls/1", "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff", "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch "issue_url": "https://github.com/octocat/Hello-World/issue/1", "number": 1, "state": "open", "title": "new-feature", "body": "Please pull these awesome changes",
  12. The Good The Bad The Ugly Link relations are already

    appearing in media types You can implement custom media types The necessary HTTP verb is a missing