Log in | Jump |

jhollingworth

a blog about my life (twitter.com/jhollingworth)
This thing was constructed on March 4, 2010, and it was categorized as Uncategorized.
You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

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?

This thing was constructed by .


You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

One Trackback

  1. Posted March 8, 2010 at 5:45 am | Permalink

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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*