SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Developer Advocate for Telerik
Code PaLOUsa Co-Chairman
Author: TDN, Simple-Talk
Podcast: Eat Sleep Code
Twitter: @EdCharbeneau
o
-H.G. Wells “War of the Worlds”
Learn by doing
Work on something challenging
Find a fun project
A fluent API that creates Lorem Ipsum text and
placeholder images at runtime using simple helper
extension methods. Prototyping for MVC is
specifically for reducing prototyping markup. Since
lorem ipsum is injected at runtime, your markup
remains untouched and your source code remains
clean.
www.responsivemvc.net/Prototyping
CSHTML
<body> @Html.Ipsum().h1().p() </body>
Rendered HTML
<body>
<h1>Lorem Ipsum</h1>
<p>Erat stet aliquyam vero dolore …</p>
</body>
 Open up Prototyping MVC, a tool written for
C#/MVC, using JavaScript
 Remove the dependency on a backend language &
framework
Prototyping for MVC
 Installed via NuGet
 HTML Helpers
 Razor view engine
 @Html.Ipsum().[api chain]
 Outputs HTML
 Must be easy to install and operate
 Convert HTML Helper to jQuery plugin
 Maintain Razor Syntax
 Learn jQuery and JavaScript
?
Razor
Server side
Assists in building markup
Creates HTML
JavaScript
Client side
Independent of markup
Manipulates HTML
JavaScript is good at finding elements on a page.
Things like images, paragraphs, user interface
components. JavaScript is not good at finding
specific text on a page.
?
 Can I find text on a page and replace it?
 Can I execute dynamically created
JavaScript code from within my code?
 Can I do a combination of the above?
Can I find dynamically created JavaScript on a page, execute it and
replace the found text with the results of the dynamically created
JavaScript?
 Can I find text on a page and replace it?
 Yes! replaceText(regex, callback)
 Can I execute dynamically created
JavaScript code from within my code?
 Yes! eval(string)
 Can I do a combination of the above?
 Yes! replaceText(regex, eval(textFound))
Can I find dynamically created JavaScript on a page, execute it and replace the
found test with the results of the dynamically created JavaScript?
“I was a battleground of fear and
curiosity.”
-H.G. Wells “War of the Worlds”
After a month of putting off
the project, a working version
only took one day to complete.
C#
TagBuilder element = new TagBuilder(tag);
element.MergeAttributes(attributes);
element.innerHtml = “Lorem Ipsum”;
element.ToString();
Note:
Because C# is statically typed, we need help making this task
easy. Dynamic Reflection
HtmlHelper.AnonymousObjectToHtmlAttributes(object)
//returns a Key Value pair of HTML attributes
jQuery
attributes = $.extend({}, { text: text }, attributes);
$(tag, attributes)
C#
public Ipsum p(args…)
{
return this;
}
JavaScript
p: function(args…)
{
return this; //Ipsum
}
C#
public class Module {
private object SomeFunction() { … }
private object PrivateFunction() { … }
public object PublicFunction() {
return SomeFunction()
}
}
JavaScript
var module = function () {
//private
var someFunction = function(message){ ... },
privateFunction = function() { ... };
return {
//public
publicFunction: someFunction
}
} ()
Because JavaScript is a dynamic language, the jQuery
version of the tool is easily extended and customized.
 Don’t focus on solving the problems exactly the
same way they were solved before.
 Embrace the environment, don’t try to force
concepts from another language
 My C# development improved
after learning JavaScript.
 Writing code in a different
language changes your
prospective on solving
problems.
Go Explore
 responsivemvc.net/Prototyping
 github.com/EdCharbeneau/InlineIpsum
 goo.gl/ads6UF (Rapid prototyping article)
 goo.gl/ulV6LX (Learn jQuery)

Weitere ähnliche Inhalte

Was ist angesagt?

Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
ESUG
 
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Refresh Events
 

Was ist angesagt? (20)

JavaScript UI Architecture: Be all that you can be
JavaScript UI Architecture: Be all that you can beJavaScript UI Architecture: Be all that you can be
JavaScript UI Architecture: Be all that you can be
 
Tweakers Developers Summit 2019 - Angular for backend developers
Tweakers Developers Summit 2019 - Angular for backend developersTweakers Developers Summit 2019 - Angular for backend developers
Tweakers Developers Summit 2019 - Angular for backend developers
 
Introduction to webpack and babel
Introduction to webpack and babelIntroduction to webpack and babel
Introduction to webpack and babel
 
Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
Towards Modularity in Live Visual Modeling: A case-study with OpenPonk and Ke...
 
Huge web apps web expo 2013
Huge web apps web expo 2013Huge web apps web expo 2013
Huge web apps web expo 2013
 
AOT(Ahead Of Time)
AOT(Ahead Of Time)AOT(Ahead Of Time)
AOT(Ahead Of Time)
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 
BDD in PHP - Behat
BDD in PHP - BehatBDD in PHP - Behat
BDD in PHP - Behat
 
BDD and Behave
BDD and BehaveBDD and Behave
BDD and Behave
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 
Code Contracts
Code ContractsCode Contracts
Code Contracts
 
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
CI/CD non-breaking changes exercise - Cork Software Crafters - February 2020
 
JAX 08 - Agile RCP
JAX 08 - Agile RCPJAX 08 - Agile RCP
JAX 08 - Agile RCP
 
Rawnet Lightning Talk - Web Components
Rawnet Lightning Talk - Web ComponentsRawnet Lightning Talk - Web Components
Rawnet Lightning Talk - Web Components
 
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
Colin Bowern - The Not So Scary Side Of Asp.Net – Model View Controller In Th...
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Angular and Redux
Angular and ReduxAngular and Redux
Angular and Redux
 
J-Spring 2018 - Angular for Java developers
J-Spring 2018 - Angular for Java developersJ-Spring 2018 - Angular for Java developers
J-Spring 2018 - Angular for Java developers
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
 

Andere mochten auch

Presentazione Freewine
Presentazione FreewinePresentazione Freewine
Presentazione Freewine
Freewine
 
Prezentace twinspace (18)
Prezentace twinspace (18)Prezentace twinspace (18)
Prezentace twinspace (18)
hanakleiblova
 
mental health - a challange ahead
mental health - a challange ahead mental health - a challange ahead
mental health - a challange ahead
dhananjai1
 
Happiness is a voyage
Happiness is a voyageHappiness is a voyage
Happiness is a voyage
Lattitudes
 

Andere mochten auch (20)

Giving Clarity to LINQ Queries by Extending Expressions
Giving Clarity to LINQ Queries by Extending ExpressionsGiving Clarity to LINQ Queries by Extending Expressions
Giving Clarity to LINQ Queries by Extending Expressions
 
What is new in Q2 2015
What is new in Q2 2015What is new in Q2 2015
What is new in Q2 2015
 
Ikatan ion
Ikatan ionIkatan ion
Ikatan ion
 
Prova 9 giugno 2011
Prova 9 giugno 2011Prova 9 giugno 2011
Prova 9 giugno 2011
 
Acrl
AcrlAcrl
Acrl
 
Presentazione beauty food
Presentazione beauty foodPresentazione beauty food
Presentazione beauty food
 
Presentazione Freewine
Presentazione FreewinePresentazione Freewine
Presentazione Freewine
 
DAWN: Managing your professional reputation
DAWN: Managing your professional reputation   DAWN: Managing your professional reputation
DAWN: Managing your professional reputation
 
Prezentace twinspace (18)
Prezentace twinspace (18)Prezentace twinspace (18)
Prezentace twinspace (18)
 
Philosophy foroldage
Philosophy foroldagePhilosophy foroldage
Philosophy foroldage
 
The butterfly
The butterflyThe butterfly
The butterfly
 
Put theglassdown
Put theglassdownPut theglassdown
Put theglassdown
 
Revista arkade ed 20
Revista arkade   ed 20Revista arkade   ed 20
Revista arkade ed 20
 
mental health - a challange ahead
mental health - a challange ahead mental health - a challange ahead
mental health - a challange ahead
 
Tpa Jps 2011
Tpa Jps 2011Tpa Jps 2011
Tpa Jps 2011
 
Salary increment survey
Salary increment surveySalary increment survey
Salary increment survey
 
Happiness is a voyage
Happiness is a voyageHappiness is a voyage
Happiness is a voyage
 
What makes great kelloggs pr
What makes great kelloggs prWhat makes great kelloggs pr
What makes great kelloggs pr
 
Selling your live in care business
Selling your live in care businessSelling your live in care business
Selling your live in care business
 
Happiness is a voyage
Happiness is a voyageHappiness is a voyage
Happiness is a voyage
 

Ähnlich wie Journey to JavaScript (from C#)

react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
janet736113
 
CodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilderCodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilder
Andres Almiray
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
george.james
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 

Ähnlich wie Journey to JavaScript (from C#) (20)

Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...27 - Panorama Necto 14 component mode & java script - visualization & data di...
27 - Panorama Necto 14 component mode & java script - visualization & data di...
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
CodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilderCodeMash - Building Rich Apps with Groovy SwingBuilder
CodeMash - Building Rich Apps with Groovy SwingBuilder
 
GWT 2 Is Smarter Than You
GWT 2 Is Smarter Than YouGWT 2 Is Smarter Than You
GWT 2 Is Smarter Than You
 
Necto 16 training 20 component mode &amp; java script
Necto 16 training 20   component mode &amp; java scriptNecto 16 training 20   component mode &amp; java script
Necto 16 training 20 component mode &amp; java script
 
Build Your Own Instagram Filters
Build Your Own Instagram FiltersBuild Your Own Instagram Filters
Build Your Own Instagram Filters
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010Eclipse e4 on Java Forum Stuttgart 2010
Eclipse e4 on Java Forum Stuttgart 2010
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4
 
JavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilderJavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilder
 

Mehr von Ed Charbeneau

Mehr von Ed Charbeneau (18)

Writing JavaScript for C# Blazor.pptx
Writing JavaScript for C# Blazor.pptxWriting JavaScript for C# Blazor.pptx
Writing JavaScript for C# Blazor.pptx
 
Blazor Stability Testing Tools for Bullet Proof Applications
Blazor Stability Testing Tools for Bullet Proof ApplicationsBlazor Stability Testing Tools for Bullet Proof Applications
Blazor Stability Testing Tools for Bullet Proof Applications
 
Secrets of a Blazor Component Artisan (v2)
Secrets of a Blazor Component Artisan (v2)Secrets of a Blazor Component Artisan (v2)
Secrets of a Blazor Component Artisan (v2)
 
Modernizing Web Apps with .NET 6.pptx
Modernizing Web Apps with .NET 6.pptxModernizing Web Apps with .NET 6.pptx
Modernizing Web Apps with .NET 6.pptx
 
Modernizing Web Apps with .NET 6.pptx
Modernizing Web Apps with .NET 6.pptxModernizing Web Apps with .NET 6.pptx
Modernizing Web Apps with .NET 6.pptx
 
Blazor Full-Stack
Blazor Full-StackBlazor Full-Stack
Blazor Full-Stack
 
Secrets of a Blazor Component Artisan
Secrets of a Blazor Component ArtisanSecrets of a Blazor Component Artisan
Secrets of a Blazor Component Artisan
 
Writing java script for Csharp's Blazor
Writing java script for Csharp's BlazorWriting java script for Csharp's Blazor
Writing java script for Csharp's Blazor
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello Blazor
 
Razor into the Razor'verse
Razor into the Razor'verseRazor into the Razor'verse
Razor into the Razor'verse
 
Blazor
BlazorBlazor
Blazor
 
Giving Clarity to LINQ Queries by Extending Expressions R2
Giving Clarity to LINQ Queries by Extending Expressions R2Giving Clarity to LINQ Queries by Extending Expressions R2
Giving Clarity to LINQ Queries by Extending Expressions R2
 
The future of .NET lightning talk
The future of .NET lightning talkThe future of .NET lightning talk
The future of .NET lightning talk
 
Into the next dimension
Into the next dimensionInto the next dimension
Into the next dimension
 
TelerikNEXT What's new in UI for ASP.NET AJAX
TelerikNEXT What's new in UI for ASP.NET AJAXTelerikNEXT What's new in UI for ASP.NET AJAX
TelerikNEXT What's new in UI for ASP.NET AJAX
 
Refactoring css
Refactoring cssRefactoring css
Refactoring css
 
Don't be a stereotype: Rapid Prototype
Don't be a stereotype: Rapid PrototypeDon't be a stereotype: Rapid Prototype
Don't be a stereotype: Rapid Prototype
 
A crash course in responsive design
A crash course in responsive designA crash course in responsive design
A crash course in responsive design
 

Kürzlich hochgeladen

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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[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
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Journey to JavaScript (from C#)

  • 1.
  • 2. Developer Advocate for Telerik Code PaLOUsa Co-Chairman Author: TDN, Simple-Talk Podcast: Eat Sleep Code Twitter: @EdCharbeneau
  • 3. o -H.G. Wells “War of the Worlds”
  • 4.
  • 5. Learn by doing Work on something challenging Find a fun project
  • 6.
  • 7. A fluent API that creates Lorem Ipsum text and placeholder images at runtime using simple helper extension methods. Prototyping for MVC is specifically for reducing prototyping markup. Since lorem ipsum is injected at runtime, your markup remains untouched and your source code remains clean. www.responsivemvc.net/Prototyping
  • 8. CSHTML <body> @Html.Ipsum().h1().p() </body> Rendered HTML <body> <h1>Lorem Ipsum</h1> <p>Erat stet aliquyam vero dolore …</p> </body>
  • 9.  Open up Prototyping MVC, a tool written for C#/MVC, using JavaScript  Remove the dependency on a backend language & framework
  • 10. Prototyping for MVC  Installed via NuGet  HTML Helpers  Razor view engine  @Html.Ipsum().[api chain]  Outputs HTML
  • 11.  Must be easy to install and operate  Convert HTML Helper to jQuery plugin  Maintain Razor Syntax  Learn jQuery and JavaScript ?
  • 12. Razor Server side Assists in building markup Creates HTML JavaScript Client side Independent of markup Manipulates HTML
  • 13. JavaScript is good at finding elements on a page. Things like images, paragraphs, user interface components. JavaScript is not good at finding specific text on a page. ?
  • 14.
  • 15.  Can I find text on a page and replace it?  Can I execute dynamically created JavaScript code from within my code?  Can I do a combination of the above? Can I find dynamically created JavaScript on a page, execute it and replace the found text with the results of the dynamically created JavaScript?
  • 16.  Can I find text on a page and replace it?  Yes! replaceText(regex, callback)  Can I execute dynamically created JavaScript code from within my code?  Yes! eval(string)  Can I do a combination of the above?  Yes! replaceText(regex, eval(textFound)) Can I find dynamically created JavaScript on a page, execute it and replace the found test with the results of the dynamically created JavaScript?
  • 17. “I was a battleground of fear and curiosity.” -H.G. Wells “War of the Worlds” After a month of putting off the project, a working version only took one day to complete.
  • 18. C# TagBuilder element = new TagBuilder(tag); element.MergeAttributes(attributes); element.innerHtml = “Lorem Ipsum”; element.ToString(); Note: Because C# is statically typed, we need help making this task easy. Dynamic Reflection HtmlHelper.AnonymousObjectToHtmlAttributes(object) //returns a Key Value pair of HTML attributes jQuery attributes = $.extend({}, { text: text }, attributes); $(tag, attributes)
  • 19. C# public Ipsum p(args…) { return this; } JavaScript p: function(args…) { return this; //Ipsum }
  • 20. C# public class Module { private object SomeFunction() { … } private object PrivateFunction() { … } public object PublicFunction() { return SomeFunction() } } JavaScript var module = function () { //private var someFunction = function(message){ ... }, privateFunction = function() { ... }; return { //public publicFunction: someFunction } } ()
  • 21. Because JavaScript is a dynamic language, the jQuery version of the tool is easily extended and customized.
  • 22.  Don’t focus on solving the problems exactly the same way they were solved before.  Embrace the environment, don’t try to force concepts from another language
  • 23.  My C# development improved after learning JavaScript.  Writing code in a different language changes your prospective on solving problems.
  • 24.
  • 25.
  • 27.  responsivemvc.net/Prototyping  github.com/EdCharbeneau/InlineIpsum  goo.gl/ads6UF (Rapid prototyping article)  goo.gl/ulV6LX (Learn jQuery)

Hinweis der Redaktion

  1. About me / What I do Complacency
  2. Break for examples How it works Why it’s needed
  3. jquery.ba-replacetext.js
  4. First “grass is greener” moment
  5. Second “grass is greener” moment
  6. Fluent API design is almost identical Create a function that returns a method chain. In this case, whole Ipsum object.
  7. Accessibility levels in C# are part of the language and easily understood. Closures in JavaScript take more planning and discipline. Not all developers write closures the same way. http://addyosmani.com/resources/essentialjsdesignpatterns/book/