Real-world software design practices when developing ASP.NET web systems by Bojan Veljanovski
-
Upload
bojan-veljanovski -
Category
Technology
-
view
643 -
download
2
description
Transcript of 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
Ready
A quick chat
• Users interact with apps by INTENT
• Server processes ACTIONS
• Who triggers those ACTIONS?
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
Ready
Example of a System Action
• Patient Actions
– RequestNewAppointment
– CancelRequestedAppointment
– RequestAppointmentReschedule
• Doctor Actions
– ConfirmRequestedAppointment
– DenyRequestedAppointment
– GetSchedule
– GetHistoricalRecordsForPatient
Ready
Example of a System Action
• Patient Actions
– RequestNewAppointment
– CancelRequestedAppointment
– RequestAppointmentReschedule
• Doctor Actions
– ConfirmRequestedAppointment
– DenyRequestedAppointment
– GetSchedule
– GetHistoricalRecordsForPatient
• WRITE
• WRITE
• WRITE
• WRITE
• WRITE
• READ
• READ
Ready
Example of a System Action
• Patient Actions
– RequestNewAppointment
– CancelRequestedAppointment
– RequestAppointmentReschedule
• Doctor Actions
– ConfirmRequestedAppointment
– DenyRequestedAppointment
– GetSchedule
– GetHistoricalRecordsForPatient
• Command
• Command
• Command
• Command
• Command
• Query
• Query
Ready
Users work with apps by INTENT.
Your UI should capture it!Your system should process it!
Evolving Architecture
Ready
Agenda
• Evolving Architectures
• Command & Query Implementation
• Component Oriented Single Page Modules
• Evolutionary database development
• Summary
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
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
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
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
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
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
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
Ready
Look ma’, real-time
Evolving Architecture
UI
ASP.NET
DAL
DB
Query Handler
Command Handler
Event HandlerEvent
Socket: PUSH
Ready
Common seen SPA structure
• Controllers
• Models
• ViewModels
• Views
• Modules
• Components
• Utils
• Services
Component Oriented Single Page Modules
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
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
Ready
Component Oriented Single Page Modules
MessageBus
Data Services
API
Module A
Module B
Module C
pub
sub
pub
sub
pub
sub
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
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’
ReadyReady
Complete the evaluation and earn the chance to win valuable prizes from our sponsors
Questions