+ All Categories
Home > Software > 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Date post: 21-Jan-2018
Category:
Upload: daniel-fisher
View: 191 times
Download: 0 times
Share this document with a friend
22
Data Access Layers Convenience vs. Control and Performance? Daniel Fisher(lennybacon) Software Architect
Transcript
Page 1: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Data Access LayersConvenience vs. Control and Performance?

Daniel Fisher(lennybacon)

Software Architect

Page 2: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Objectives

You know what Data is You know what a database is (not) You know what OOP is You know what N-Tier means

Page 3: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Background

Most Applications out there need a data store My Opinion ;-)

Databases are intended to serve data in multithreaded and multi client access scenarios XML is just File IO Access is NOT a database

Page 4: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Database vs. Memory

Different data store Behavior Persistence Transactions

Data (types) Database Automation Types vs. Development platform Type System

Page 5: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Moving to Memory

Raw Data from SQL Server Result Set

(Raw) Data Untyped

Tabular Data DataSet/DataTable

Business Objects Domain Model

Page 6: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

(Raw) Data

Command & Connection DataReader & Scalar execution

Page 7: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

(Raw) Objects

Code it all on your own Forget Strong Types Forget OOP Forget Calculations ... And so on

NOT an option for complex data!

Page 8: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Tabular Data

DataSet and DataTable Adapter in the middle

Page 9: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Tabular Data

Great IDE Support Easy to use

Internally uses a DataReader Stores data as:

DOM DiffGram

NOOOP Violates N-Tier architecture priciples

Page 10: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?
Page 11: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

I‘m Sorry

I wanted to show a console application that fills a DataTable with 100000 rows of the customer database and profile it‘s memory...

I killed dotTrace 2.0 process after 2 hours

My box is a 2 Ghz dual core with 2 Gigs RAM

Wow!

Page 12: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Business Objects

Some mapping mechanism

Page 13: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Mapping mechanisms

Declarative Attributes Mapping Configuration Code

Page 14: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Mapping conflicts

DesignTime vs. RunTime Performance vs. Convinience

Hmmmm?

Page 15: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

N-Tier: Top Down vs. Star

Page 16: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Motivations of the code

Nice OOP Simply work with „natural“ objects

Clean N-Tier Never use „System.Data“ in your logical code No SQL?

Reduce code duplicates Data access methods

Page 17: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Codewalk DataAccess Object Model Client code

Page 18: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Topographical Tiers

What if you need to spread your application across multiple boxes Architectural requirements Scalability requirements Infrastructural requirements

Page 19: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Adding a Tier

Client Server

Manager code- Forwards calls service- Converts messages to types

Manager code- Access database- Converts data to types

Page 20: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Summary

Write less code Use the left lines to build reusable modules and

increase developer expirience Autonomy

Write code that is independent to prevent scale out issues

Disconneced Connect only if you need data (get/set) Define concurrency strategies

Page 21: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Call to action

It‘s not hard to write such things on your own Controled performance Controled memory usage The developer expirience you want

Add-in Custom tool MsBuild Task ...

Page 22: 2006 DDD4: Data access layers - Convenience vs. Control and Performance?

Recommended