“strive 8/13 ~ 8/20”
Use
-
[NPM] API Designer
-
[Gem] jbuilder
Read
-
[AWS] vpc aws
-
[API] raml introduction
Book
-
- Model
- AntiPattern: Voyeuristic Models
- follow the Law of Demeter
- In Rails, this could be summed up as “use only one dot.” => class-level delegate method, This method provides a shortcut fondicating that one or more methods that will be created on your object are actually provided by a related objectr
- Push All find() calls into finder on the model
- use scoped
- keep finders on their own model
- follow the Law of Demeter
- AntiPattern: Fat Models
- delegate responsibility to new classes
- composed_of
- make use of modules
- reduce the size of large transaction blocks
- callback, nested attributes
- delegate responsibility to new classes
- AntiPattern: spaghetti SQL
- use your ActiveRecord associations and finders effectively
- as much as possible using sql on own model, others use association to handle it
- leanr and love the scope method
- use a full-text search engine
- use your ActiveRecord associations and finders effectively
- AntiPattern: duplicate code duplication
- extract into module
- template pattarn => use module, and some must implement method => define and execute a class that is missing implementations of template methods
- write a plugin
- metaprograming
- extract into module
- AntiPattern: Voyeuristic Models
- Domain Modeling
- AntiPattern: authorization astronaut
- simplify with simple flags
- AntiPattern: the million-model march
- denormalize into text fields
- when model have the column like state, and need have some method to check state value => use meta-programing to define_method “#{state}?”
- make use of rails serialization
- save in hash
- denormalize into text fields
- AntiPattern: authorization astronaut
- Views
- AntiPattern: PHPitis
- learn about the view helpers that come with rails
- add useful accessors to your models
- extract into custom helpers
- AntiPattern: Markup Mayhem
- make use of the rails helpers
- use haml
- AntiPattern: PHPitis
- Controllers
- AntiPattern: Homemade Keys
- use clearance
- use authlogic
- AntiPattern: Fat Controller
- use active record callbacks and setters
- default values => on migration
- effective callback use
- identification of unnecessary code
- move to a presenter
- use active record callbacks and setters
- AntiPattern: Bloated Sessions
- store references instead of instances
- AntiPattern: Monolithic Controllers
- embrace REST
- AntiPattern: Controller of Many Faces
- refactor non-restful actions into a separate controller
- AntiPattern: A Lost Child Controller
- make use of nested resources
- AntiPattern: Rat’s Nest Resources
- use separate controllers for each nesting
- AntiPattern: Evil Twin Controllers
- use rails 3 responders
- AntiPattern: Homemade Keys
- Services
- AntiPattern: Fire and Forget
- konw what exceptions to look out for
- AntiPattern: Sluggish Services
- move the task to the background
- AntiPattern: Pitiful Page Parsing
- use a gem => nokogiri
- AntiPattern: Successful Failure
- obey the http codes
- AntiPattern: Kraken Code Base
- divide into confederated applications
- AntiPattern: Fire and Forget
-
Using Third-Party Code
- AntiPattern: Recutting the Gem
- look for a gem first
- AntiPattern: Amateur Gemologist
- follow TAM (tests, activity, maturity)
- AntiPattern: Vendor Junk Drawer
- prune irrelevant or unused gems
- AntiPattern: Miscreant Modification
- consider vendored code sacrosanct
- AntiPattern: Recutting the Gem
-
Testing
- AntiPattern: Fixture Blues
- make use of factories
- refactor into contexts
- AntiPattern: Lost in Isolation
- watch your integration points
- AntiPattern: Mock Suffocation
- tell, don’t ask
- AntiPattern: Untested Rake
- extract to a class method
- AntiPattern: Unprotexted Jewels
- write normal unit tests without rails
- load only the parts of rails you need
- brake out the atom bomb
- AntiPattern: Fixture Blues
- Scaling and Deploying
- AntiPattern: Scaling Roadblocks
- build to scale from the start
- AntiPattern: Scaling Roadblocks
- Databases
- AntiPattern: Disappearing Assets
- make use of the system directory
- AntiPattern: Sluggish SQL
- add indexes
- reassess your domain model
- AntiPattern: Painful Performance
- don’t do inruby what you can do in sql
- move processing into background jobs
- AntiPattern: Messy Migrations
- never modify the up method on a committed migration
- never use external code in a migration
- always provide a down method in migrations
- AntiPattern: Wet Validations
- eschew constraints in the database
- AntiPattern: Disappearing Assets
-
Building for Failure
- AntiPattern: Continual Catastrophe
- fail fast
- AntiPattern: Unaudible Failures
- never fail quietly
- AntiPattern: Continual Catastrophe
- Model