Created
January 29, 2014 23:26
-
-
Save k4ml/8699461 to your computer and use it in GitHub Desktop.
POPO - Plain Old Python Object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Messaging(object): | |
| def __init__(self, user, sender, receiver, message): | |
| self.user = user | |
| self.sender = sender | |
| self.receiver = receiver | |
| self.message = message | |
| def send(self): | |
| required_points = self.get_required_points() | |
| if required_points > self.user.points: | |
| raise Exception('Not enough points') | |
| return self.backend.send(self.sender, self.receiver, self.message) |
hi @k4ml, I'm new to django/python and I'm looking for articles, books, etc, about the strategy of using pure python objects to place complex business logic. My biggest difficult now is about django project structures. Where this kind of classes should be placed?
do you have any sources related to this?
hi gcaraciolo
Service objects are plain old Python objects (POPOs) that encapsulate a
service or interactions with a system. They are usually kept in a separate
file named services.py or utils.py.
I'm in 2024 and enjoying this thread. Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi @k4ml, I'm new to django/python and I'm looking for articles, books, etc, about the strategy of using pure python objects to place complex business logic. My biggest difficult now is about django project structures. Where this kind of classes should be placed?
do you have any sources related to this?