+ All Categories
Home > Software > Why you shouldnt use django for that

Why you shouldnt use django for that

Date post: 21-Feb-2017
Category:
Upload: ivan-stepaniuk
View: 293 times
Download: 2 times
Share this document with a friend
43
Why you shouldn’t use Django for that
Transcript
Page 1: Why you shouldnt use django for that

Why you shouldn’t useDjango for that

Page 2: Why you shouldnt use django for that

Architecture, the lost

yearsRobert C. Martin

Page 3: Why you shouldnt use django for that

“Web” is not an architecture.

Page 4: Why you shouldnt use django for that

Frameworks are not architecture.

Page 5: Why you shouldnt use django for that

Django is a tool, not architecture.

Page 6: Why you shouldnt use django for that

WAIT!What does this even mean?

Page 7: Why you shouldnt use django for that

Ivan Stepaniuk

@istepaniuk

Page 8: Why you shouldnt use django for that

Application metaphor, the three layers

1 32

Page 9: Why you shouldnt use django for that

1.Interact with the user, both ways

1 32

Page 10: Why you shouldnt use django for that

3. Interact with outside world, other systems

1 32

Page 11: Why you shouldnt use django for that

2. The code that justifies the app existence

1 32

Page 12: Why you shouldnt use django for that

Are these layers equally important?

Page 13: Why you shouldnt use django for that

Do we build them the same way?

Page 14: Why you shouldnt use django for that

Do these change at the same pace?

Page 15: Why you shouldnt use django for that

It is all about CHANGE

Page 16: Why you shouldnt use django for that

OKHow does business logic look like?

Page 17: Why you shouldnt use django for that

PatternsEnterprise Application Architecture

Martin Fowler

Page 18: Why you shouldnt use django for that

Transaction Script

Modeled as procedures

+ Easiest to understand.+ Obvious transaction boundaries. - Difficult to de-duplicate.

Page 19: Why you shouldnt use django for that

Table Module

Modeled as objects and Record Sets

+ No DB vs. OO impedance mismatch.- Model is database-centric. - Objects, but not really OO.

Page 20: Why you shouldnt use django for that

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.

Page 21: Why you shouldnt use django for that

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.

Page 22: Why you shouldnt use django for that

Which pattern should I use?

Page 23: Why you shouldnt use django for that

Which one should we use?

Effo

rt to

enh

ance

Complexity of the business logic

Page 24: Why you shouldnt use django for that

Which one should we use?

Effo

rt to

enh

ance

Complexity of the business logic

7.42

Page 25: Why you shouldnt use django for that

Which pattern does Django follow?

Page 26: Why you shouldnt use django for that

Domain Model Architecture Antipatterns

Page 27: Why you shouldnt use django for that

Anemic Domain Model- Objects have state, but no behavior- The Business is somewhere else

Leads to:- Upside down Transaction Script- God objects

Page 28: Why you shouldnt use django for that

Anemic Domain Model- Objects have state, but no behavior- The Business is somewhere else

Leads to:- Upside down Transaction Script- God objects

Page 29: Why you shouldnt use django for that

Mixins!To inject concerns

Page 30: Why you shouldnt use django for that
Page 31: Why you shouldnt use django for that

Table Driven Domain Model- The data model is the domain model- All objects backed up by a tableLeads to:- High viscosity- Complex, slow, fragile tests- CRUD obsession

Page 32: Why you shouldnt use django for that

Table Driven Domain Model- The data model is the domain model- All objects backed up by a tableLeads to:- High viscosity- Complex, slow, fragile tests- CRUD obsession

Page 33: Why you shouldnt use django for that

CREATEREADUPDATEDELETE

Page 34: Why you shouldnt use django for that

DATABASEDATABASEDATABASEDATABASE

Page 35: Why you shouldnt use django for that
Page 36: Why you shouldnt use django for that
Page 37: Why you shouldnt use django for that

Connected Domain ModelIn 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 featuresare 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

Page 38: Why you shouldnt use django for that

Connected Domain Model

Page 39: Why you shouldnt use django for that

WAIT!OK, Active Record is bad, but

what about productivity?

Page 40: Why you shouldnt use django for that

Django vs. OOP

Page 41: Why you shouldnt use django for that

Django vs. OOPIs not the debate here

Page 42: Why you shouldnt use django for that

Questions?Or come and ask me later!

Page 43: Why you shouldnt use django for that

Thank you!Oh, and we are hiring!

@istepaniuk


Recommended