Skip to content

Latest commit

 

History

History
51 lines (50 loc) · 5.78 KB

Resources.md

File metadata and controls

51 lines (50 loc) · 5.78 KB

Resources

  • Ruby
    • Object Model
    • Load path / Namespacing / interpreting versions / general naming and file patterns.
      • Gem patterns this is a really great read.
      • Ruby Packaging Standard short and to the point about where different types of code go, how to name them. I don't think this is official, but it describes what the community is already doing.
      • Semantic Versioning describes how to interpret the numbers in a version, useful for getting a good high-level understanding of a gem or change at a glance (or communicating this information to users of your gems).
      • Build a gem applies the things from the above links, a good way to drive it home.
    • Feedback tools
      • Pry can be used to get a REPL into a given environment, with powerful tools to jump between object contexts and display code without you having to go figure out where it is located.
      • SeeingIsBelieving is good for playing with specific ideas like "how does this thing work?", seeing intermediate values, and quickly iterating through a handful of different possibilities and changes.
      • s_arb is a snippet you can use from SeeingIsBelieving to get an ActiveRecord::Base environment, and then quickly change the migrations, the models, and play with the associations, queries, validations, and anything else ActiveRecord related.
    • Learning Ruby
      • Learn the basics with Ruby Kickstart (my material, the RSpec files are out of date, but I'm ~70% through updating them): Material and videos
      • Eloquent Ruby -- recommended by Jeff
  • Gems
    • RSpec - Testing library
    • Faker - Generate fake data (names, addresses, phone numbers, etc)
    • FactoryGirl - Easily build resources
    • Presenters
      • Talk by Jeff this isn't exactly the one I learned from, it's a slight variant he calls a "decorator". It addresses the same problem in a similar way, but it's an object which wraps another object and adds functionality, where presenters use composition instead. I like the "view-model" name, if people at your work are resistant "why do I need more objects?" maybe use this name, then it's like "it's not new, it's just a model... to help the view"
      • Talk by Justin Gordon at RailsConf Start at 13:10, ignore all advocation of concerns (just delete them), disregard anything DHH says about design (think about how coupled Rails is), he mentions polymorphism to remove if statements... if you have the same if statement over and over, then you probably have two objects (Ben Orenstein has a great talk)
        • 13:10 he discusses Draper (Jeff's draper gem)
        • 15:35 he discusses Presenters
        • 18:50 Service Objects. If you nee to share code, move the shared code into its own object and call it from the two consumers. Also, he talks about validations. If your validations require knowledge about the context in which they are being validated, just accept that they can't ever be right, and trying to have them do this will lead to a lot of pain. I spent days trying to work with the "Rails way" on this one, it's not worth it. Just make an object, init it with the model and any context it needs, and have it set errors onto the model. Took like an hour to write what I needed. Code was a bit longer, but w/e, it was explicit, easy to write, easy to read, sufficiently easy to test, and dramatically easier to get correct (if any of this got difficult, I'd probably have it return the errors rather than setting them, and caller would do the setting)
    • Capybara - Interface to traverse web pages and assert about content, structure, etc.
  • Tools
    • iTerm2
    • ag -- search lots of files fast (with regexes)
    • In general, there's a list of tools I use frequently in my debugging lecture notes.
    • 2dir take me to the directory printed by the last command.
    • Phantom Headless (doesn't pop up a GUI) web browser that Capybara can use to navigate our site. Because it's a real browser, it runs JavaScript.
  • Performance
  • Other