SlideShare a Scribd company logo
Use T4 to apply
Domain Specific Development
Joubin Najmaie (@joubin)
Senior Solution Architect
PageFragments.com
joubin.najmaie@gmail.com
Agenda
• Domain Specific Development – quick concepts
• Quick story behind it all
• Project overview
• Break
• Review and Recap
• T4 overview
All Resources and Links
http://www.joubin.ca
60,000 Foot View
• Our typical project iterations
50,000 Foot View
• Domain Specific
Development approach
• (If applicable)
40,000 Foot View
• Work in terms of the problem space
• Makes it more accessible
• people not familiarwith the problem space
• Models - more verifiable and updatable
• Business knowledge is captured once
• DSL could be updated
30,000 Foot View
• Framework
• DSL – variable
20,000 foot view
• Domain-specific languages (DSLs)
• Text-based
• Code, XML, sql, wsdl, documentation etc.
• Graphical
• Flowcharts, ERDs, state diagrams, Venn diagrams
10,000 foot view
• T4
• Engine to create text-based DSLs
• Visual Studio
• 2005 -GAT toolkits
• 2008 - Downloadable DSL toolkit
• 2010 - Integrated part
5000 foot view
• Generates code from described models
• Models could be
• Metadata
• Configuration
• Database
One Story Behind our Project
• Our “suit” calls a meeting
• Empower the business users
• Give control over their own content
• Decentralize responsibilities
• Take “work” out
• By giving control over their content
Run Back to Your Desk
Content Analysis and Req’t Gathering
Code and Code more
Moment of Realization
• You’re doing the same thing every time you want
to be able to content manage a portion of the site
Project Walkthrough
PageFragments
Review & Recap
• Create a Special Purpose Language
• Capture of Domain knowledge
• Accessible to more developers
• Ability to build upon models
• Model is verifiable
• Domain Specific API for easy manipulation
• Flexibility: DSL could be in any language
What is T4?
• Text Template
Transformation Toolkit
• A templated text
generation engine
T4 Usage In Visual Studio
• ASP
.NET MVC
• Visual Studio Item templates
• Visual Studio Project templates
T4 Structure
• An overview of the T4 anatomy
• Processing a Template
Text-template
• Extension: .tt
• Item templates:
• Text Template
• Preprocessed text template
• Default transformation tools in Visual Studio
• TextTemplatingFileGenerator
• TextTemplatingFilePreprocessor
• In order to deploy/publish
• Build Action: Content
Anatomy of a Text-Template
How a Text-Template is Processed
Generate Class Based On an XSD
Let’s Get Into The T4 Syntax
• An overview of the T4 syntax
• Processing directives
• T4 various blocks
Processing Directives
Similar to ASPX or ASCX directive syntax
<#@ and end with #>
Directives
template
assembly
import
output
include
Processing Directive - template
<#@ template debug="true" language="C#" #>
Parameters
debug
language
inherits
hostspecific
Processing Directive - assembly
<#@ assembly #>
Parameter
name
could be an assembly in the GAC
• <#@ assembly name=“System.Data” #>
or absolute path to the assembly
• <#@ assembly name=“c:projectsproj1bindebugproj1.dll” #>
Processing Directive - import
<#@ import #>
Parameter
namespace
<#@ import namespace=“System.Collections.Generic” #>
Processing Directive - include
<#@ include #>
Parameter
file
<#@ include file=“includefile.tt” #>
Processing Directives
T4 Syntax
• Processing directives
• T4 various blocks
Text Blocks
Non-programmatic text
Statement Blocks
Delineated using <# #>
Expression Blocks
Delineated using <#= #>
Class Feature Blocks
Delineated using: <#+ #>
Used to add any class level construct
Helper functions
Fields
Constants
Properties
Code Blocks
Debugging a Text Template
Compile and Generate Assembly
Visual Studio – support tools
• Plug-in by Tangible Engineering *
• http://bit.ly/dfFhEi
• T4 Editor by Clarius
• http://bit.ly/cHfGRn
Call to action
• Try out the Text Template item template
• Start thinking of scenarios where you can apply
Domain Specific Development
• Look at other solutions that have used this
development pattern
• Many on Codeplex
Resources
• All resource links: http://www.joubin.ca
• T4 Templates: A Quick-Start Guide for ASP
.NET
MVC Developers
• http://bit.ly/cVKYp5
• Code gen + text template: http://bit.ly/VYsFf
• Glossary of terms: http://bit.ly/9gZosy
• Oleg’s blog: http://bit.ly/cq13qq
Resources
• Language Oriented Programming: The Next
Programming Paradigm:
• http://bit.ly/bVqYoG
• Book: Domain-Specific Development with
Visual Studio DSL Tools
• ISBN: 0321398203
Evaluations and Feedback
• Please fill out your evaluations!
Thank you!
And thanks to our sponsors
Send T4 questions to:
• Joubin Najmaie
• Twitter: @joubin
• Email: joubin.najmaie@gmail.com
• Blog: http://joubin.ca
Ad

More Related Content

What's hot (20)

.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blog
barryosull
 
Translate word press to your language
Translate word press to your languageTranslate word press to your language
Translate word press to your language
mbigul
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
Oliver Busse
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
Lior Tal
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEX
Sergei Martens
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович
Sigma Software
 
.Net standard 2.0
.Net standard 2.0.Net standard 2.0
.Net standard 2.0
Scott Golightly
 
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormationTear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
James Andrew Vaughn
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basicsGraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
Visuality
 
.Net Fundamentals
.Net Fundamentals.Net Fundamentals
.Net Fundamentals
Sunny Sharma
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
Karel Zikmund
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
Thomas Daly
 
SharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx ExtensionsSharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx Extensions
Anupam Ranku
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
NguynSang29
 
Using PowerShell for SharePoint 2013
Using PowerShell for SharePoint 2013Using PowerShell for SharePoint 2013
Using PowerShell for SharePoint 2013
Nikolas Charlebois-Laprade
 
Client server
Client serverClient server
Client server
Mike Feltman
 
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundDotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blog
barryosull
 
Translate word press to your language
Translate word press to your languageTranslate word press to your language
Translate word press to your language
mbigul
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
Oliver Busse
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
Lior Tal
 
Apex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEXApex world 2018 continuously delivering APEX
Apex world 2018 continuously delivering APEX
Sergei Martens
 
.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович.Net Core 3.0. What’s inside? Павло Голубович
.Net Core 3.0. What’s inside? Павло Голубович
Sigma Software
 
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormationTear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
Tear It Down, Build It Back Up: Empowering Developers with Amazon CloudFormation
James Andrew Vaughn
 
GraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basicsGraphQL in Ruby on Rails - basics
GraphQL in Ruby on Rails - basics
Visuality
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
Karel Zikmund
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
Thomas Daly
 
SharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx ExtensionsSharePoint framework - Introduction to SPFx Extensions
SharePoint framework - Introduction to SPFx Extensions
Anupam Ranku
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
NguynSang29
 
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundDotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
Karel Zikmund
 

Similar to Domain Specific Development using T4 (20)

Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Thomas Daly
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
Thomas Daly
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
Rodolfo Finochietti
 
Innovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and FrameworkInnovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and Framework
Sandeep Adwankar
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation Portal
Steve Anderson
 
T4 presentation
T4 presentationT4 presentation
T4 presentation
Gary Pedretti
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
Mike Willbanks
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
Alex Thissen
 
Markup languages and warp-speed documentation
Markup languages and warp-speed documentationMarkup languages and warp-speed documentation
Markup languages and warp-speed documentation
Lois Patterson
 
Lois Patterson: Markup Languages and Warp-Speed Documentation
Lois Patterson:  Markup Languages and Warp-Speed DocumentationLois Patterson:  Markup Languages and Warp-Speed Documentation
Lois Patterson: Markup Languages and Warp-Speed Documentation
Jack Molisani
 
O365: Attack of the Clones
O365: Attack of the ClonesO365: Attack of the Clones
O365: Attack of the Clones
Christopher Johnson
 
Effective admin and development in iib
Effective admin and development in iibEffective admin and development in iib
Effective admin and development in iib
m16k
 
Ow
OwOw
Ow
juanjoaloloco
 
ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123
DngHong855117
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
Rajput Rajnish
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
Gerke Max Preussner
 
Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?
Jeff Bramwell
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications
Vagif Abilov
 
ow.ppt
ow.pptow.ppt
ow.ppt
ssuser96a63c
 
ow.ppt
ow.pptow.ppt
ow.ppt
NalamalpuBhakthavats
 
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Thomas Daly
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
Thomas Daly
 
Innovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and FrameworkInnovations in Sencha Tooling and Framework
Innovations in Sencha Tooling and Framework
Sandeep Adwankar
 
Creating a Documentation Portal
Creating a Documentation PortalCreating a Documentation Portal
Creating a Documentation Portal
Steve Anderson
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
Mike Willbanks
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
Alex Thissen
 
Markup languages and warp-speed documentation
Markup languages and warp-speed documentationMarkup languages and warp-speed documentation
Markup languages and warp-speed documentation
Lois Patterson
 
Lois Patterson: Markup Languages and Warp-Speed Documentation
Lois Patterson:  Markup Languages and Warp-Speed DocumentationLois Patterson:  Markup Languages and Warp-Speed Documentation
Lois Patterson: Markup Languages and Warp-Speed Documentation
Jack Molisani
 
Effective admin and development in iib
Effective admin and development in iibEffective admin and development in iib
Effective admin and development in iib
m16k
 
ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123
DngHong855117
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
Rajput Rajnish
 
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
FMX 2017: Extending Unreal Engine 4 with Plug-ins (Master Class)
Gerke Max Preussner
 
Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?Visual studio 2012 - What's in it for me?
Visual studio 2012 - What's in it for me?
Jeff Bramwell
 
Staying Close to Experts with Executable Specifications
Staying Close to Experts with Executable SpecificationsStaying Close to Experts with Executable Specifications
Staying Close to Experts with Executable Specifications
Vagif Abilov
 
Ad

Recently uploaded (20)

Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Ad

Domain Specific Development using T4

  • 1. Use T4 to apply Domain Specific Development Joubin Najmaie (@joubin) Senior Solution Architect PageFragments.com [email protected]
  • 2. Agenda • Domain Specific Development – quick concepts • Quick story behind it all • Project overview • Break • Review and Recap • T4 overview
  • 3. All Resources and Links http://www.joubin.ca
  • 4. 60,000 Foot View • Our typical project iterations
  • 5. 50,000 Foot View • Domain Specific Development approach • (If applicable)
  • 6. 40,000 Foot View • Work in terms of the problem space • Makes it more accessible • people not familiarwith the problem space • Models - more verifiable and updatable • Business knowledge is captured once • DSL could be updated
  • 7. 30,000 Foot View • Framework • DSL – variable
  • 8. 20,000 foot view • Domain-specific languages (DSLs) • Text-based • Code, XML, sql, wsdl, documentation etc. • Graphical • Flowcharts, ERDs, state diagrams, Venn diagrams
  • 9. 10,000 foot view • T4 • Engine to create text-based DSLs • Visual Studio • 2005 -GAT toolkits • 2008 - Downloadable DSL toolkit • 2010 - Integrated part
  • 10. 5000 foot view • Generates code from described models • Models could be • Metadata • Configuration • Database
  • 11. One Story Behind our Project • Our “suit” calls a meeting • Empower the business users • Give control over their own content • Decentralize responsibilities • Take “work” out • By giving control over their content
  • 12. Run Back to Your Desk
  • 13. Content Analysis and Req’t Gathering
  • 15. Moment of Realization • You’re doing the same thing every time you want to be able to content manage a portion of the site
  • 17. Review & Recap • Create a Special Purpose Language • Capture of Domain knowledge • Accessible to more developers • Ability to build upon models • Model is verifiable • Domain Specific API for easy manipulation • Flexibility: DSL could be in any language
  • 18. What is T4? • Text Template Transformation Toolkit • A templated text generation engine
  • 19. T4 Usage In Visual Studio • ASP .NET MVC • Visual Studio Item templates • Visual Studio Project templates
  • 20. T4 Structure • An overview of the T4 anatomy • Processing a Template
  • 21. Text-template • Extension: .tt • Item templates: • Text Template • Preprocessed text template • Default transformation tools in Visual Studio • TextTemplatingFileGenerator • TextTemplatingFilePreprocessor • In order to deploy/publish • Build Action: Content
  • 22. Anatomy of a Text-Template
  • 23. How a Text-Template is Processed
  • 24. Generate Class Based On an XSD
  • 25. Let’s Get Into The T4 Syntax • An overview of the T4 syntax • Processing directives • T4 various blocks
  • 26. Processing Directives Similar to ASPX or ASCX directive syntax <#@ and end with #> Directives template assembly import output include
  • 27. Processing Directive - template <#@ template debug="true" language="C#" #> Parameters debug language inherits hostspecific
  • 28. Processing Directive - assembly <#@ assembly #> Parameter name could be an assembly in the GAC • <#@ assembly name=“System.Data” #> or absolute path to the assembly • <#@ assembly name=“c:projectsproj1bindebugproj1.dll” #>
  • 29. Processing Directive - import <#@ import #> Parameter namespace <#@ import namespace=“System.Collections.Generic” #>
  • 30. Processing Directive - include <#@ include #> Parameter file <#@ include file=“includefile.tt” #>
  • 32. T4 Syntax • Processing directives • T4 various blocks
  • 36. Class Feature Blocks Delineated using: <#+ #> Used to add any class level construct Helper functions Fields Constants Properties
  • 38. Debugging a Text Template
  • 40. Visual Studio – support tools • Plug-in by Tangible Engineering * • http://bit.ly/dfFhEi • T4 Editor by Clarius • http://bit.ly/cHfGRn
  • 41. Call to action • Try out the Text Template item template • Start thinking of scenarios where you can apply Domain Specific Development • Look at other solutions that have used this development pattern • Many on Codeplex
  • 42. Resources • All resource links: http://www.joubin.ca • T4 Templates: A Quick-Start Guide for ASP .NET MVC Developers • http://bit.ly/cVKYp5 • Code gen + text template: http://bit.ly/VYsFf • Glossary of terms: http://bit.ly/9gZosy • Oleg’s blog: http://bit.ly/cq13qq
  • 43. Resources • Language Oriented Programming: The Next Programming Paradigm: • http://bit.ly/bVqYoG • Book: Domain-Specific Development with Visual Studio DSL Tools • ISBN: 0321398203
  • 44. Evaluations and Feedback • Please fill out your evaluations!
  • 45. Thank you! And thanks to our sponsors
  • 46. Send T4 questions to: • Joubin Najmaie • Twitter: @joubin • Email: [email protected] • Blog: http://joubin.ca

Editor's Notes

  • #3: Main concepts of DSD Demo project features
  • #5: 1) A task/project/problem in hand 2) Pick favorite general purpose language – C#, VB.NET 3) Deliver project Each occurrence of problem has many aspects that are the same everytime (fixed part) And other aspects that are differs each time – variable part We’re going to automatically generate code for the variable part of the solution. Fixed part – We’ll treat as the framework Variable aspect – fits into the framework itself On a current project: Fixed aspect: Web Asset and configuration management framework Variable aspect: The content models (or aka content types in SharePoint) The content types: defined as metadata in a database, configuration file etc. T4 templates run to generate special classes (and logic) for the specific content types. The generated code could then be embedded in VS.NET projects (code or assembly) or called dynamically on the server to retrieve data. Other examples: ORM software Language-oriented programming Basis – observation Instead of solving problem one-at-a-time Many problems can more easily be resolved by designing a special-purpose language Code generation – through DSL toolkit with VS.NET Use T4 to generate that specialized programming language
  • #6: 1) A task/thought/problem in hand 2) Create/Pick a special-purpose language 3) Use a general purpose lang to write framework 4) Deliver project
  • #7: -- Benefits Ability to work in terms of the problem space Working in terms of the model of the problem space makes it more accessible to people not familiar with the problem space You can have the domain-experts verify the correctness of your model independently The model itself should be more testable and used to simulate scenarios Once the business knowledge is captured, the DSL could be updated to use other technologies, for example, by modifying the generator
  • #8: Framework – use general-purpose languages The variable pieces –generate domain-specific languages Plug the generated domain-specific languages into the framework
  • #9: DSL = “custom language that targets a small problem domain, which it describes and validates in terms native to the domain.” Could be seen as a set of tools to build tools Focus: text-based only!
  • #10: T4 - Engine to create text-based DSLs Visual Studio.NET 2005 - GAT toolkits 2008 - Downloadable DSL toolkit 2010 - Integrated part
  • #11: Generates code from described models Models could be Metadata Configuration Database What does it stand for? What are the Inputs? What are the outputs? What does the syntax look like? What are the supported languages?
  • #19: T3 == Text-to-Text Transformation T4 == Text Template Transformation Toolkit A tool in the VS.NET DSL toolkit A text-based code generation engine Templates = syntax similar to ASPX or ASCX Support: C# and VB.NET
  • #20: VS.NET extensibility
  • #22: .tt Pre 2010 – text file – turn it into .tt 2010 – two kinds of item templates Default transformation tools – properties of a tt file Publishing: Build Action to Content
  • #23: ASP.NET-like syntax Processor directives: compilation options Blocks: Mixture of text, control logic, blocks of executable code
  • #24: Base class: Microsoft.VisualStudio.TextTemplating.TextTransformation Directives Assemblies are loaded Include files are imported Text and expression blocks: Copied to the TransformText method Class-feature blocks: Copied at the class level T4 engine – calls the “TransformText” method – entry point %TEMP% folder
  • #25: This demo will be the basis for all Syntax reviewed here.
  • #27: Provide instructions to the T4 engine Just like ASPX pages: <#@ and end with #> Directives template assembly import output include
  • #28: Characteristics of the transformed output Debug --- true/false True – you can take a look files in system %TEMP% folder Language: Values: C#, VB, C#3.5 Inherits Base class: Microsoft.VisualStudio.TextTemplating.TextTransformation Tells which base class to use Hostspecific --- true/false Mostly used to output template file name to the transformed file Host.TemplateFile Host.StandardAssemblyReferenes
  • #29: “Add reference” in VS.NET One parameter name could be an assembly in the GAC <#@ assembly name=“System.Data” #> or absolute path to the assembly <#@ assembly name=“c:\projects\proj1\bin\debug\proj1.dll” #>
  • #30: Equivalent to: C# using VB.NET import One parameter namespace
  • #31: File to be included verbatim in template One parameter File Can contain any of the valid T4 constructs Relative paths -- to the main template
  • #33: Had an overview of the processing directives Let’s talk about T4 block types
  • #34: Just type directly into the .tt file Copied directly to TransformText method %TEMP% Show generated file
  • #35: Control the flow of processing in TransformText method Example usage: To conditionally output Text blocks Iterate over data and output things conditionally
  • #36: Use to add strings to the output file Added, in sequence To the “TransformText” method with calls to the ToString() method Used in cases to change some aspect of the generated output text file to use Calculated values External data e.g. database column values some other calculated value in a Statement block somewhere else in the .TT file.   C# – could be multiple lines VB.NET – single lines only
  • #37: Any class-level construct Helper functions Fields Constants Properties any construct that is valid at the class level T4 allows the usage of text and expression blocks intermingled with class feature blocks The helper method would be called from within a Statement block.
  • #39: Text template - %TEMP% Preprocessed: uses TextTemplatingFilePreprocessor transformation tool Debugging: System.Diagnostics.Debugger.Launch();
  • #45: DO NOT REMOVE THIS SLIDE