Flexible Design

28
Flexible Design and Modeling Planning for Constant Change Gwen Shapira and Robyn Sands ODTUG

description

 

Transcript of Flexible Design

Page 1: Flexible Design

Flexible Design and Modeling

Planning for Constant Change

Gwen Shapira and Robyn Sands

ODTUG

Page 2: Flexible Design

There is nothing permanent

except change

ODTUG

Page 3: Flexible Design

Agile ValuesIndividuals and interactions OVER processes and tools.

Working software OVER comprehensive documentation.

Customer collaborations OVER contract negotiation.

Responding to change OVER following a plan.

ODTUG

from ‘The Manifesto for Agile Development’ at agilemanifesto.org

Page 4: Flexible Design

ODTUG

Is this ‘Agile’?• Database design is

neglected• Object models do not

translate to good database design

• Scalability and performance are not last minute add-ons

• Systems can not be flexible unless you plan for change

Page 5: Flexible Design

The Emperor has no clothes!• Database performance

and scalability left out• Normalization and

constraints are ‘old school

• ‘Just good enough’ doesn’t scale

• If all ideas come from the user, where’s the innovation?

ODTUG

Page 6: Flexible Design

Why aren’t database people Agile?

Data professionals are resistant to change.Missed the <blank>* revolution of the <time period>.Haven’t kept up with modern software development.Besides, DBAs hate all developers ....

ODTUG

* insert favorite trend here (object, agile, extreme, etc)with the appropriate timeframe.

Page 7: Flexible Design

It’s really development’s fault

Developers create performance problems and expect DBAs to fix them later.

Missed the <blank>* foundational studies of the <time period>.

Don’t take enough time to understand the data.

Developers just hate data people on principle.

ODTUG

* insert favorite university course title here with the appropriate timeframe.

Page 8: Flexible Design

Blame and finger-pointing doesn’t fix anything.

We need the best of both worlds to succeed.

ODTUG

Page 9: Flexible Design

Waterfall doesn’t workChaos doesn’t work

We need controlled iterations

ODTUG

Page 10: Flexible Design

ODTUG

Normalization:Stable Basis For Flexible Application

Page 11: Flexible Design

Universal Modeling LanguageODTUG

Data in Motion

Page 12: Flexible Design

ODTUG

Data in Motion

Page 13: Flexible Design

ODTUG

Data at Rest

Page 14: Flexible Design

What is important to a database?

• Entities, relationships and data types• Access paths• Number of records• Distribution of the data• Lifespan of the information

ODTUG

Page 15: Flexible Design

ORM is not a Data Model

• It hides the data model• Which is a good thing…• But if no one ever sees

the data model…• How do you know it will

scale?

Page 16: Flexible Design

Design for the inevitable change:• Structure schema for the data at rest.• Speed up data access with narrow tables,

indexed organized tables or partitioning.• Delay normalization for unknowns, unused

values.• Packages and procedures make possible to

change the schema without changing the application code.

ODTUG

Building a refactorable database

Page 17: Flexible Design

• Prevents redundant data• Goal is a ‘single source of truth’• Integrity and relationships protected by keys

and constraints• Denormalize for performance when you must• Normalization is what makes a database

‘Agile’.

ODTUG

Normalization

Page 18: Flexible Design

Framework for Change

ODTUG

Page 19: Flexible Design

Transactional API• Everything in PL/SQL calls– Application doesn’t touch tables– Suggestion of table design changes does not incite panic

• Clean interface between application and the database– Unit Testing– Simplify Builds– Minimize impact of DB changes

• Prepare for caching

ODTUG

Page 20: Flexible Design

The interface between the database and the application should be jointly designed by application and database developers.

Meet in the ring and fight it out.

ODTUG

Page 21: Flexible Design

Plan the interface:• What does development need?• How will you provide it?

Using old dogs for new tricks:• Procedures, packages and views• Table structures can change without impacting the

application layer

Build the concept• Adapt as you gain knowledge

ODTUG

Evolutionary design

Page 22: Flexible Design

Basic Design #Fail1. Inappropriate table and column names2. Mismatching data types 3. Multi-purpose columns4. Lack of unique and non-volatile primary key5. Lack of common vocabulary6. Skipping the procedure - just this once.7. Hiding the data from the developer8. Duplicate processing

ODTUG

Page 23: Flexible Design

A duck is developer’s best friend

ODTUG

Page 24: Flexible Design

ODTUG

War Stories I – One Table to Rule Them All

Page 25: Flexible Design

War Stories II –Hiding the Data

ODTUG

Page 26: Flexible Design

• Watch your end users to understand how they use data.

• Know your data and application goals, and anticipate the changes.

• Design applications for the process, design databases for data access.

• Create a normalized ERD to understand the entities and relationships.

• Use an evolutionary modeling with an iterative approach

• Normalize for performance AND agility.

• Use denormalization to ‘preassemble’ data when you must but avoid secondary 'sources of truth‘.

ODTUG

Keep the good

Page 27: Flexible Design

Agile is not ‘code and fix’.

Normalization is not dead.

Logical and physical database design will have a significant impact on your application’s success.

(and performance)

Whether that impact is positive or negative is up to us.

ODTUG

Lose the bias

Page 28: Flexible Design

ODTUG

Design ends when the application is shelved.

As long as someone is using the application – expect changes…

And enjoy the ride.