SlideShare a Scribd company logo
DCI – хорошо забытый
старый взгляд на объекты
Anton Chernetskiy
Lev Sivashov




May 1, 2012   www.ExigenServices.com
About us




Lev Sivashov                 Anton Chernetskiy


         Developers in Exigen Services
What the heck is OOP?
             Mixins
                      Interfaces

  Classes
                              Traits

Prototypes
              OOP
                            Roles

      Aspects
                  Objects
Essence of OOP




Networks of communicating objects
     work together to achieve
        a common goal
Class orientation




Static class definitions are not capable of fully
describing dynamic nature of interacting objects
Fragmentation instead of
    decomposition
How
    to
understand?
Extension
  of your
mental model
So?
So?


•   OOP is not a smart programming
    tool but a way of thinking
So?


•   OOP is not a smart programming
    tool but a new way of thinking

•   Objects are not data structures
    with methods but elements of
    human mental model
So what?
Business rules




   Software
User                 Programmer


                      Classes, attributes, met
Object interactions
                               hods
Representing the user's mental model
Representing the user's mental model
            One-to-one
Maintainability




Stable      /
Introducing DCI
Network of communicating objects
Use case 1   Use case 2
Roles and contexts



At work      At home           At corporate
Data
  Context
Interactions
Data – what-the-system-is

public class Foo{
    public String bar;
    public double baz;
}


   Very dump objects
Context – a use case
Interactions
what-the-system-does
Object
     =
Data + Roles
State   Behavior
State   Behavior
Data    Context and
        Interactions
State        Behavior
   Data        Context and
               Interactions
  User’s
                Use cases
mental model
State        Behavior
   Data        Context and
               Interactions
  User’s
                Use cases
mental model
  Stable         Changing
In code
Implementations
• Scala (traits)
• Ruby, Python (runtime methods injection)
• C++ (templates)
• C# (extension methods)
• Perl
• PHP
• Java (Qi4j)
Use cases:
Use cases:
Use cases:
Use cases:
Data


public interface Unit {

    Property<Integer> health();

    Property<String> name();

}
Role (attackable)


public interface Attackable {

    void receiveDamage(double damageAmount);

}
Role implementation (attackable)

class AttackableImpl implements Attackable {

    @This
    Unit unit;

    public void receiveDamage(double damageAmount) {
        Double health = unit.health().get();
        unit.health().set(health - damageAmount);
    }
}
Bind implementation to role


@Mixins({AttackableImpl.class})
public interface Attackable {

    void receiveDamage(double damageAmount);

}
Role (attacker)


public interface Attacker {

    void beat(Attackable attackable);

}
Role implementation (attacker)

class AttackerImpl implements Attacker {

    private final static Integer STRENGTH = 10;

    public void beat(Attackable attackable) {
        attackable.receiveDamage(STRENGTH);
    }
}
Context

public class AttackEnemiesContext {
    ...
    Attacker attacker;
    List<? extends Attackable> enemies;

    public void fight() {
        for (Attackable enemy : enemies) {
            attacker.beat(enemy);
        }
    }
}
Constructing an object




public interface Worker extends EntityComposite,
        Attackable,
        Healable,
        Builder {
}
Initializing unit


EntityBuilder<Worker> builder
    = unitOfWork.newEntityBuilder(Worker.class, name);

Unit unit = builder.instanceFor(Unit.class);
unit.health().set(100.0);
unit.name().set(name);

worker = builder.newInstance();
Interaction


// Team one
private Warrior warrior;

// Team   two
private   Worker worker;
private   Medic medic;
private   Barn barn;
barn = worker.buildBarn();    // worker builds barn

new AttackEnemiesContext(     // warrior fights everyone
    warrior, Arrays.asList(worker, medic, barn)
).fight();



new HealAlliesContext(        // doctor heals allies
    medic, Arrays.asList(medic, worker)
).healAll();

new RepairBuildingsContext(   // worker repairs barn
    worker, Arrays.asList(barn)
).repair();
But, requirements had changed
Use cases:
Use cases:
Role

public interface Attacker {

    void beat(Attackable attackable);

}
Object


public interface Worker extends EntityComposite,
        Attackable,
        Healable,
        Builder,
        Attacker {
}
Old role implementation

class AttackerImpl implements Attacker {

    private final static Integer STRENGTH = 10;

    public void beat(Attackable attackable) {
        attackable.receiveDamage(STRENGTH);
    }
}
New role implementation
interface AttackerStats {
    Property<Integer> strength();
}

class AttackerImpl implements Attacker {
    @This
    AttackerStats attackerStats;

    public void beat(Attackable attackable) {
        attackable.receiveDamage(
            attackerStats.strength().get()
        );
    }
}
Initializing unit

EntityBuilder<Worker> builder
    = unitOfWork.newEntityBuilder(Worker.class, name);

Unit unit = builder.instanceFor(Unit.class);
unit.health().set(100.0);
unit.name().set(name);

AttackerStats attackerStats =
     builder.instanceFor(AttackerStats.class);
attackerStats.strength().set(5);

worker = builder.newInstance();
new AttackEnemiesContext(    // warrior fights everyone
    warrior, Arrays.asList(worker, medic, barn)
).fight();

new HealAlliesContext(       // doctor heals allies
    medic, Arrays.asList(medic, worker)
).healAll();



new AttackEnemiesContext(    // worker’s revenge
    worker, Arrays.asList(warrior)
).fight();
Pros
• Giving system behavior first class status
• Easy to maintain
• Object style of thinking is closer to peoples
  mental models rather than class style
Cons
• We are strongly tied to Qi4j
• Poor community
• Developer must communicate a lot with
  customer.
Try it yourself!
https://github.com/Qi4jSample/Qi4jSample




                           Questions?

More Related Content

Viewers also liked

Herramientas de edicion
Herramientas de edicionHerramientas de edicion
Herramientas de edicion
karollkqa
 
Wendy sanchez
Wendy sanchezWendy sanchez
Wendy sanchez
Deivy V'z Srf
 
Acerca de los efectos curativos de thuja en la viruela
Acerca de los efectos curativos de thuja en la viruela Acerca de los efectos curativos de thuja en la viruela
Acerca de los efectos curativos de thuja en la viruela
Francisco Navarro
 
Natef2002 03.Pptcopy
Natef2002 03.PptcopyNatef2002 03.Pptcopy
Natef2002 03.Pptcopy
Autoteacherman
 
Que mange t-on en 2007 sur Terre?
Que mange t-on en 2007 sur Terre?Que mange t-on en 2007 sur Terre?
Que mange t-on en 2007 sur Terre?
Pelouze Guy-André
 
Mb vowel r words
Mb vowel r wordsMb vowel r words
Mb vowel r words
Brandy Shelton
 
Periódico digital de la Prefectura del Guayas - Septiembre 2013
Periódico digital de la Prefectura del Guayas - Septiembre 2013Periódico digital de la Prefectura del Guayas - Septiembre 2013
Periódico digital de la Prefectura del Guayas - Septiembre 2013
Guayasenses
 

Viewers also liked (8)

Herramientas de edicion
Herramientas de edicionHerramientas de edicion
Herramientas de edicion
 
Wendy sanchez
Wendy sanchezWendy sanchez
Wendy sanchez
 
Acerca de los efectos curativos de thuja en la viruela
Acerca de los efectos curativos de thuja en la viruela Acerca de los efectos curativos de thuja en la viruela
Acerca de los efectos curativos de thuja en la viruela
 
Viktor Shvaiko Ildy
Viktor Shvaiko  IldyViktor Shvaiko  Ildy
Viktor Shvaiko Ildy
 
Natef2002 03.Pptcopy
Natef2002 03.PptcopyNatef2002 03.Pptcopy
Natef2002 03.Pptcopy
 
Que mange t-on en 2007 sur Terre?
Que mange t-on en 2007 sur Terre?Que mange t-on en 2007 sur Terre?
Que mange t-on en 2007 sur Terre?
 
Mb vowel r words
Mb vowel r wordsMb vowel r words
Mb vowel r words
 
Periódico digital de la Prefectura del Guayas - Septiembre 2013
Periódico digital de la Prefectura del Guayas - Septiembre 2013Periódico digital de la Prefectura del Guayas - Septiembre 2013
Periódico digital de la Prefectura del Guayas - Septiembre 2013
 

Similar to DCI

Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
Jamie (Taka) Wang
 
Clean Code
Clean CodeClean Code
Clean Code
Nascenia IT
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
ilias ahmed
 
Extending C# with Roslyn and Code Aware Libraries
Extending C# with Roslyn and Code Aware LibrariesExtending C# with Roslyn and Code Aware Libraries
Extending C# with Roslyn and Code Aware Libraries
Carlo Pescio
 
Ef Poco And Unit Testing
Ef Poco And Unit TestingEf Poco And Unit Testing
Ef Poco And Unit Testing
James Phillips
 
Patterns in Eclipse
Patterns in EclipsePatterns in Eclipse
Patterns in Eclipse
Madhu Samuel
 
L04 Software Design 2
L04 Software Design 2L04 Software Design 2
L04 Software Design 2
Ólafur Andri Ragnarsson
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
Neelesh Shukla
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
James Johnson
 
Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2
Haitham Raik
 
Java
JavaJava
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
Leonid Maslov
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objects
maznabili
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object java
mha4
 
Dependency Injection або Don’t call me, I’ll call you
Dependency Injection або Don’t call me, I’ll call youDependency Injection або Don’t call me, I’ll call you
Dependency Injection або Don’t call me, I’ll call you
Dmytro Mindra
 
Object
ObjectObject
Singleton Pattern
Singleton PatternSingleton Pattern
Singleton Pattern
Borey Lim
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
DayNightGaMiNg
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 

Similar to DCI (20)

Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
 
Clean Code
Clean CodeClean Code
Clean Code
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
Extending C# with Roslyn and Code Aware Libraries
Extending C# with Roslyn and Code Aware LibrariesExtending C# with Roslyn and Code Aware Libraries
Extending C# with Roslyn and Code Aware Libraries
 
Ef Poco And Unit Testing
Ef Poco And Unit TestingEf Poco And Unit Testing
Ef Poco And Unit Testing
 
Patterns in Eclipse
Patterns in EclipsePatterns in Eclipse
Patterns in Eclipse
 
L04 Software Design 2
L04 Software Design 2L04 Software Design 2
L04 Software Design 2
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
Advanced Hibernate V2
Advanced Hibernate V2Advanced Hibernate V2
Advanced Hibernate V2
 
Java
JavaJava
Java
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objects
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object java
 
Dependency Injection або Don’t call me, I’ll call you
Dependency Injection або Don’t call me, I’ll call youDependency Injection або Don’t call me, I’ll call you
Dependency Injection або Don’t call me, I’ll call you
 
Object
ObjectObject
Object
 
Singleton Pattern
Singleton PatternSingleton Pattern
Singleton Pattern
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 

Recently uploaded

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
Data Hops
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 

Recently uploaded (20)

Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 

DCI

Editor's Notes

  1. Мы говорили с вами об отображении понятий из головы пользователя в программный код.Как выяснилось, это не простая задача. Не такая простая как может показаться на первый взгляд. Проблема заключается в том, что программист и пользователь мыслят по-разному. Конечный пользователь не мыслит такими понятиями как классы, аттрибуты, методы. В его голове есть сущности, есть взаимодействия этих сущностей, есть конкретные сценарии, в которых сущности взаимодействуют. А сущности эти в его модели мышления обычно гораздо проще, чем их репрезентации в коде.
  2. Итак, первая часть – это данные.Они представляют собой статическую часть кода – состояние системы. Можно сказать, что это такая «микро база данных», которая включает в себя доменные классы вашей системы.DCI говорит, что доменные объекты должны быть «тупыми». Мы отделяем состояние системы от поведения, поэтому доменные объекты не содержат кода взаимодействия. Они содержат только основную информацию, общую для всех контекстов, в которых они будут участвовать, а не полный набор всех процессов и алгоритмов.Данные – это элементы модели мышления пользователя. Если вернуться к нашему примеру со счетами, то в системе у нас будет тупой объект счёт, который будет хранить информацию о количестве денег.
  3. Как вы понимаете, любая системная операция, или любой юз-кейс будет в рантайме представлен сетью взаимодействующих объектов. Именно контекст определяет топологию этой сети. Он в рантайме будет выбирать объекты, необходимые для конкретного сценария и назначать им роли. Он будет встраивать в них методы, присущие ролям, и запускать взаимодействия между ними.Контекст, в нашем примере, это банковский перевод. Именно контекст выберет, какой счёт будет Отправителем, а какой – Получателем. Контекст присвоит этим счетам соответствующие роли. Контекст встроит в выбранные объекты необходимые методы для взаимодействия, и наконец, контекст запустит эти взаимодействия между объектами.