Strategic

Domain-Driven-Design 

for

Improving

Flutter

Architecture

Majid Hajian

mhadaily

mhadaily

Share Experiences

Well?

Best

Practices

mhadaily

Patterns

mhadaily

Methodology

mhadaily

mhadaily

mhadaily

What we will learn today

Introduction to DDD

1

Flutter architecture inspired by DDD

1

Strategic Domain Driven Design

1

DEMO

1

mhadaily

ME.dart

import 'package:flutter/material.dart';

MaterialApp(
   ThemeData(
        name: "Majid Hajian",
        location: "Oslo, Norway",
        description: '''
        	Passionate Software engineer, 
	        Community Leader, Author and international Speaker
         ''',
        main: "Web, Javascripter, Flutter/Dart, IoT",
        homepage: "https://www.majidhajian.com",
        socials: {
          twitter: "https://www.twitter.com/mhadaily",
          github: "https://www.github.com/mhadaily"
        },
        books: {
          "Progressive Web App with Angular": {
             version: "1.0.0", 
             publishedBy: "Apress", 
             foundOn: "www.pwawithangular.com",
          }
        },
        author: {
          packtpub: "PWA development, 7 hours video course",
          Udemy: "PWA development, 7 hours video course"
        }
        founder: "Softiware As (www.Softiware.com)"
        devDependencies: {
          tea: "green", mac: "10.14+",
        },
        engines: {
          VueJsOslo: "Orginizer", MobileEraConference: "Orginizer",
          ngVikingsConference: "Orginizer", 
          MobileMeetupOslo:"Co-Orginizer",AngularOslo: "Co-Orginizer",
          FlutterDartOslo: "Co-Orginizer",Framsia: "Co-Orginizer",          
        }
     ),
 )

mhadaily

Find me on the internet by

mhadaily

Domain

Driven

Design 

mhadaily

When we develop a Software 

Primarily focus is

Technology

 

 

mhadaily

When we develop a Software 

Primarily focus is

Technology

Business

 

mhadaily

DOMAIN

mhadaily

Strategic design tools

Tactical

 design tools

mhadaily

Strategic design tools

Tactical

 design tools

mhadaily

Why is Strategic Domain-Driven Design Important?

Strategic

DDD

Decomposing 

mhadaily

Strategic

DDD

Decomposing 

Core Domain

Sub Domains

mhadaily

Think in terms of

context 

mhadaily

Ecommerce

Sales

Support

Accounting

Order

Product Catalog

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

Bounded Context

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

Ubiquitous Language

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

Context Map

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

Shared

Kernel

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

Open Host Service

mhadaily

customer 

id

name

interest

Sales

customer 

id

name

email

phone

Support

customer 

id

address

availability

Order

customer 

id

name

payment method

 

Accounting

Open Host Service

API

mhadaily

mhadaily

Flutter

Architecture

mhadaily

E-commerce App

mhadaily

Sales

Common

Catalog

E-commerce App

mhadaily

Sales

Common

Catalog

E-commerce App

Presentation

Presentation

Presentation

Screen

Logic Holder

Widgets

Smart UI - Feature

Screen

Logic Holder

Smart UI - Feature

BLoC

ChangeNotifier

BLoC

ChangeNotifier

mhadaily

Sales

Common

Catalog

E-commerce App

Presentation

Presentation

Presentation

Application

Application

Application

Use Case Specific Facades

 

Simplify

mhadaily

Sales

Common

Catalog

E-commerce App

Domain

Domain

Domain

Presentation

Presentation

Presentation

Application

Application

Application

Text

Entities

Interfaces

Logic

mhadaily

Sales

Common

Catalog

E-commerce App

Domain

Domain

Domain

Infrastructure

Infrastructure

Infrastructure

Presentation

Presentation

Presentation

Application

Application

Application

Text

Remote Data Source

Models

Local Data Source

Geo Location, ... 

Raw Data

Raw Data

Raw Data

Models

Repositories

Sales

Catalog

E-commerce App

Domain

Domain

Infrastructure

Infrastructure

Presentation

Presentation

Application

Application

mhadaily

Sales

Catalog

E-commerce App

Domain

Domain

Infrastructure

Infrastructure

Presentation

Presentation

Application

Application

API

mhadaily

mhadaily

Demo

├── lib
│   ├── catalog
│   │   ├── api
│   │   │   └── index.dart
│   │   ├── application
│   │   │   └── catalog_facade_service.dart
│   │   ├── domain
│   │   │   ├── entities
│   │   │   │   └── product.dart
│   │   │   ├── interfaces
│   │   │   │   └── product_interface.dart
│   │   │   └── logic
│   │   │       ├── catalog_logic.dart
│   │   │       └── get_official_product_manufacturer.dart
│   │   ├── infrastructure
│   │   │   ├── data_sources
│   │   │   │   ├── product_local_data_provider.dart
│   │   │   │   └── product_remote_data_provider.dart
│   │   │   ├── models
│   │   │   │   └── product_model.dart
│   │   │   └── repositories
│   │   │       └── product_repository.dart
│   │   └── presentation
│   │       ├── catalog-detail
│   │       │   ├── bloc
│   │       │   │   ├── bloc.dart
│   │       │   │   ├── catalog_detail_bloc.dart
│   │       │   │   ├── catalog_detail_event.dart
│   │       │   │   └── catalog_detail_state.dart
│   │       │   └── catalog_detail_screen.dart
│   │       ├── catalog-list
│   │       │   ├── bloc
│   │       │   │   ├── bloc.dart
│   │       │   │   ├── catalog_list_bloc.dart
│   │       │   │   ├── catalog_list_event.dart
│   │       │   │   └── catalog_list_state.dart
│   │       │   └── catalog_list_screen.dart
│   │       └── widgets
│   │           └── catalog_name.dart
│   ├── common
│   │   ├── config
│   │   │   └── config.dart
│   │   ├── exceptions
│   │   │   ├── exceptions.dart
│   │   │   ├── local_exceptions.dart
│   │   │   └── server_exceptions.dart
│   │   ├── helpers
│   │   │   └── helpers.dart
│   │   ├── platform
│   │   │   └── connectivity.dart
│   │   ├── utils
│   │   │   └── utils.dart
│   │   └── widgets
│   │       └── widgets.dart
│   ├── injections.dart
│   └── main.dart

mhadaily

Summary

mhadaily

Introduction to DDD

1

Flutter architecture inspired by DDD

1

Strategic Domain Driven Design Ideas

1

What we have learned

mhadaily

Majid Hajian

mhadaily

Slides and link to source code

bit.ly/ddd-flutter

majid[at]softiware[dot]com

Strategic Domain-Driven Design for Improving Flutter architecture

By Majid Hajian

Strategic Domain-Driven Design for Improving Flutter architecture

Architecting software, especially on a large-scale where it needs to meet the business requirements is always a challenge and Flutter apps are not an exception. Strategic Domain-Driven Design techniques ensure your application is optimized to support business goals while identifying cohesive modules, known as bounded context which creates a maintainable, comprehensible codebase by isolating dependencies and describe business value. In this talk, I explorer the idea of the ubiquitous language, the bounded context, sub-domains while they are being implemented in a real application. All in all, You'll learn how I attempted to architect a (large-scale) Flutter application by technical solution and appropriate methodology in order to have a sustainable app.

  • 378
Loading comments...

More from Majid Hajian