Domain-Driven Design with Golang by Matthew Boyle BIRMINGHAM—
Author:Matthew Boyle BIRMINGHAM—
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2022-12-02T00:00:00+00:00
The service is small. We call our validateAndEnrich function to mutate the purchase object for us to add some necessary values. We could also have made Purchase both a value object and an entity, which would have meant we did not need to mutate.
After calling purchase.validateAndEnrich(), we have some logic depending on the payment means. If itâs a card, we call CardService to create the purchase. We donât have CardService defined yet, so for now, we are creating an interface.
Letâs imagine that your team has split into two halves. One half is working on payments, and the other on implementing purchases. We could meet with the payment team and agree on a contract for what CardService will look like (in Go, we call these contracts interfaces), and then we can continue with our implementations at separate paces. This is a really powerful pattern so use it often when working with other teams!
Finally, if all goes well, we call PurchaseRepo to store our new purchase.
We define repository.go inside the purchase package:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
AI & Machine Learning | Bioinformatics |
Computer Simulation | Cybernetics |
Human-Computer Interaction | Information Theory |
Robotics | Systems Analysis & Design |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8297)
Test-Driven Development with Java by Alan Mellor(6713)
Data Augmentation with Python by Duc Haba(6624)
Principles of Data Fabric by Sonia Mezzetta(6377)
Learn Blender Simulations the Right Way by Stephen Pearson(6273)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6141)
Hadoop in Practice by Alex Holmes(5958)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
RPA Solution Architect's Handbook by Sachin Sahgal(5539)
Big Data Analysis with Python by Ivan Marin(5359)
The Infinite Retina by Robert Scoble Irena Cronin(5234)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5144)
Pretrain Vision and Large Language Models in Python by Emily Webber(4320)
Infrastructure as Code for Beginners by Russ McKendrick(4080)
Functional Programming in JavaScript by Mantyla Dan(4038)
The Age of Surveillance Capitalism by Shoshana Zuboff(3948)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3795)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3599)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3572)
