Thoughts on Software by Andrew Davey
| | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|
| 29 | 30 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | 11 | 12 | | 13 | 14 | 15 | 16 | 17 | 18 | 19 | | 20 | 21 | 22 | 23 | 24 | 25 | 26 | | 27 | 28 | 29 | 30 | 31 | 1 | 2 | | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Search
Navigation
Categories
Blogroll
|

Wednesday, July 02, 2008
Quick NRest Video
This is a very quick video showing the work I've been doing with Nemerle, ASP.NET routing and VB 9 XML literals.
I'm trying to find the most efficient way to create RESTful web applications. I'm willing to use all the tools in the box and even make my own to achieve this.
Wednesday, July 02, 2008 10:19:24 AM (GMT Standard Time, UTC+00:00)
.net | nemerle | REST | screencast | vb.net

Saturday, May 10, 2008

Tuesday, February 19, 2008
VB.NET 9 as an HTML View Engine
VB.NET 9 introduces a clean syntax for expressing XML data. XHTML is XML so why not use VB.NET to generate it, instead of ASPX pages? People are creating view engines for the new ASP.NET MVC framework. How about a view engine that uses VB.NET XML literals?
The benefits to this approach include full intellisense and access to a the full VB.NET language when creating HTML.
I see a view as a function from some data to an XML element (the <html> element):
Function CustomersPage(ByVal title As String, ByVal customers As IEnumerable(Of Customer)) As XElement
Return _
<html>
<head>
<title><%= title %></title>
</head>
<body>
<%= From customer In customers Select _
<div id=<%= customer.LastName %>>
<h1><%= customer.FirstName %></h1>
</div> %>
</body>
</html>
End Function
The important change from ASPX is that this is HTML in Code, rather than Code in HTML. As a result less "automagical" behaviour is required; It's just a function! This means AJAX features like "partial rendering", where a section of page needs to be updated, can be expressed by just calling a function that returns a <div> element. That same function can be used by the full HTML page function too.
ASPX "usercontrols" become simply functions as well. ASPX Master Pages are functions that have arguments for "placeholders" that get inserted into an template HTML page. Instead of having to reinvent a bunch of programming language concepts inside ASPX, we can just use a programming language that now support XML!
The only down side to this approach is we lose the IDE visual designer support. However, I find viewing an ASPX page that contains even simple conditional data rendering next to useless. I'd rather keep IE open and just refresh the page to see changes.
I am yet to embrace the MVC framework. I am waiting to see if the next release can better support Snooze framework ideas. However, there's no reason I can't use this VB XML magic in Snooze as it current is.
Tuesday, February 19, 2008 12:12:17 PM (GMT Standard Time, UTC+00:00)
.net | html | thinking | vb.net | web | xml