SlideShare a Scribd company logo
1 of 28
How to Model Your
Data Like a Pro!
Dallas Texas, June 22nd, 2022
Bruno Martinho
Developer Advocate @ OutSystems
Why data modeling?
2
3
No “voodoo” here…
What is happening behind the scenes?
A SQL Query goes into a bar and
walks up to two tables and asks…
“Can I join you?”
4
5
Hello!
My name is Gordon Knowitall.
I’m the boss here and I’ll be running the show!
Introductions
6
Hi!
I’m NEO and I’ll be here to assist you with anything
related to the OutSystems Platform.
Introductions
7
Hey! You there… Yes, I’m talking to you!
Do you even know what this company does?
6 months… and you don’t even know what we do???
Boss is in a bad mood
This is an hotel.
If you don't want to be fired, you need to create an
application for our hotel booking system.
8
So, we have rooms...
And each room has a number, some have AC and we
classified them into Basic, Premium and Ultra-Mega-
Premium.
First requirements
The room number will be something like 101, 312 or 655.
9
From what I’ve heard it seems that Room is a great
candidate for an entity to store the room information.
Make sure that we can get the entity attributes type from
the requirements: “some have AC” this is a good
candidate to be a Boolean.
Entities and attributes
11
You know… I've been thinking…
And the room names should be different:
Silver, Gold and Diamond.
More classy…
Why doesn’t it surprise us?
12
So it seems that the room type will be a list of values.
This is a good use case to use static entities.
Also, these values might change (just now our boss
changed his mind) but the room will still have the same
type independent of the name, so we can normalize here
our model.
Static Entities and Normalization
14
Wait… Wait… Wait!
Not Diamond... Platinum is better!
Platinum shall be!
Now… who’s ready?
15
No problem here, changing the Label won’t change
anything is the application!
Static Entities and Normalization
17
Not trying to insult your intelligence…
I don't need to tell you that room numbers are unique,
right?
Obvious… but a valid one!
18
This is a very valid requirement that can be enforced with
application logic but it is always a good practice to
include it in the data model. We can use the Entity Room
indexes to achieve this.
Unique Index
20
Rooms have beds and we need to manage which beds
need to change mattress.
Regulation demands that a mattress needs to be
changed every 3 months.
More requirements…
21
This means that a Room can have multiple beds and it is
important to keep track on the last date that the mattress
has been changed. It makes sense to have another
Entity called Bed to keep this information, linked to a
Room with a 1 to Many relationship:
1 Room can have many Bed
1 to Many
23
I believe in transparency…
Let's make sure that every single room has its real photo
for our customers be able to see it.
Mr. Knowitall is the king of transparency
24
To store the room picture we need to use an attribute in
the Entity of type Binary Data. This takes a lot of
information so to improve the performance, the room
picture should be in a separate entity, the Room Picture
that can have the same ID as the Room, creating a 1 to 1
relationship.
1 to 1 and Performance
26
Now the easy part…
Our customers just need their name and passport and
they can book a room for a period of time.
Simple!
Easy is our middle name
27
In order to achieve this, it is necessary to create another
Entity to store the Name and Passport for the Customer.
Now, this Customer needs to be linked to Room. In this
case, since many Customer can book many Room, we
need a Many to Many relationship using a third Entity that
we can call Booking.
Many to Many
29
Our Booking agents reported that they are having
difficulty in seeing how many beds there are in a room.
Can you please help?
Look who’s asking gently
31
Sometimes, it is better to denormalize for performance
sake. If a screen or a server action requires many
complicated logic to retrieve the data then, performance
wise it is better to denormalize the model. In this case,
the Group by isn’t that complex, but to illustrate we can
denormalize the model and add Number of Beds attribute
in Entity Room. Don’t forget to update the number when
a Bed is created or deleted.
Denormalize for performance
33
Well, have I ever mentioned that we need this application
for our 2 different hotel brands?
Same application but we can't mix data!
Last but not least
34
In case there is a need to have data separated for
different brands or companies it is possible to use multi-
tenancy. This won’t explain deeply how this feature
works, but gives an idea that exists and can/should be
used in this use case.
Multitenancy
36
● Entities and Attributes
● Static Entities and Normalization
● Unique Index
● Relationships
● 1 to Many
● 1 to 1 and Performance
● Many to Many
● Denormalize for performance
● Multitenancy
Quick Recap
37
● Data Modeling
● Data Model - Best Practices
● OutSystems Platform Best Practices
Useful links
Thanks for your time!
38

More Related Content

Similar to How to Model Your Data Like a Pro!

Open erp v7 contacts issue
Open erp v7 contacts issueOpen erp v7 contacts issue
Open erp v7 contacts issue
Raphaël Valyi
 

Similar to How to Model Your Data Like a Pro! (20)

7 reasons why your b2b demand gen sucks
7 reasons why your b2b demand gen sucks7 reasons why your b2b demand gen sucks
7 reasons why your b2b demand gen sucks
 
Open erp v7 contacts issue
Open erp v7 contacts issueOpen erp v7 contacts issue
Open erp v7 contacts issue
 
Open erp v7 contacts issue
Open erp v7 contacts issueOpen erp v7 contacts issue
Open erp v7 contacts issue
 
stackconf 2023 | Better Living by Changing Less – IncrativeOps by Michael Cot...
stackconf 2023 | Better Living by Changing Less – IncrativeOps by Michael Cot...stackconf 2023 | Better Living by Changing Less – IncrativeOps by Michael Cot...
stackconf 2023 | Better Living by Changing Less – IncrativeOps by Michael Cot...
 
Lightning Talks: An Innovation Showcase
Lightning Talks: An Innovation ShowcaseLightning Talks: An Innovation Showcase
Lightning Talks: An Innovation Showcase
 
Essay On Climate Change In Hindi Language
Essay On Climate Change In Hindi LanguageEssay On Climate Change In Hindi Language
Essay On Climate Change In Hindi Language
 
TECHunplugged London 2016 - Real World Storage
TECHunplugged London 2016 - Real World StorageTECHunplugged London 2016 - Real World Storage
TECHunplugged London 2016 - Real World Storage
 
It's Okay to be Wrong (Accelerator Academy Oct '17)
It's Okay to be Wrong (Accelerator Academy Oct '17)It's Okay to be Wrong (Accelerator Academy Oct '17)
It's Okay to be Wrong (Accelerator Academy Oct '17)
 
ML Meetup #27 - Intelligente Customer Support
ML Meetup #27 - Intelligente Customer SupportML Meetup #27 - Intelligente Customer Support
ML Meetup #27 - Intelligente Customer Support
 
Exploring the Business Decision to Use Cloud Computing
Exploring the Business Decision to Use Cloud ComputingExploring the Business Decision to Use Cloud Computing
Exploring the Business Decision to Use Cloud Computing
 
Modelling for decisions
Modelling for decisionsModelling for decisions
Modelling for decisions
 
Metrilo slides from 11 Demo day
Metrilo slides from 11 Demo dayMetrilo slides from 11 Demo day
Metrilo slides from 11 Demo day
 
User Story Maps: Secrets for Better Backlogs and Planning
 User Story Maps: Secrets for Better Backlogs and Planning User Story Maps: Secrets for Better Backlogs and Planning
User Story Maps: Secrets for Better Backlogs and Planning
 
Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusion
 
Time & Cost Benefits of Robotics in Processing Amazon Deductions & Chargebacks
Time & Cost Benefits of Robotics in Processing Amazon Deductions & ChargebacksTime & Cost Benefits of Robotics in Processing Amazon Deductions & Chargebacks
Time & Cost Benefits of Robotics in Processing Amazon Deductions & Chargebacks
 
Building Computer Vision Products at Hometogo GmbH (AI in Action Berlin, Apr...
Building Computer Vision Products at Hometogo GmbH  (AI in Action Berlin, Apr...Building Computer Vision Products at Hometogo GmbH  (AI in Action Berlin, Apr...
Building Computer Vision Products at Hometogo GmbH (AI in Action Berlin, Apr...
 
Putting Buyers and Sellers in the Best Light, How Etsy Leverages Big Data for...
Putting Buyers and Sellers in the Best Light, How Etsy Leverages Big Data for...Putting Buyers and Sellers in the Best Light, How Etsy Leverages Big Data for...
Putting Buyers and Sellers in the Best Light, How Etsy Leverages Big Data for...
 
Kindergarten Writing Paper With Picture Box Mrs E Vi
Kindergarten Writing Paper With Picture Box  Mrs E ViKindergarten Writing Paper With Picture Box  Mrs E Vi
Kindergarten Writing Paper With Picture Box Mrs E Vi
 
The Software Defined Institution - Theta 2015
The Software Defined Institution - Theta 2015The Software Defined Institution - Theta 2015
The Software Defined Institution - Theta 2015
 
Case study technology strategy at the bed cellar assignment inst
Case study technology strategy at the bed cellar assignment instCase study technology strategy at the bed cellar assignment inst
Case study technology strategy at the bed cellar assignment inst
 

More from CatarinaPereira64715

Master Detail Data - Sebastian Krempel.pdf
Master Detail Data - Sebastian Krempel.pdfMaster Detail Data - Sebastian Krempel.pdf
Master Detail Data - Sebastian Krempel.pdf
CatarinaPereira64715
 

More from CatarinaPereira64715 (6)

Master Detail Data - Sebastian Krempel.pdf
Master Detail Data - Sebastian Krempel.pdfMaster Detail Data - Sebastian Krempel.pdf
Master Detail Data - Sebastian Krempel.pdf
 
Push notifications using Firebase
Push notifications using FirebasePush notifications using Firebase
Push notifications using Firebase
 
Push notifications using Firebase
Push notifications using FirebasePush notifications using Firebase
Push notifications using Firebase
 
Caching Data in OutSystems: A Tale of Gains Without Pain
Caching Data in OutSystems: A Tale of Gains Without PainCaching Data in OutSystems: A Tale of Gains Without Pain
Caching Data in OutSystems: A Tale of Gains Without Pain
 
Multi tenancy - a practical approach
Multi tenancy - a practical approachMulti tenancy - a practical approach
Multi tenancy - a practical approach
 
Netherlands OSUG | Sep 30
Netherlands OSUG | Sep 30Netherlands OSUG | Sep 30
Netherlands OSUG | Sep 30
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 

How to Model Your Data Like a Pro!

  • 1. How to Model Your Data Like a Pro! Dallas Texas, June 22nd, 2022 Bruno Martinho Developer Advocate @ OutSystems
  • 3. 3 No “voodoo” here… What is happening behind the scenes?
  • 4. A SQL Query goes into a bar and walks up to two tables and asks… “Can I join you?” 4
  • 5. 5 Hello! My name is Gordon Knowitall. I’m the boss here and I’ll be running the show! Introductions
  • 6. 6 Hi! I’m NEO and I’ll be here to assist you with anything related to the OutSystems Platform. Introductions
  • 7. 7 Hey! You there… Yes, I’m talking to you! Do you even know what this company does? 6 months… and you don’t even know what we do??? Boss is in a bad mood This is an hotel. If you don't want to be fired, you need to create an application for our hotel booking system.
  • 8. 8 So, we have rooms... And each room has a number, some have AC and we classified them into Basic, Premium and Ultra-Mega- Premium. First requirements The room number will be something like 101, 312 or 655.
  • 9. 9 From what I’ve heard it seems that Room is a great candidate for an entity to store the room information. Make sure that we can get the entity attributes type from the requirements: “some have AC” this is a good candidate to be a Boolean. Entities and attributes
  • 10. 11 You know… I've been thinking… And the room names should be different: Silver, Gold and Diamond. More classy… Why doesn’t it surprise us?
  • 11. 12 So it seems that the room type will be a list of values. This is a good use case to use static entities. Also, these values might change (just now our boss changed his mind) but the room will still have the same type independent of the name, so we can normalize here our model. Static Entities and Normalization
  • 12. 14 Wait… Wait… Wait! Not Diamond... Platinum is better! Platinum shall be! Now… who’s ready?
  • 13. 15 No problem here, changing the Label won’t change anything is the application! Static Entities and Normalization
  • 14. 17 Not trying to insult your intelligence… I don't need to tell you that room numbers are unique, right? Obvious… but a valid one!
  • 15. 18 This is a very valid requirement that can be enforced with application logic but it is always a good practice to include it in the data model. We can use the Entity Room indexes to achieve this. Unique Index
  • 16. 20 Rooms have beds and we need to manage which beds need to change mattress. Regulation demands that a mattress needs to be changed every 3 months. More requirements…
  • 17. 21 This means that a Room can have multiple beds and it is important to keep track on the last date that the mattress has been changed. It makes sense to have another Entity called Bed to keep this information, linked to a Room with a 1 to Many relationship: 1 Room can have many Bed 1 to Many
  • 18. 23 I believe in transparency… Let's make sure that every single room has its real photo for our customers be able to see it. Mr. Knowitall is the king of transparency
  • 19. 24 To store the room picture we need to use an attribute in the Entity of type Binary Data. This takes a lot of information so to improve the performance, the room picture should be in a separate entity, the Room Picture that can have the same ID as the Room, creating a 1 to 1 relationship. 1 to 1 and Performance
  • 20. 26 Now the easy part… Our customers just need their name and passport and they can book a room for a period of time. Simple! Easy is our middle name
  • 21. 27 In order to achieve this, it is necessary to create another Entity to store the Name and Passport for the Customer. Now, this Customer needs to be linked to Room. In this case, since many Customer can book many Room, we need a Many to Many relationship using a third Entity that we can call Booking. Many to Many
  • 22. 29 Our Booking agents reported that they are having difficulty in seeing how many beds there are in a room. Can you please help? Look who’s asking gently
  • 23. 31 Sometimes, it is better to denormalize for performance sake. If a screen or a server action requires many complicated logic to retrieve the data then, performance wise it is better to denormalize the model. In this case, the Group by isn’t that complex, but to illustrate we can denormalize the model and add Number of Beds attribute in Entity Room. Don’t forget to update the number when a Bed is created or deleted. Denormalize for performance
  • 24. 33 Well, have I ever mentioned that we need this application for our 2 different hotel brands? Same application but we can't mix data! Last but not least
  • 25. 34 In case there is a need to have data separated for different brands or companies it is possible to use multi- tenancy. This won’t explain deeply how this feature works, but gives an idea that exists and can/should be used in this use case. Multitenancy
  • 26. 36 ● Entities and Attributes ● Static Entities and Normalization ● Unique Index ● Relationships ● 1 to Many ● 1 to 1 and Performance ● Many to Many ● Denormalize for performance ● Multitenancy Quick Recap
  • 27. 37 ● Data Modeling ● Data Model - Best Practices ● OutSystems Platform Best Practices Useful links
  • 28. Thanks for your time! 38

Editor's Notes

  1. Create Entity oom and scaffold Room to create a new Room Naming best practices PascalCase Meaningfull names Show actions Show properties Size (Truncate Data) Add field has Wi-FI Show that made an ALTER Table Cut/Paste will lose info!
  2. Normalization Static Show Data Show ER model New Scaffolding and create a new room.
  3. Normalization Static Show Data Show ER model New Scaffolding and create a new room.
  4. Indexes Show more options Try to create another room with the same number
  5. Show 1 to many Talk about delete rules
  6. Performance Show 1 to 1
  7. Show many to many Scafoold and create two customers Create one booking
  8. Show Group by
  9. Denormalize for performance Show on create/delete remove room update number of beds
  10. Multi-tenant