Large scale server application using DDD with Python? [closed]
Asked Answered
P

2

7

We are preparing to build a large scale server application.

To model the logic effectively we're planning to use DDD, including the tactical patterns such as domain events, specifications, repositories and etc...

Is onion architecture applicable in Python? Are the abstraction abilities sufficient in Python?

Technically speaking:

I've done a little research and saw that there is no popular DI container and actually DI is considered a bad practice in Python, considering that DI is how I'm used to instantiating complex objects in the application layer it seems suspicious...

Architecturally speaking, There is no built in multithreading support in Python (CPython). The cooperative multithreading model offered by Python could be sufficient for single threaded architectures, with scale out options. or is it?

Are there more challenges and things worth considering before diving in?

The bottom line is : Did anyone have experience implementing a large scale enterprise application using DDD with Python? Or should we stick to .NET/Java and be on the safe side?

Photoluminescence answered 24/11, 2013 at 9:5 Comment(1)
I voted to close this question because the topic is too broad to cover in a few paragraphs here. A full answer would require many pages or even an entire book. Please edit your question to narrow the focus to the specific problem you encounter first. Once you have done that the question will be reviewed and reopened.Biome
S
7

Not sure, but it sounds like you may be a new hire within this org coming from a java/.net shop ("...considering that DI is how i'm used to instantiating complex objects in the application layer it seems suspicious...).

Keep in mind

  • You can do DDD with clean design in almost any programming language.

  • Take a look at this video presented by Add Roll. Basically, the primary point being made is that solution scalability is determined by the architecture and design choices not the programming language or platform.

  • Also consider, Drop Box was built with Python and scaled to 1 million users before they ever considered any C-optimizations.

Net-net

From a product development perspective, you generally do not want to put any critical-path item at risk using a "new" technology. New can mean new to market or new to the team/org. In this case, based on the very first part of your post "We are a python shop ", I would at a minimum defer to your internal team's expertise and leverage your existing teams core competencies. Your project will have a much lower risk profile and achieve a quicker time to market versus retraining the staff to use another technology platform.

Selfdiscipline answered 24/11, 2013 at 14:40 Comment(4)
About the points you made: 1. I agree, therefore i asked to see if anyone has relevant experience with python, to know ahead what problems might come up... issues when trying to leverage DDD with python. 2. "determined by the architecture" - no multithreading limits available architectures... so again, i asked if someone has did it before? " design choices" * no DI. * onion architecture in python? * separation of domain/application/technical services to python modules? 3. I agree, python can definitely scale.. We're still in the prototyping stage, didn't decide between python/.net yet...))Photoluminescence
Currently the staff consists of two server side developers : me and a python developer so retraining is necessary anyway... but we're fast learners.. ;)Photoluminescence
If it's just you and one other person, the team is small enough to go either way on technology choices.Selfdiscipline
@Erik I know C# so retraining for me is not a problem.Bak
I
1

If you'll forgive (a) the shameless self-promotion and (b) resuscitating an old thread, my colleague Bob and I wrote a book all about doing DDD and DDD-adjacent "stuff" with Python:

https://www.cosmicpython.com/ (O'Reilly, but it's free to read online in its entirety)

to answer your questions:

  • Is onion architecture applicable in python? Are the abstraction abilities sufficient in python?

Absolutely. The book discusses ways of implementing Onion / Ports & Adapters / Clean architecture patterns. I'm taking the question about "abstraction abilities" to be a worry about Python's dynamic nature and lack of formal interfaces? But in fact those are no barrier. ABCs and the new typing.Protocol are there if you want something like interfaces, but you can get away without them.

  • I've done a little research and saw that there is no popular DI container and actually DI is considered a bad practice in Python

DI is sometimes viewed with some skepticism in the Python world, but I wouldn't say people think it's a bad practice per se. In the book we provide a bit of a defense, and talk about pros + cons, as well showing approaches to "rolling your own" DI (what Mark Seeman called "Pure DI" or "Poor Man's DI") as well as a couple of pointers to Python DI libraries

  • The bottom line is : Did anyone have experience implementing a large scale enterprise application using DDD with Python? Or should we stick to .NET/Java and be on the safe side?

We did, and it turned out fine! So if anyone out there is thinking about it, dive in and join in the fun! :-)

Ichthyoid answered 10/11, 2020 at 15:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.