Top Banner
Ready Bojan Veljanovski Software Development Engineer | Technical Architect HASELT Real-world software design practices when developing ASP .NET web systems
35

Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Jul 09, 2015

Download

Technology

Topics of discussion:
- Evolving Architectures
- Command & Query Implementation
- Component Oriented Single Page Modules
- Evolutionary database development and migrations
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Bojan Veljanovski

Software Development Engineer | Technical Architect

HASELT

Real-world software design practices when developing ASP.NET web systems

Page 2: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

General Sponsors

Platinum Sponsors

Silver Sponsors

Gold Sponsors

Bronze Sponsors

Promoters

Page 3: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

A quick chat

• Users interact with apps by INTENT

• Server processes ACTIONS

• Who triggers those ACTIONS?

Page 4: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Example of User Intent in medical institution

• Actor: Patient

– Request an appointment with the doctor

– Cancel appointment

– Re-schedule appointment

• Actor: Doctor

– Confirm requested patient’s appointment

– Deny requested patient’s appointment

– Check schedule

– Look into historical medical records for the patient

Page 5: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Example of a System Action

• Patient Actions

– RequestNewAppointment

– CancelRequestedAppointment

– RequestAppointmentReschedule

• Doctor Actions

– ConfirmRequestedAppointment

– DenyRequestedAppointment

– GetSchedule

– GetHistoricalRecordsForPatient

Page 6: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Example of a System Action

• Patient Actions

– RequestNewAppointment

– CancelRequestedAppointment

– RequestAppointmentReschedule

• Doctor Actions

– ConfirmRequestedAppointment

– DenyRequestedAppointment

– GetSchedule

– GetHistoricalRecordsForPatient

• WRITE

• WRITE

• WRITE

• WRITE

• WRITE

• READ

• READ

Page 7: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Example of a System Action

• Patient Actions

– RequestNewAppointment

– CancelRequestedAppointment

– RequestAppointmentReschedule

• Doctor Actions

– ConfirmRequestedAppointment

– DenyRequestedAppointment

– GetSchedule

– GetHistoricalRecordsForPatient

• Command

• Command

• Command

• Command

• Command

• Query

• Query

Page 8: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Users work with apps by INTENT.

Your UI should capture it!Your system should process it!

Evolving Architecture

Page 9: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Agenda

• Evolving Architectures

• Command & Query Implementation

• Component Oriented Single Page Modules

• Evolutionary database development

• Summary

Page 10: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Bojan Veljanovski

• Software Development Engineer and Technical Architectat HASELT

• HyperLAB Coordinator

• Technical Speaker

• Microsoft Certified Professional

• Former Microsoft Student Partner

Favorite topics:

– Software Architectures and Design

– Code. Code. Code.

– Emerging technologies

Page 11: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Evolving Architectures(from high-level perspective)

Page 12: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Classical Layered Architecture

Evolving Architecture

UI

ASP.NET

App Services

Data Access Logic

DB

DTO

DTO

Domain Object

Data Structure

ValidationBusiness LogicData ReadsData Writes

Page 13: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Adding Query

Evolving Architecture

UI

ASP.NET

App Services

Data Access Logic

DB

DTO

DTO

Domain Object

Data Structure

ValidationBusiness LogicSome Data ReadsData Writes

Query Handler

Data Reads

Query Result

Domain Object

Page 14: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Going further with the Query

Evolving Architecture

UI

ASP.NET

App Services

Data Access Logic

DB

DTO

DTO

Domain Object

Data Structure

ValidationBusiness LogicSome Data ReadsData Writes

Query Handler

Query Result

Denorm Structure

Data Reads

Page 15: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Adding Command

Evolving Architecture

UI

ASP.NET

App Services

Data Access Logic

DB

DTO

DTO

Domain Object

Data Structure

ValidationBusiness LogicSome ReadsWrites

Query Handler

Query Result

Denorm Structure

Data ReadsCommand

Handler

Command

Domain Object

Page 16: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Some cleaning

Evolving Architecture

UI

ASP.NET

Data Access Logic

DB

Data Structure

ValidationBusiness LogicSome ReadsWrites

Query Handler

Query Result

Denorm Structure

Data ReadsCommand

Handler

Command

Domain Object

Page 17: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Some cleaning

Evolving Architecture

UI

ASP.NET

Data Access Logic

DB

Data Structure

ValidationBusiness LogicSome ReadsWrites

Query Handler

Query Result

Denorm Structure

Data ReadsCommand

Handler

Command

Domain Object

CommandQuery Result

Page 18: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

What about collaborative systems, real-time and stuff?

Evolving Architecture

Page 19: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Look ma’, real-time

Evolving Architecture

UI

ASP.NET

DAL

DB

Query Handler

Command Handler

Event HandlerEvent

Socket: PUSH

Page 20: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Full-Featured CQRS (overview)

Evolving Architecture

Page 21: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Command & QueryImplementation

Command & Query Implementation

Page 22: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

ReadyReady

Demo:Implementing CQS

Page 23: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Component Oriented Single Page Modules

Page 24: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Common seen SPA structure

• Controllers

• Models

• ViewModels

• Views

• Modules

• Components

• Utils

• Services

Component Oriented Single Page Modules

Page 25: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

There is a better way

• Modules

• Components

– View

– ViewModel

• Shared

– Events (message constant)

– Actions (message constant)

– MessageBus (pub/sub)

• Data Services

– API Calls

– LocalStorage

Component Oriented Single Page Modules

Page 26: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Rules of thumb

• One Module per Page

• Focused modules

• Cohesive components

– Not *everything* should be reusable

• Components don’t TALK they:

– REACT (to messages)

– EMIT (messages)

• Message types

– Event

– Action

Component Oriented Single Page Modules

Page 27: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Component Oriented Single Page Modules

MessageBus

Data Services

API

Module A

Module B

Module C

pub

sub

pub

sub

pub

sub

Page 28: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Flux Architecture

Component Oriented Single Page Modules

Page 29: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

ReadyReady

DemoCOSPM

Page 30: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Evolutionary Database Development

Page 31: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Evolutionary Database Development• A DB consist of Schema and Test Data

• Schema is Source Code

• Schema changes are tracked over-time

• Version it in GIT

• Every dev gets its own db instance

• Devs make frequent integrations into shared master

db

• FluentMigration mechanisms help us build our db in

any RDMS system we want

Evolutionary Database Development

Page 32: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

ReadyReady

DemoFluent Migration

Page 33: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

Ready

Summary

• Users work with apps by INTENT

• System processes ACTION triggered by INTENT

• READS are different from WRITES

– Treat them as so, in your code, yo

• Components are simple, inter-components communication is hard

• Database schema is source code too – it evolves

– Version it

• Don’t fall into the tech hype hole

– Think

• There are no ‘best practices’, only ‘good practices in context’

Page 34: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

ReadyReady

Complete the evaluation and earn the chance to win valuable prizes from our sponsors

Questions

Page 35: Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski

ReadyReady

Thank you