Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Monorail presentation at WebDevelopersCommunity, Feb 1, 2009


Published on

A presentation describing Castle Monorail, the MVC framework for ASP.NET from Castle project.

Given at Microsoft offices in Ra'anana, Israel, on Feb 2nd, 2009, for the Web Developers Community (WDC), by Ken Egozi, project lead of Monorail

Published in: Technology
  • Be the first to comment

Monorail presentation at WebDevelopersCommunity, Feb 1, 2009

  1. 1. Monorail Complex Lifecycle MVC SoC IoC integration Unneeded Abstraction HTTP
  2. 2. About Me <ul><li>Ken Egozi </li></ul><ul><li>BASIC > C > Turbo Pascal > VB > WebForms > RoR > Monorail </li></ul><ul><li>Blogs at </li></ul><ul><li>Have created AspView, the C# View Engine for Monorail </li></ul><ul><li>Participates in Open Source projects, mainly Castle Project </li></ul>
  3. 3. FindControl(“tblData”).Rows[3].Cells[2].Text = … int age; var succeed = int.TryParse(txtAge.text, out age);
  4. 4. The web is simple <ul><li>URLs have meaning – R for *Resource* </li></ul><ul><ul><li>/item?id=32 refers to the item with id=32 </li></ul></ul><ul><ul><li>/items?category=boots&page=2 refers to the second page of items, which belongs to ‘boots’ category </li></ul></ul><ul><ul><li>/boots/items/2, /item/32 same things </li></ul></ul>
  5. 5. The web is simple <ul><li>Request parameters: </li></ul><ul><ul><li>Within the URL ( http://server/path?query ) </li></ul></ul><ul><ul><li>Within the request body </li></ul></ul><ul><ul><li>The format for request parameters is: name1=value1 & name2=value2 </li></ul></ul><ul><ul><li>Arrays can be passed using </li></ul></ul><ul><ul><li>name=value1 & name=value2 … </li></ul></ul>
  6. 6. The web is simple <ul><li>Common types of requests (http verbs) </li></ul><ul><ul><li>GET  Retrieve data from a server. The data is identified by URL. </li></ul></ul><ul><ul><li>POST  Sending data to a server for storage or processing </li></ul></ul>
  7. 7. The web is simple <ul><li>Common response codes </li></ul><ul><ul><li>2xx  Success 200 (OK), 201 (Created) </li></ul></ul><ul><ul><li>3xx  Redirects 301 (Moved), 307 (Temporarily redirected) </li></ul></ul><ul><ul><li>4xx  Errors 404 (Not found) </li></ul></ul><ul><ul><li>5xx  Server errors 500 (General error), 503 (Unavailable) </li></ul></ul>
  8. 9. Monorail is a … <ul><li>MVC Web Framework </li></ul><ul><ul><li>Open source, with a thriving community </li></ul></ul><ul><ul><ul><li>Built by the framework users </li></ul></ul></ul><ul><ul><li>Built on top of ASP.NET </li></ul></ul><ul><ul><ul><li>Caching </li></ul></ul></ul><ul><ul><ul><li>Session Management </li></ul></ul></ul><ul><ul><ul><li>Authorisation </li></ul></ul></ul><ul><ul><ul><li>Authentication </li></ul></ul></ul><ul><ul><ul><li>Http Modules </li></ul></ul></ul><ul><ul><ul><li>etc. </li></ul></ul></ul><ul><ul><li>Mature, running many websites all around </li></ul></ul>
  9. 10. Core Principles: <ul><li>Simple </li></ul><ul><li>Maintainable </li></ul><ul><li>Convention over Configuration </li></ul><ul><li>Less code (as in: Less code, not as in: *.generated.cs) ‏ </li></ul><ul><li>Testable, TDD friendly </li></ul>
  10. 12. Monorail Lingua <ul><li>Action </li></ul><ul><ul><li>corresponds to a group of resources (vary by query/form) In code: a plain old .NET method </li></ul></ul><ul><li>Controller </li></ul><ul><ul><li>A logical group of actions In code: a .NET class which implements IController </li></ul></ul>public void Login(string username, string password) { } public class UsersController : SmartDispatcherController { }
  11. 13. Monorail Lingua <ul><li>View </li></ul><ul><ul><li>A template for rendering markup to be sent to the client. </li></ul></ul><ul><li>Layout </li></ul><ul><ul><li>A view that acts as a container for the rendered view </li></ul></ul>
  12. 14. Monorail Lingua <ul><li>Sub View </li></ul><ul><ul><li>A view that will be rendered within another view. </li></ul></ul><ul><li>View Component </li></ul><ul><ul><li>A component that can encapsulate presentational logic and view processing. Can have several views associated with it </li></ul></ul>
  13. 15. Simple “ Hard work” Business decisions DB access Web Service Controller String manipulations View Common logic Filter Common logic Filter Page’s code-behind Page’s Markup Control’s code-behind Control’s Markup WebForms MonoRail
  14. 16. MVC <ul><li>Sequence </li></ul>View Controller Model GET Load() ‏ Render HTTP POST Update() ‏ Redirect Load() ‏ Render HTTP
  15. 17. Conventions <ul><li>URL  Action </li></ul> Nothing new Controller Action Aspnet_isapi.dll Nothing new
  16. 18. Conventions <ul><li>URL  Action </li></ul>
  17. 20. Monorail vs. Webforms Impossible Easy View testing hacks/SOAP/.ashx Simple, REST like API Single huge form, viewstate, POST All aspect (VERBS, Multiple forms) ‏ HTTP/HTML __VIEWSTATE field in the form Easily (OSS), Conventions Extensible Complex Simple Lifecycle Everything is .Text Values, Classes Databinding Can be added Baked in, Simple conventions MVC WebForms Monorail
  18. 21. FUD <ul><li>Cannot Use Third-Party CustomControls? </li></ul><ul><ul><li>It’s easier to squeeze the designer’s markup into a foreach/if-else than into an OnItemDataBound </li></ul></ul><ul><ul><li>Can use Third-Party DHTML/JS client libraries </li></ul></ul><ul><li>How Do I Hire Developers? </li></ul><ul><ul><li>Decent WebForms developers should grasp the principles quickly </li></ul></ul><ul><ul><li>You actually gain access to seasoned PHP/RoR/ASP/ developers </li></ul></ul><ul><ul><li>There’s a learning curve anyway </li></ul></ul>
  19. 22. View Engines <ul><li>Official view engines: </li></ul><ul><ul><li>Brail </li></ul></ul><ul><ul><li>AspView </li></ul></ul><ul><ul><li>NVelocity </li></ul></ul><ul><li>Contributed view engines: </li></ul><ul><ul><li>Xslt </li></ul></ul><ul><ul><li>StringTemplate </li></ul></ul><ul><ul><li>NHaml </li></ul></ul>
  20. 23. Project Status <ul><li>Version 1.0 is nearly out of the door </li></ul><ul><li>What’s missing? </li></ul><ul><ul><li>Docs, </li></ul></ul><ul><ul><li>Samples, </li></ul></ul><ul><ul><li>Better Visual Studio integration </li></ul></ul><ul><li>Can you help with that? </li></ul>
  21. 24. How To Get Monorail <ul><li>Castle Official Releases </li></ul><ul><ul><li>Pro: </li></ul></ul><ul><ul><ul><li>Official </li></ul></ul></ul><ul><ul><ul><li>Documentation </li></ul></ul></ul><ul><ul><ul><li>Stable </li></ul></ul></ul><ul><ul><ul><li>Wizards </li></ul></ul></ul><ul><ul><li>Cons: </li></ul></ul><ul><ul><ul><li>Not cutting edge </li></ul></ul></ul><ul><li>A new release will be available in the near future </li></ul>
  22. 25. How To Get Monorail <ul><li>Build Server </li></ul><ul><ul><li>Pro: </li></ul></ul><ul><ul><ul><li>Stable enough ‏ </li></ul></ul></ul><ul><ul><ul><li>Cutting edge </li></ul></ul></ul><ul><ul><li>Cons: </li></ul></ul><ul><ul><ul><li>No wizards </li></ul></ul></ul><ul><ul><ul><li>Compilation target: Debug </li></ul></ul></ul>
  23. 26. How To Get Monorail <ul><li>Build Yourself </li></ul><ul><ul><li>Pro: </li></ul></ul><ul><ul><ul><li>Cutting edge </li></ul></ul></ul><ul><ul><ul><li>Build options (Release? 1.1? Mono? Medium-Trust?) ‏ </li></ul></ul></ul><ul><ul><ul><li>Apache license => can be tailored </li></ul></ul></ul><ul><ul><ul><li>Patches get applied => worldwide professional recognition </li></ul></ul></ul><ul><ul><li>Cons: </li></ul></ul><ul><ul><ul><li>Need tools (Subversion, NAnt) ‏ </li></ul></ul></ul><ul><ul><ul><li>Must find a stable revision </li></ul></ul></ul>
  24. 27. Monorail vs. ASP.NET MVC <ul><li>Both are great, and better than Webforms </li></ul><ul><li>ASP.NET MVC’s major pros: </li></ul><ul><ul><li>Larger user community </li></ul></ul><ul><ul><li>Official support ? </li></ul></ul><ul><li>Monorail’s major pros: </li></ul><ul><ul><li>Mature </li></ul></ul><ul><ul><li>Built by the framework users </li></ul></ul><ul><ul><li>Open source with permissive license </li></ul></ul><ul><ul><li>WAY cooler … </li></ul></ul>
  25. 28. Links <ul><li>Website: </li></ul><ul><li>Mailing list: [email_address] </li></ul><ul><li>Wiki: </li></ul>
  26. 29. Links <ul><li>Blogs: </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>