SlideShare ist ein Scribd-Unternehmen logo
1 von 9
DataClass™ Case Studies Problem 1: Duplication
Duplication ,[object Object]
Not all duplications are created equal
Compiled symbols only duplicate logical name
Magic strings duplicate data
Copy-and-paste duplicates behavior
Example of Duplication public class MyQueryRunner { public int RunMyQuery(IDbConnection conn) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = @"SELECT MAX([Tons]) FROM [Grapes] INNER JOIN [Fungi] ON [Grapes].[InfectionID] = [Fungi].[ID] WHERE [Fungi].[Name] = 'botrytis cinerea'"; return (int)cmd.ExecuteScalar(); } } } CREATE TABLE Fungi([ID] UniqueIdentifier, [Name] NVARCHAR(200)) -- populate table INSERT INTO Fungi([ID], [Name]) VALUES(newid(), 'botrytis cinerea') CREATE TABLE Grapes([Variety] NVARCHAR(50), [Tons] INT, [InfectionID] UniqueIdentifier)
Single Logical Document ,[object Object]
Database service providers typically not

Weitere ähnliche Inhalte

Was ist angesagt?

Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The Libraries
Simon Willison
 

Was ist angesagt? (20)

Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
PythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみたPythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみた
 
WordCamp London 2013
WordCamp London 2013WordCamp London 2013
WordCamp London 2013
 
PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
 
Intro
IntroIntro
Intro
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
Object Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHPObject Calisthenics Adapted for PHP
Object Calisthenics Adapted for PHP
 
Rediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The LibrariesRediscovering JavaScript: The Language Behind The Libraries
Rediscovering JavaScript: The Language Behind The Libraries
 
Node.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer NäheNode.js - Demnächst auf einem Server in Ihrer Nähe
Node.js - Demnächst auf einem Server in Ihrer Nähe
 
Client-side Storage 
Client-side Storage Client-side Storage 
Client-side Storage 
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
RxSwift 시작하기
RxSwift 시작하기RxSwift 시작하기
RxSwift 시작하기
 
Mongo db for C# Developers
Mongo db for C# DevelopersMongo db for C# Developers
Mongo db for C# Developers
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
Crowdsourcing with Django
Crowdsourcing with DjangoCrowdsourcing with Django
Crowdsourcing with Django
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 

Andere mochten auch

The body
The bodyThe body
The body
Lauren
 
Traditiolnal vs non traditional
Traditiolnal vs non traditional Traditiolnal vs non traditional
Traditiolnal vs non traditional
sathma
 
Behavioural Marketing…or how to get your customers to love you
Behavioural Marketing…or how to get your customers to love youBehavioural Marketing…or how to get your customers to love you
Behavioural Marketing…or how to get your customers to love you
John Watton
 
Lesson9 numbers
Lesson9 numbersLesson9 numbers
Lesson9 numbers
Lauren
 
Open Day Presentation
Open Day Presentation Open Day Presentation
Open Day Presentation
sallyross
 
3rd nat. parks
3rd nat. parks3rd nat. parks
3rd nat. parks
llsears
 
C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1
picardo123
 
소통PT - 2010 서울시대안교육센터 교사워크숍
소통PT - 2010 서울시대안교육센터 교사워크숍소통PT - 2010 서울시대안교육센터 교사워크숍
소통PT - 2010 서울시대안교육센터 교사워크숍
NaYoun Kim
 
Integrate technology by expanding your toolkit pp
Integrate technology by expanding your toolkit ppIntegrate technology by expanding your toolkit pp
Integrate technology by expanding your toolkit pp
Ladue School District
 

Andere mochten auch (20)

The body
The bodyThe body
The body
 
Sergio Santos Portfolio
Sergio Santos PortfolioSergio Santos Portfolio
Sergio Santos Portfolio
 
FUKUYAMA BASE WORKSHOP Vol16 Theme
FUKUYAMA BASE WORKSHOP Vol16 ThemeFUKUYAMA BASE WORKSHOP Vol16 Theme
FUKUYAMA BASE WORKSHOP Vol16 Theme
 
Traditiolnal vs non traditional
Traditiolnal vs non traditional Traditiolnal vs non traditional
Traditiolnal vs non traditional
 
Fukuyama base workshop vol06 theme
Fukuyama base workshop vol06 themeFukuyama base workshop vol06 theme
Fukuyama base workshop vol06 theme
 
Practicing Agile in Offshore Environment
Practicing Agile in Offshore EnvironmentPracticing Agile in Offshore Environment
Practicing Agile in Offshore Environment
 
Gastcollege Universiteit Utrecht 'Games in het onderwijs'
Gastcollege Universiteit Utrecht 'Games in het onderwijs'Gastcollege Universiteit Utrecht 'Games in het onderwijs'
Gastcollege Universiteit Utrecht 'Games in het onderwijs'
 
Behavioural Marketing…or how to get your customers to love you
Behavioural Marketing…or how to get your customers to love youBehavioural Marketing…or how to get your customers to love you
Behavioural Marketing…or how to get your customers to love you
 
Numeros
NumerosNumeros
Numeros
 
T-Systems Core Belief Collaboration - Portfolio Overview
T-Systems Core Belief Collaboration - Portfolio OverviewT-Systems Core Belief Collaboration - Portfolio Overview
T-Systems Core Belief Collaboration - Portfolio Overview
 
Gamification - Play or be Played
Gamification - Play or be PlayedGamification - Play or be Played
Gamification - Play or be Played
 
Lesson9 numbers
Lesson9 numbersLesson9 numbers
Lesson9 numbers
 
Presentation to WUG on promoting social media in state government (updated)
Presentation to WUG on promoting social media in state government (updated)Presentation to WUG on promoting social media in state government (updated)
Presentation to WUG on promoting social media in state government (updated)
 
Open Day Presentation
Open Day Presentation Open Day Presentation
Open Day Presentation
 
Scambio sul posto dell\'energia
Scambio sul posto dell\'energiaScambio sul posto dell\'energia
Scambio sul posto dell\'energia
 
3rd nat. parks
3rd nat. parks3rd nat. parks
3rd nat. parks
 
C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1
 
소통PT - 2010 서울시대안교육센터 교사워크숍
소통PT - 2010 서울시대안교육센터 교사워크숍소통PT - 2010 서울시대안교육센터 교사워크숍
소통PT - 2010 서울시대안교육센터 교사워크숍
 
Integrate technology by expanding your toolkit pp
Integrate technology by expanding your toolkit ppIntegrate technology by expanding your toolkit pp
Integrate technology by expanding your toolkit pp
 
Corporate Training Programs
Corporate Training ProgramsCorporate Training Programs
Corporate Training Programs
 

Ähnlich wie DataClass Case Study #1: Solving the Duplication Problem

Ähnlich wie DataClass Case Study #1: Solving the Duplication Problem (20)

Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 
Symfony2 - extending the console component
Symfony2 - extending the console componentSymfony2 - extending the console component
Symfony2 - extending the console component
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Leveraging Symfony2 Forms
Leveraging Symfony2 FormsLeveraging Symfony2 Forms
Leveraging Symfony2 Forms
 
Building a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to SpaceBuilding a friendly .NET SDK to connect to Space
Building a friendly .NET SDK to connect to Space
 
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...Building Persona: federated and privacy-sensitive identity for the Web (Open ...
Building Persona: federated and privacy-sensitive identity for the Web (Open ...
 
1st CI&T Lightning Talks: Writing better code with Object Calisthenics
1st CI&T Lightning Talks: Writing better code with Object Calisthenics1st CI&T Lightning Talks: Writing better code with Object Calisthenics
1st CI&T Lightning Talks: Writing better code with Object Calisthenics
 
Design how your objects talk through mocking
Design how your objects talk through mockingDesign how your objects talk through mocking
Design how your objects talk through mocking
 
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
Building Persona: federated and privacy-sensitive identity for the Web (LCA 2...
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
 
Clean code
Clean codeClean code
Clean code
 
Devoxx 2012 hibernate envers
Devoxx 2012   hibernate enversDevoxx 2012   hibernate envers
Devoxx 2012 hibernate envers
 
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
Kamil Chmielewski, Jacek Juraszek - "Hadoop. W poszukiwaniu złotego młotka."
 
Api
ApiApi
Api
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++
 
Javascript1
Javascript1Javascript1
Javascript1
 
Postman On Steroids
Postman On SteroidsPostman On Steroids
Postman On Steroids
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

DataClass Case Study #1: Solving the Duplication Problem

  • 1. DataClass™ Case Studies Problem 1: Duplication
  • 2.
  • 3. Not all duplications are created equal
  • 4. Compiled symbols only duplicate logical name
  • 7. Example of Duplication public class MyQueryRunner { public int RunMyQuery(IDbConnection conn) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = @"SELECT MAX([Tons]) FROM [Grapes] INNER JOIN [Fungi] ON [Grapes].[InfectionID] = [Fungi].[ID] WHERE [Fungi].[Name] = 'botrytis cinerea'"; return (int)cmd.ExecuteScalar(); } } } CREATE TABLE Fungi([ID] UniqueIdentifier, [Name] NVARCHAR(200)) -- populate table INSERT INTO Fungi([ID], [Name]) VALUES(newid(), 'botrytis cinerea') CREATE TABLE Grapes([Variety] NVARCHAR(50), [Tons] INT, [InfectionID] UniqueIdentifier)
  • 8.
  • 10.
  • 11. Converse with database (C#, Java, XML, etc.)
  • 12.
  • 14.
  • 15. ...just like a real class
  • 16. Example Database Class (Part I) namespace HexagonSoftware.DataClass.Examples { database WineProductionDataStore { stereotypes table, column, values, value; version 1.0 : initialized { design { public table Grapes { public column Identity ("ID"); public column Tons; public column InfectionIdentity ("InfectionID"); } public table Fungi { public column Identity ("ID"); public column Name; public values KnownFungi { public value NobleRot with Name = 'botrytis cinerea'; } } } } } }
  • 17. Example Database Class (Part II) // in version 1.0 construction { in context Fungi { step sql { CREATE TABLE [$[Fungi]]([$[Identity]] UNIQUEIDENTIFIER, [$[Name]] NVARCHAR(50)) } step sql { INSERT INTO [$[Fungi]]([$[Identity]], [$[Name]]) VALUES(newid(), '$[KnownFungi.NobleRot.Name]') } } in context Grapes { step sql { CREATE TABLE [$[Grapes]]( [$[Identity]] UniqueIdentifier, [$[Tons]] INT, [$[InfectionIdentity]] UniqueIdentifier) } } }
  • 18. Example Database Class Usage using DBDesign = WineProductionDataStore.Design._1_0; public class MyQueryRunner { public int RunMyQuery(IDbConnection conn) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = string.Format( @"SELECT MAX([{0}]) FROM [{1}] INNER JOIN [{2}] ON [{3}].[{4}] = [{2}].[{5}] WHERE [{2}].[{6}] = '{7}'", DBDesign.Grapes.Tons.GetPhysicalName(), DBDesign.Grapes.GetPhysicalName(), DBDesign.Fungi.GetPhysicalName(), DBDesign.Grapes.InfectionIdentity.GetPhysicalName(), DBDesign.Fungi.Identity.GetPhysicalName(), DBDesign.Fungi.Name.GetPhysicalName(), DBDesign.Fungi.KnownFungi.NobleRot.Name ); return (int)cmd.ExecuteScalar(); } } }
  • 19.
  • 20. Coupling clients to the right version
  • 21. Minimizing cost of interface