Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

25/10/2018 PORO objects & their usage - presentation from Spark Academy 2018: Ruby on Rails Workshops

211 views

Published on

Spark Academy are recurring 2-hour workshops every Thursday at 18.30 in Spark’s office at Jasna 15 (started on October 25th) and happening every week, according to the schedule. Each workshop will have separate topic and consist of a live coding session / devops with some homework for the participants, to be submitted for review and feedback (not mandatory).

For whom?
For Junior and Mid RoR developers

Why?
Free RoR workshops with Senior Developers on interesting topics - improve your dev skills, gain some experience, make new friends!

Mentors
Piotr Leniec - Senior Fullstack Dev at Spark Solutions
Yuriy Kushnir - Senior RoR Dev at Spark Solutions

How to enroll?
1. Book some time
2/ Complete an evaluation task: Create a simple URL shortener using Rails or any other Ruby Web Framework and deploy it to Heroku.The user should be able to paste a link of any length and convert it to a short 8-character URL. Provide a link to Github / BitBucket repo & a link to a deployed website on Heroku.
3. Submit your application with a link to your task solution
4. Wait a bit for our reply
5. Code!

Seats are limited, so apply now! We’ll be selecting the most promising candidates.

Schedule & Topics*

10/25/2018 PORO objects & their usage
11/8/2018 AWS/Heroku/DevOps
11/15/2018 Newest Rails Features
11/22/2018 Advanced Testing
11/29/2018 Refactoring techniques & approaches
12/6/2018 Rails Performance Optimization
12/13/2018 Payment Provider Integration

* Some workshops will be delivered in English

Apply TODAY! Number of seats is limited. Snacks and drinks are on us :)
https://spark-solutions.workable.com/jobs/833497

Published in: Internet
  • Be the first to comment

  • Be the first to like this

25/10/2018 PORO objects & their usage - presentation from Spark Academy 2018: Ruby on Rails Workshops

  1. 1. Eric Evans - Domain Driven Design
  2. 2. Value Objects A small simple object, like money or a date range, whose equality isn’t based on identity. The attributes of a value object will remain unchanged from instantiation to the last state of its existence.
  3. 3. Value Objects
  4. 4. Arguments together all the time One attribute with behaviour Two inseparable attributes - value and unit Class enumerable Value Objects
  5. 5. Value Objects
  6. 6. Value Objects
  7. 7. Hashie Dry-Struct Virtus Values Dry-Attribute Value objects are simple, you don’t have to use a gem to introduce them to your application Value Objects
  8. 8. Callable
  9. 9. A separate class that contains one specific query that implements just one business logic rule and isolates complex queries. Query Objects should be built in a way that supports composition with other Query Objects Query Objects
  10. 10. Query Objects
  11. 11. Stick to one naming convention Use .call method returning a relation to call query objects Always accept relation like object as first argument Provide a way to accept extra options Focus on readability of your querying method Group query objects in a separate namespaces Query Objects
  12. 12. Query Objects
  13. 13. Query Objects
  14. 14. Query Objects
  15. 15. Use Query Objects when: ● You need to reuse one query in multiple places of application ● You need to extend, compose or inherit queries and their relations ● You need to write a lot of raw SQL, but don’t want to mess up your code ● Your query is too complex / vast for just one method or scope Don’t use Query Objects when: ● Your query is simple enough for just one method or scope ● You don’t need to extend, compose or inherit your query ● Your query is unique and you don’t want to make it reusable Query Objects
  16. 16. Primitive Ruby objects, used for checking operations in isolation Policy Objects encapsulate and express a set of business rules Predicate methods No side effects and modification of passed attributes Simple logic, no database calls and complicated operations Policy Objects
  17. 17. Policy Objects
  18. 18. Policy Objects
  19. 19. A Service Object is meant to decompose business objects into manageable classes and methods Commands Services Operation [TRB] Service Objects
  20. 20. The action is complex The action reaches across multiple models The action interacts with an external service The action is not a core concern of the underlying model There are multiple ways of performing the action Service Objects
  21. 21. Service Objects
  22. 22. Service Objects
  23. 23. A form object is an object designed specifically to aggregate data to create multiple objects or to receive ephemeral data that is used and then discarded. Form Objects
  24. 24. Form Objects
  25. 25. Form Objects
  26. 26. Simple classes that sit between the model and the view and provide a nice, DRY object-oriented way of working with complex display logic Presenters / Decorators
  27. 27. Presenters / Decorators
  28. 28. Presenters / Decorators
  29. 29. Presenters / Decorators
  30. 30. There are two types of Interactors - Basic Interactors and Organizers Organizer’s purpose is to run other interactors via shared global context Basic interactor is a single-purpose building block of application. Interactors
  31. 31. Interactors
  32. 32. Interactors
  33. 33. Provides a unified interface to a set of interfaces in a subsystem Facade defines a higher-level interface that makes the subsystem easier to use Facades
  34. 34. Facades
  35. 35. Don’t be afraid to have a lot of different objects It’s much better to have a billion classes with 1 method than to have 1 class with a billion methods SOLID / DDD / PoEAA Final Thoughts
  36. 36. Q & A
  37. 37. Send your homework to yura.kushnir+academy@sparksolutions.co

×