SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Why you shouldn’t use
Django for that
Architecture,
the lost years
Robert C. Martin
“Web” is not an
architecture.
Frameworks are
not architecture.
Django is a tool,
not architecture.
WAIT!
What does this even mean?
Ivan Stepaniuk
@istepaniuk
Application metaphor, the three layers
1 32
1.Interact with the user, both ways
1 32
3. Interact with outside world, other systems
1 32
2. The code that justifies the app existence
1 32
Are these layers equally important?
Do we build them the same way?
Do these change at the same pace?
It is all about
CHANGE
OK
How does business logic look like?
Patterns
Enterprise
Application
Architecture
Martin Fowler
Transaction Script
Modeled as procedures
+ Easiest to understand.
+ Obvious transaction boundaries.
- Difficult to de-duplicate.
Table Module
Modeled as objects and Record Sets
+ No DB vs. OO impedance mismatch.
- Model is database-centric.
- Objects, but not really OO.
Domain Model
Modeled after the business you work with.
+ Real OOP, with all the OO advantages.
- Hardest to comprehend and switch to.
- Code overhead for simple logic.
Domain Model
Modeled after the business you work with.
+ Real OOP, with all the OO advantages.
- Hardest to comprehend and switch to.
- Code overhead for simple logic.
Which pattern should I use?
Which one should we use?
Efforttoenhance
Complexity of the business logic
Which one should we use?
Efforttoenhance
Complexity of the business logic
7.42
Which pattern does Django follow?
Domain Model
Architecture
Antipatterns
Anemic Domain Model
- Objects have state, but no behavior
- The Business is somewhere else
Leads to:
- Upside down Transaction Script
- God objects
Anemic Domain Model
- Objects have state, but no behavior
- The Business is somewhere else
Leads to:
- Upside down Transaction Script
- God objects
Mixins!
To inject concerns
Table Driven Domain Model
- The data model is the domain model
- All objects backed up by a table
Leads to:
- High viscosity
- Complex, slow, fragile tests
- CRUD obsession
Table Driven Domain Model
- The data model is the domain model
- All objects backed up by a table
Leads to:
- High viscosity
- Complex, slow, fragile tests
- CRUD obsession
CREATE
READ
UPDATE
DELETE
DATABASE
DATABASE
DATABASE
DATABASE
Connected Domain Model
In a connected system, elements are highly available to each other.
Adding the first feature to a connected system is cheap …
… the cost of all those connections is that subsequent features
are very likely to interact with previous features, driving up the the cost …
In a modular design, connections are deliberately kept to a minimum.
The cost of the first feature is likely to be higher …
Features are less likely to interact in a modular system, though,
leading to a steady stream of features at relatively constant cost.
- Kent Beck
Connected Domain Model
WAIT!
OK, Active Record is bad, but
what about productivity?
Django vs. OOP
Django vs. OOP
Is not the debate here
Questions?
Or come and ask me later!
Thank you!
Oh, and we are hiring!
@istepaniuk

Weitere ähnliche Inhalte

Andere mochten auch

教師須知:如何應用維基百科作為教育工具
教師須知:如何應用維基百科作為教育工具教師須知:如何應用維基百科作為教育工具
教師須知:如何應用維基百科作為教育工具Liang-chih Shangkuan
 
Pract 9 cons energia
Pract 9 cons energiaPract 9 cons energia
Pract 9 cons energialaury kiryu
 
Smart, flipped, moodle and how they interact 2015
Smart, flipped, moodle and how they interact 2015Smart, flipped, moodle and how they interact 2015
Smart, flipped, moodle and how they interact 2015russechd
 
Referat paris ppt
Referat paris pptReferat paris ppt
Referat paris pptEdith Degat
 
Poliartrita reumatoida
Poliartrita reumatoidaPoliartrita reumatoida
Poliartrita reumatoidaNegotei Elena
 
Diagrama de flujo 9
Diagrama de flujo 9Diagrama de flujo 9
Diagrama de flujo 9laury kiryu
 
Diagrama de flujo pract 3 hidrolisis
Diagrama de flujo pract 3 hidrolisisDiagrama de flujo pract 3 hidrolisis
Diagrama de flujo pract 3 hidrolisislaury kiryu
 
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud Softchoice Corporation
 
Noticia Semana de Orientación hacia la Educación Superior
Noticia Semana de Orientación hacia la Educación SuperiorNoticia Semana de Orientación hacia la Educación Superior
Noticia Semana de Orientación hacia la Educación SuperiorColegio Camilo Henríquez
 
Ontenció y propiedades del alqueno
Ontenció y propiedades del alquenoOntenció y propiedades del alqueno
Ontenció y propiedades del alquenoJhonás A. Vega
 
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...Softchoice Corporation
 
How to become a Medical Assistant
How to become a Medical AssistantHow to become a Medical Assistant
How to become a Medical AssistantMarie Reynolds
 

Andere mochten auch (14)

教師須知:如何應用維基百科作為教育工具
教師須知:如何應用維基百科作為教育工具教師須知:如何應用維基百科作為教育工具
教師須知:如何應用維基百科作為教育工具
 
Pract 9 cons energia
Pract 9 cons energiaPract 9 cons energia
Pract 9 cons energia
 
Todo sobre mi
Todo sobre miTodo sobre mi
Todo sobre mi
 
Apple Tree
Apple TreeApple Tree
Apple Tree
 
Smart, flipped, moodle and how they interact 2015
Smart, flipped, moodle and how they interact 2015Smart, flipped, moodle and how they interact 2015
Smart, flipped, moodle and how they interact 2015
 
Referat paris ppt
Referat paris pptReferat paris ppt
Referat paris ppt
 
Poliartrita reumatoida
Poliartrita reumatoidaPoliartrita reumatoida
Poliartrita reumatoida
 
Diagrama de flujo 9
Diagrama de flujo 9Diagrama de flujo 9
Diagrama de flujo 9
 
Diagrama de flujo pract 3 hidrolisis
Diagrama de flujo pract 3 hidrolisisDiagrama de flujo pract 3 hidrolisis
Diagrama de flujo pract 3 hidrolisis
 
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud
Softchoice Webinar: Virtual Whiteboard Session on Hybrid Cloud
 
Noticia Semana de Orientación hacia la Educación Superior
Noticia Semana de Orientación hacia la Educación SuperiorNoticia Semana de Orientación hacia la Educación Superior
Noticia Semana de Orientación hacia la Educación Superior
 
Ontenció y propiedades del alqueno
Ontenció y propiedades del alquenoOntenció y propiedades del alqueno
Ontenció y propiedades del alqueno
 
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...
Étude Softchoice. Favoriser l’innovation : les actes en disent plus long que ...
 
How to become a Medical Assistant
How to become a Medical AssistantHow to become a Medical Assistant
How to become a Medical Assistant
 

Ähnlich wie Why you shouldnt use django for that

Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented developmentrajmundr
 
Life Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby AppsLife Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby AppsTristan Gomez
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesJon Meredith
 
Architecture by Accident
Architecture by AccidentArchitecture by Accident
Architecture by AccidentGleicon Moraes
 
SQL in the Hybrid World
SQL in the Hybrid WorldSQL in the Hybrid World
SQL in the Hybrid WorldTanel Poder
 
Super Sizing Youtube with Python
Super Sizing Youtube with PythonSuper Sizing Youtube with Python
Super Sizing Youtube with Pythondidip
 
Why mongo db was created - Dwight Merriman - MongoSF 2011
Why mongo db was created  - Dwight Merriman - MongoSF 2011Why mongo db was created  - Dwight Merriman - MongoSF 2011
Why mongo db was created - Dwight Merriman - MongoSF 2011MongoDB
 
Agile data lake? An oxymoron?
Agile data lake? An oxymoron?Agile data lake? An oxymoron?
Agile data lake? An oxymoron?samthemonad
 
Data massage! databases scaled from one to one million nodes (ulf wendel)
Data massage! databases scaled from one to one million nodes (ulf wendel)Data massage! databases scaled from one to one million nodes (ulf wendel)
Data massage! databases scaled from one to one million nodes (ulf wendel)Zhang Bo
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesUlf Wendel
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
Big iron 2 (published)
Big iron 2 (published)Big iron 2 (published)
Big iron 2 (published)Ben Stopford
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureThomas Jaskula
 

Ähnlich wie Why you shouldnt use django for that (20)

The JSON architecture
The JSON architectureThe JSON architecture
The JSON architecture
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 
Life Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby AppsLife Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby Apps
 
L07 Oranizing Domain Logic
L07 Oranizing Domain LogicL07 Oranizing Domain Logic
L07 Oranizing Domain Logic
 
L13 Oranizing Domain Logic
L13 Oranizing Domain LogicL13 Oranizing Domain Logic
L13 Oranizing Domain Logic
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL Databases
 
Architecture by Accident
Architecture by AccidentArchitecture by Accident
Architecture by Accident
 
SQL in the Hybrid World
SQL in the Hybrid WorldSQL in the Hybrid World
SQL in the Hybrid World
 
Os Solomon
Os SolomonOs Solomon
Os Solomon
 
Super Sizing Youtube with Python
Super Sizing Youtube with PythonSuper Sizing Youtube with Python
Super Sizing Youtube with Python
 
Let's talk about... Microservices
Let's talk about... MicroservicesLet's talk about... Microservices
Let's talk about... Microservices
 
Why mongo db was created - Dwight Merriman - MongoSF 2011
Why mongo db was created  - Dwight Merriman - MongoSF 2011Why mongo db was created  - Dwight Merriman - MongoSF 2011
Why mongo db was created - Dwight Merriman - MongoSF 2011
 
Agile data lake? An oxymoron?
Agile data lake? An oxymoron?Agile data lake? An oxymoron?
Agile data lake? An oxymoron?
 
Data massage! databases scaled from one to one million nodes (ulf wendel)
Data massage! databases scaled from one to one million nodes (ulf wendel)Data massage! databases scaled from one to one million nodes (ulf wendel)
Data massage! databases scaled from one to one million nodes (ulf wendel)
 
Ibm redbook
Ibm redbookIbm redbook
Ibm redbook
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodes
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
Big iron 2 (published)
Big iron 2 (published)Big iron 2 (published)
Big iron 2 (published)
 
L15 Organising Domain Layer
L15 Organising Domain LayerL15 Organising Domain Layer
L15 Organising Domain Layer
 
CQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architectureCQRS recipes or how to cook your architecture
CQRS recipes or how to cook your architecture
 

Kürzlich hochgeladen

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 

Kürzlich hochgeladen (20)

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 

Why you shouldnt use django for that

Hinweis der Redaktion

  1. Confession: The title is a bit of trick. We are going to speak about application architecture.
  2. 2013 Norwegian Developers Conference - (and Javier Acero excellent talk in Madrid) How the web changed the way we write software In the first “WEB” decade, we forgot a lot about architecture. Smart people retire.
  3. The web is ONE transmission channel, is how you deliver, it's a detail. That's all. If PostNL changes to UPS - your business keeps running.
  4. Frameworks are tools, they can't be in the center of the architecture. Architecture is more about DEFERRING decisions than to decide. Frameworks should too, be a detail.
  5. So Django CAN'T be the center of your application. Most importantly, architecture-wise: The way we write applications in Django is -NOT- a generally correct way to write an application
  6. WTF does this mean? What do you mean by application architecture then? Let's think through this!
  7. I work at the cloakroom as a backend developer, we use python (and even some django)
  8. The classic 3 layers. Deliberately, not going to try to name all three now
  9. Producing HTML JSON, An HTTP API, REST Command Line Desktop or Mobile UI widgets
  10. Databases and Message Queues Sending an email The file system
  11. Validation, Calculation Calls to external systems (or preferably to abstractions) IE: Calculate taxes, add invoice lines, etc. This is the Business logic.
  12. What is it more important? that a form looks nice, it's usability? that the persistence is really fast? or... that taxes to be calculated correctly?
  13. NO WE DON’T! The Busines Logic layer is more difficult to reuse between different problem domains. It is specific. Layer 3, ...we generally do not write DB drivers, or SMTP clients, etc.
  14. .
  15. Do these layers change at the same pace? 1: Technology changes, a decade ago no JS on the front. 3: We now have NoSQL stores, many of them. 2: BL: Domain rules change slowly, length of a credit-card or the age of a person.
  16. What is Business Logic anyway?
  17. This influential book from 2003 You wanna read it if you haven’t Mentions the patterns we are going to discuss
  18. Modeled as procedures (and of course sub-routines), Easy to understand Obvious transaction boundaries. Even extracting subroutines, is difficult to de-duplicate. (in turn more nasty consequences)
  19. Perhaps more exotic now. One instance for each type object, only one, operates over database rows NO oo-db impedance mismatch No polymorphism, no dynamic linking, nada. Modeling around the database structure
  20. Specifically based in the domain of the business you are working with (Vaughn Vernon IDDD) Business Logic modeled as object behavior, no DB, no transaction scripts. Business as object graphs and object clusters. The OOP way of modeling. ...
  21. Real OOP, with all the bells and whistles. + Heuristics like SOLID Hardest to comprehend. Using a domain model is the essence of the paradigm shift to OOP. Code overhead for simple BL. RELATIONAL Data sources get more complex
  22. .
  23. this is in PATTERNS - ENTERPRISE - APPLICATION - ARCHITECTURE
  24. Complexity bigger than 7.42 Impossible to calculate Difficult to predict
  25. So... What is django pattern?? HOW MANY - Tx Script, Table Mod, Domain Model I'd say. Probably a -some sort of- domain model
  26. So assuming that, let's take a look at some ANTIPATTERNS
  27. This is a CLASSIC in many Django apps I’ve seen. Objects have state but no behavior (and Getters+Setters are not behavior) They are just data structures. This is not OOP. Business Logic and thus behavior is somewhere ELSE (controllers,"service" layer, “managers”, forms) Some say call this the "J2EE smell" - NOT TRUE
  28. This is like Transaction Script, old school CGI Solve it by a "Push it down" refactor, not a design pattern (though it's better) Not really a Domain model. just a twisted Transaction Script God objects (User + The most application centric object; Product)
  29. God objects can be solved with mixins PYTHON has it.
  30. Mixings are inheritance. Inheritance is the strongest form of coupling, you are just spreading the code. You are only making things worse Prefer composition.
  31. Viscosity due to tight coupling, persistence and logic coupled together, you can’t change ANY Complex tests need database to run or complex sorcery. Test behavior, not implementation. CRUD obsession >>>>
  32. Difficult to avoid in Django: The domain model is basically the data model All objects backed up by a table. Databases are part of the 3rd Layer, DETAILS they do not belong to the DM. They have design requirements Leads to ...
  33. You may think that it means… BUT. Actually stands for
  34. C, R, U, D are consequences of the use cases, not THE use cases.
  35. CRUD APPs are LEGACY We are not modeling the paper-based office in software anymore
  36. There is an APP for that!
  37. Lastly
  38. This antipattern is Unavoidable in Django (and any other ActiveRecord based framework) Global state, models are omnipresent (accessible even from the templates through lazy loading). No real separation, the three layers are connected and tightly coupled. They can't easily change at different pace. Active Record is the culprit. AGAIN
  39. The “Django way” is FAST, but consider it is a HUGE trade-off, specially for complex apps. Are you prepared to pay the price? BUT it works for me! - Maybe, but at least keep all these things in mind.
  40. So Django vs. OOP is ….
  41. NOT THE DEBATE Frameworks are tools, and they have a place. Django is probably good enough if CRUD is good enough for your application - (which rarely is). Where I say Django, you can say Rails, Spring, and other paternalistic, Active Record based frameworks.
  42. If we still have time
  43. HIRING!