Herding Code 157: Amir Rajan on dynamic web development with Oak and Gemini

On this episode of Herding Code, the guys talk to Amir Rajan about his Oak and Gemini projects, which bring Rails-inspired dynamic programming to ASP.NET MVC.

Download / Listen:

Herding Code 157 – Amir Rajan on dynamic web development with Oak and Gemini [audio://herdingcode.com/wp-content/uploads/HerdingCode-0157-Oak.mp3]

Show Notes:

  • Overview – Developing with Oak
    • Oak is an approach to building single page applications that are heavy on JavaScript that takes a lot of inspiration from the Ruby community’s development approach.
    • Jon asks Amir to explain his development workflow, including SpecWatcher, NSpec, and Growl.
    • Jon asks about the File / New Project experience. Amir describes how that’s not even required – Oak works with WarmuP to build out a new project.
    • The next step is using Rake – Amir explains how Rake works. Running Rake builds the application and deploys, then sets up IIS against that instance.
  • Dynamic programming and Gemini
    • Oak leverages the dynamic keyword. Amir explains how it just augments what’s already there in ASP.NET MVC.
    • Amir explains how Oak works with Gemini, separate library he’s built to enable building dynamic objects. It allows you to attach properties and methods through mixins. He gives an example of using Gemini to extend a dynamic object with validation methods.
    • Amir describes how Oak leverages Gemini to take advantage of these decorated dynamic model objects throughout the different layers.
    • Scott K asks where the composition happens – is this a pipeline process?
    • Jon says it sounds like this is a more fleshed out version of some dynamic features that were started in ASP.NET MVC, like dynamic views and ViewBag. He explains how Gemini goes beyond Expando, because it also includes support for method missing.
    • Jon says Gemini reminds him of the Clay dynamic objects used in Orchard.
  • Data access and Cambium
    • Jon asks Amir about Cambium, the data layer. Amir says he customized Rob Conery’s Massive library to work with his Gemini objects, and points out that the resulting library uses remarkably little code.
    • Scott K asks Amir if he’s looked at Breeze. Amir says so far he’s just worked with standard ASP.NET MVC controllers, but he’s interested in looking at Breeze, Dapper, and NoSQL ORMs.
  • But why?
    • Kevin asks the silly question: why bother bringing Rails idioms to ASP.NET MVC – why not work in Rails?
    • Jon says the thing he sees Amir’s done is eliminate the shift between development and runtime modes in Visual Studio based development.
    • Jon asks about change tracking support in Cambium.
  • More about data – migrations
    • Amir explains migrations and schema generation in Oak and Cambium.
    • Amir says that SQL based migrations are important in many development environments.
  • Single page and Ajax
    • Jon asks Amir about the Single Page Application story in Oak. Amir explains some of the points of friction that exist in ASP.NET SPAs and explains how Oak is able to round-trip dynamic types.
    • Scott K. asks why it’s so hard to migrate schemas in .NET. Amir says that it’s due to our fixation on trying to define our models using code first in .NET types rather than in the database.
    • Jon asks how the first deployment and upgrade scenarios work in Oak.
    • Jon asks how Ajax interactions work. Amir explains how this works using the TaskRabbit sample to explain.
    • Amir explains how he’s relying on client-side rendering and templating more and more. He asks if we’re seeing that movement as well, and Scott K. agrees with him. They agree that focusing on serving JSON and rendering on the client solves a lot of problems.
    • Jon asks Amir if he’s using one controller to serve HTML and JSON, or if they’re split out. Amir says he’s got one controller to serve the HTML, then does everything else via a separate controller that serves JSON. He says he’s noticed that the ORMs have very little need for state with this approach.
    • Jon says he’s seeing the shift from a little Ajax interaction in mostly HTML focused servers to servers that are almost completely focused on serving JSON.
  • Some misc. questions
    • Jon asks about Canopy. Amir describes how Canopy is a stabilization layer on top of Selinium, and talks about why Canopy is built on top of F#.
    • Scott K. asks if Amir has looked at OWIN yet.
    • Jon asks about Async support in Oak.
    • Twitter question from Bobby Johnson: What do you do to limit the viral nature of dynamic in your code? Amir and Jon talk about how a lot of the assumed safety of static code is an illusion when you think about all the moving parts you’ve got no control over.
    • K. Scott and Scott K. think this is a fascinating project and like the code.
    • Scott K. and Jon joke about variants. Amir mentions that the dynamic nature of Gemini means that all the dynamic properties and methods are case insensitive.
  • Wrap up and getting started with Oak
    • Amir talks about how to get started with Oak.
    • Jon says the sample apps, documentation and screencasts are really nice.
    • Jon asks what’s next. Amir lists a better SPA story, better file uploads, adding dynamic to ServiceStack and Nancy, and growing the number of Gemini modules.
    • Kevin asks about the performance impact of this dynamic focus. Amir that he’s got an included test, and he’s found that dynamic is actually faster in a lot of cases which need to use reflection, such as ORMs, JSON serialization, and model binding.
    • Amir calls out the NSpec project and references their interview on Hanselminutes.

Show Links: