1 / 29

Monorail

HTTP. Unneeded Abstraction. Monorail. SoC. IoC integration. MVC. Complex Lifecycle. Ken Egozi BASIC > C > Turbo Pascal > VB > WebForms > RoR > Monorail Blogs at http://www.kenegozi.com/blog/ Have created AspView, the C# View Engine for Monorail

ulric-wells
Télécharger la présentation

Monorail

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HTTP Unneeded Abstraction Monorail SoC IoC integration MVC ComplexLifecycle

  2. Ken Egozi • BASIC > C > Turbo Pascal > VB > WebForms > RoR > Monorail • Blogs at http://www.kenegozi.com/blog/ • Have created AspView, the C# View Engine for Monorail • Participates in Open Source projects, mainly Castle Project About Me

  3. FindControl(“tblData”).Rows[3].Cells[2].Text = … int age; var succeed = int.TryParse(txtAge.text, out age);

  4. URLs have meaning – R for *Resource* • /item?id=32refers to the item with id=32 • /items?category=boots&page=2refers to the second page of items, which belongs to ‘boots’ category • /boots/items/2, /item/32 same things The web is simple

  5. Request parameters: • Within the URL (http://server/path?query) • Within the request body • The format for request parameters is:name1=value1 & name2=value2 • Arrays can be passed using • name=value1 & name=value2 … The web is simple

  6. Common types of requests (http verbs) • GET ➔ Retrieve data from a server. The data is identified by URL. • POST ➔ Sending data to a server for storage or processing The web is simple

  7. Common response codes • 2xx ➔ Success200 (OK), 201 (Created) • 3xx ➔ Redirects301 (Moved), 307 (Temporarily redirected) • 4xx ➔ Errors404 (Not found) • 5xx ➔ Server errors500 (General error), 503 (Unavailable) The web is simple

  8. MVC Web Framework • Open source, with a thriving community • Built by the framework users • Built on top of ASP.NET • Caching • Session Management • Authorisation • Authentication • Http Modules • etc. • Mature, running many websites all around Monorail is a …

  9. Simple • Maintainable • Convention over Configuration • Less code(as in: Less code, not as in: *.generated.cs)‏ • Testable, TDD friendly Core Principles:

  10. Action • corresponds to a group of resources (vary by query/form)In code: a plain old .NET method • Controller • A logical group of actionsIn code: a .NET class which implements IController Monorail Lingua public void Login(string username, string password) { } public class UsersController : SmartDispatcherController { }

  11. View • A template for rendering markup to be sent to the client. • Layout • A view that acts as a container for the rendered view Monorail Lingua

  12. Sub View • A view that will be rendered within another view. • View Component • A component that can encapsulate presentational logic and view processing. Can have several views associated with it Monorail Lingua

  13. MonoRail WebForms Filter Common logic Simple Page’s code-behind Controller “Hard work” Business decisions DB access Web Service Page’s Markup Control’s code-behind Filter Common logic Control’s Markup View String manipulations

  14. Sequence View Controller Model MVC GET Load()‏ Render HTTP POST Update()‏ Redirect Load()‏ Render HTTP

  15. URL •➔ Action Conventions http://www.my-cool-domain.com/post/show.aspx?id=2 Nothing new Controller Nothing new Action Aspnet_isapi.dll

  16. URL •➔ Action http://www.my-cool-domain.com/post/show.aspx?id=2 Conventions

  17. Monorail WebForms MVC Baked in, Simple conventions Can be added Monorail vs. Webforms Databinding Values, Classes Everything is .Text Lifecycle Simple Complex Extensible Easily (OSS), Conventions __VIEWSTATE field in the form HTTP/HTML All aspect (VERBS, Multiple forms)‏ Single huge form, viewstate, POST API Simple, REST like hacks/SOAP/.ashx View testing Easy Impossible

  18. Cannot Use Third-Party CustomControls? • It’s easier to squeeze the designer’s markup into a foreach/if-else than into an OnItemDataBound • Can use Third-Party DHTML/JS client libraries • How Do I Hire Developers? • Decent WebForms developers should grasp the principles quickly • You actually gain access to seasoned PHP/RoR/ASP/ developers • There’s a learning curve anyway FUD

  19. Official view engines: • Brail • AspView • NVelocity • Contributed view engines: • Xslt • StringTemplate • NHaml View Engines

  20. Version 1.0 is nearly out of the door • What’s missing? • Docs, • Samples, • Better Visual Studio integration • Can you help with that? Project Status

  21. Castle Official Releases • Pro: • Official • Documentation • Stable • Wizards • Cons: • Not cutting edge • A new release will be available in the near future How To Get Monorail

  22. Build Server • Pro: • Stable enough‏ • Cutting edge • Cons: • No wizards • Compilation target: Debug How To Get Monorail

  23. Build Yourself • Pro: • Cutting edge • Build options (Release? 1.1? Mono? Medium-Trust?)‏ • Apache license => can be tailored • Patches get applied => worldwide professional recognition • Cons: • Need tools (Subversion, NAnt)‏ • Must find a stable revision How To Get Monorail

  24. Both are great, and better than Webforms • ASP.NET MVC’s major pros: • Larger user community • Official support ? • Monorail’s major pros: • Mature • Built by the framework users • Open source with permissive license • WAY cooler … Monorail vs. ASP.NET MVC

  25. Website: http://www.castleproject.org • Mailing list:castle-project-users@googlegroups.com • Wiki:http://using.castleproject.org/display/CASTLE/Home Links

  26. Blogs: • http://hammett.castleproject.org • http://ayende.com/Blog • http://www.kenegozi.com/blog • http://benl.wordpress.com • http://devlicio.us/blogs/mike_nichols • http://andypike.wordpress.com • http://jonorossi.com/blog Links

More Related