Skip to content

Instantly share code, notes, and snippets.

@ssoroka
Created January 8, 2011 00:14
Show Gist options
  • Save ssoroka/770355 to your computer and use it in GitHub Desktop.
Save ssoroka/770355 to your computer and use it in GitHub Desktop.
40+ newbie rails mistakes
themes:
Build for failure
expect services to be slow
expect services to be unavailable
Build so components can be easily replaced
Build so code can be easily reused
mistakes:
poor/no error handling (eg, OpenURI can throw Timeout::Error, RuntimeError, OpenURI::HTTPError, Errno::ETIMEDOUT, Errno::ECONNRESET, and Errno::ECONNREFUSED, and probably others)
not handling authentication properly
not building an api
not refactoring
not following SOLID
make it up as you go
no plan
build it from scratch (you wouldn't make your own ketchup, would you?)
ignoring command pattern
doing everything inline with the request (delay it!)
not writing tests first (leads to bad architecture)
not familiar with standard style guide
making your app depend on 3rd party services to run (and assuming they're up)
mocking apis instead of encapsulation
changing class behavior
not testing for errors
not showing errors to the user
reopening classes instead of making modules
making modules instead of making reusable gems
cramming all helpers in ApplicationHelper instead of organizing by context
Security bugs
XSS
SQL Injection
rescue Exception;end
controllers that do too much
long methods
no authentication on js/xml/json/rss requests
unmaintainable code in migrations
overdocumenting
underdocumenting
inline js/css
graceful degredation: js required for app to work
worrying about performance before you have more than 10 users.
performance bugs
n+1 selects
missing indexes
over-engineering/over-thinking (eg: password)
writing your own security anything.
passing multiple arguments by position instead of by name using a hash
not reading everything you can get your hands on
not supporting developers newer than you (you learn answering their questions)
not contributing to open source
@nathanbertram
Copy link

never made any of these mistakes in my life =) +1 great list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment