Michael Feathers - Converting Queries into Commands
This is a key insight into OO from Michael Feather’s article on Converting Queries into Commands
Hi, I'm Andrew and I'm a software developer.
This is a key insight into OO from Michael Feather’s article on Converting Queries into Commands
I gave a talk at RailsConf 2017 in Pheonix, Arizona. Such an amazing experience! Here’s the blurb: Forms are a crucial part of every app and Rails has good defaults for building them—unless you need something complicated. Maybe you want a multi-step wizard? Or maybe you’d like to pluck attributes from any model? Validation becomes a pain point. So you introduce a state machine, or nest your models, or do some other calisthenic to get everything working.
I gave a talk at the Ottawa Ruby Meetup last week. It was lots of fun! My talk was about the idea that mastery in programming is a constantly moving target. I argued that there is always more to learn. Always new things to master. The process is never finished. It’s a continual duality where you’ll go from newbie to expert—back and forth constantly. I talked about how to get competent in something quickly.
I recently discovered something called virtual attributes in Rails. They’re super cool and useful! The basic premise is simple. You, as a developer, want to store some data in your database in a particular format but your user’s want to enter it in a different format. Money is a great example. In Stripe’s API they store money as an integer with cent values. #five dollars and ninetynice cents 599 This is a great way to store money in a database but it’s a terrible format if it’s part of your user interface.
I’m building an application where each user needs their own silo of data. They log in to the app and then can only see and edit their own stuff. There’s a name for this architecture and it’s called multitenancy. Think of it like a condo. The app is the condo building. The users are the tennants. Each tennant only has access to their own apartment. Inside each apartment they fill it up with all kinds of stuff (data) and your job (as Chief Condo Builder) is to make sure each apartment has a lock on it.