About jhollingworth
a blog about my life (twitter.com/jhollingworth)
Feed Subscriptions
I’m not certain why but for a while now I’ve really wanted to write a sort of python/ruby-esque DSL on top of ASP.NET MVC. I am probably going a little crazy and this is a dumb idea but I thought I might as well write it down and get it out of my system.
It would look something like this:
controller User:
//Actions are composed of method + name
get Add:
pass
post Add(userInputModel):
(homeInputModel -> User).save
redirect controller:home, view:foo
//Automatic transformation of types (e.g. view model -> domain object)
transformation HomeInputModel -> User:
HomeInputModel.Name <=> User.Name
HomeInputModel.Email <=> User.Email
HomeInputModel.Password <=> User.Password
//Validation of domain objects before they are persisted
validate User:
//Basic boolean validation logic
Name.Length > 0
//More complex business logic requiring a code block
Name n:
if n.First() == ‘y’:
ValidationException “We don’t like people who’s name starts with y”
model User:
string Name
email Email //Built in type’s for common forms of data, e.g. emails, passwords. Enables default validation
password Password
Many<Task> Tasks //Complex db relationships inbuilt
Underneath this would all compile to C# or IronPython using NHibernate & Asp.net mvc with various custom bits inbuilt. What do you think, am I going a little crazy?

One Trackback
[...] My crazy idea for a mvc language [...]