Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords many different ways of writing a CRUD app
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords Ruby is modular, object oriented. Leverage ways to abstract code for reuse by others Write as if you intend to abstract later
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords But wait, our saviour Sandi Metz says “Duplication is far cheaper than the wrong abstraction”
and gives it a name. This creates a new abstraction. It could be a new method, or perhaps even a new class. 3. Programmer A replaces the duplication with the new abstraction. Ah, the code is perfect. Programmer A trots happily away. 4. Time passes. 5. A new requirement appears for which the current abstraction is almost perfect. 6. Programmer B gets tasked to implement this requirement. Programmer B feels honour-bound* to retain the existing abstraction, but since isn't exactly the same for every case, they alter the code to take a parameter, and then add logic to conditionally do the right thing based on the value of that parameter. What was once a universal abstraction now behaves differently for different cases. 7. Another new requirement arrives. Programmer X. Another additional parameter. Another new conditional. Loop until code becomes incomprehensible. 8. You appear in the story about here, and your life takes a dramatic turn for the worse. 9.
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords - payment gateways - sending data to an external API - filtering a recordset by a string or metadata.
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords - Easier to test, maintain - Allows for a clean interface - Encapsulation
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords “Hey, I saw that you created X for Y and I’d like you to do X for Z… My budget is half a baristas’ annual salary (excluding tips)”
Decouple responsibility - Separation of concerns - Modular scaling - stop reinventing the wheel - …and many more buzzwords Short term wins < Long profit Delayed gratification > Instant gratification
wanted a CMS but not a CMS - The ability to add new images to the site without having to duplicate uploading of images - handle existing 9000+ images - Ability to create pages, with no markup or style experience - An admin area for administrating content (but not complex) - Doesn't want to look like a college or school - Wants Wordpress flexibility, 500px swagger, Indian takeaway website budget
site - MediaManger (admin) - MediaSlider (front page sliders) - MediaGallery (Main gallery with filters) Common Components Main Components 3 shared dependencies - Gallery component (used on Media Manager, Media Gallery) - LinkTag (used on all images) - Searchbar (used on Media Manager and the dropzone)