Comments (4)
You are right. I use a similar pattern in my code except I only have get, save, and delete operations.
from overholt.
It's a matter of design, which we can argue all day if you want 😏, and thats because design is a matter of opinion. If that works for you, thats fine. I, however, don't like to mix responsibilities in my objects. For example, I don't believe this mixin approach is appropriate when you begin to have more complicated business logic when instances of your models are created, updated, or deleted. A hypothetical scenario might be that, when you create a Product record you must also publish a message to a message queue. In my opinion, it would be inappropriate to encapsulate that logic in a class method on the Product model class. More appropriate would be an object that brings together separate functions that deal with both operations, making the logic easier to test.
from overholt.
Come to think of it, I agree with you on that part. Using service models let's you draw the line between disparate systems.
So just one final question, why not make the methods in the service object static?
EDIT: I initially opened this topic to obtain clarification on why certain design decisions were made in the project template. After given that example, I got a better understanding why it was designed the way it was.
Anyway, I was trying to get away from instantiating the service (especially since I didn't need multiple service objects with different configurations). The service object will definitely need to be instantiated if you want to create differently configured services, and that's why this exercise is pretty much a futile one.
Anyway, thanks a bunch! I had a small epiphany moment when thinking about this.
from overholt.
Awesome! Good luck in your work.
from overholt.
Related Issues (20)
- requirements.txt == versus >= HOT 1
- A question for core.Service HOT 7
- Authentication for Api HOT 1
- Cookies seem to contain successive registration emails. HOT 3
- Thoughts on imports HOT 3
- Where to discuss? Also next steps... HOT 2
- Where would I put signals? HOT 2
- How to use one service from another? HOT 1
- Overholt how to send the flask-security emails via Celery? HOT 4
- Deployment HOT 4
- Test suite hangs and never finishes successfully
- Trouble overriding default Flask-Security Forms
- How is the circular import of celery tasks handled? HOT 1
- decorative view function two times HOT 2
- celery context
- How to use Flask-Restful with this structure HOT 1
- Flask Principal within Overholt
- how to init database HOT 2
- potential decorator issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from overholt.