Home MVC Storefront

ASP.NET MVC: Introducing The MVC Storefront Series

I'm creating an ongoing series of webcasts and blog posts, documenting the building of an eCommerce storefront using ASP.NET MVC. It's important to understand that this application has not been built yet - you're gonna help me do it :).

The goal is to build this application as openly, and "currently" as possible using an Agile approach with TDD. My goal is to post to this series at least twice a week as I build this application, taking your feedback and adjusting/discussing issues as they come up.

This first installment discusses our architectural and philosophical approach and I have some great conversations with people like Oren Eine (aka Ayende Rahien) and Steven Harman from the SubText team.

 

 

It's About Being Open
Keep in mind that as you see me do something, or make a decision, that it's not final. I'll be the first to admit that I'm very new to TDD and some of the architectural decisions that go into creating a testable application. As such I've made it a point to seek out people that are smarter than me (or at least think they are :) and start a discussion.

For this first episode, I did a peer-coding session with Ayende for a total of 3 hours. At first it was a "what would you do if you could..." and then resolved into a great session where we "stairs-tepped" each other, seeing all the neat things we could do with interfaces and IQueryable in particular.

I then hit up Steve Harman and we did the exact same thing - peer-coding for about 2 hours one Wednesday last week. He saw what Ayende was doing and was inspired to add some great stuff on top of that - including some impressive LINQ coding.

We went back and forth like this a few times - each iteration generating a better, tighter architecture that, for me, was really inspiring.

This Is The Most Fun I've Had Yet
I dig my job, a lot. But what I'm working on now is what really fires my rockets: working with the Community at large and building Something Good.

Personally, I love it when people with varying opinions on the state of the Industry can come together, share ideas and learn from each other, and build something good. Yes, I've changed my name to Stardust...

I hope you enjoy this screencast - the next one is in production and should be ready by tomorrow.

UPDATE: You can download Part 1 here.

Double-click for full-screen

Technorati Tags:

Matt avatar
Matt says:
Monday, April 07, 2008

Looks great so far. but the video player is a little small. And I can't figure out how to maximize it. probably just me being dim...


Eric avatar
Eric says:
Monday, April 07, 2008

if you link to http://silverlight.services.live.com/invoke/58326/MVCStorePart1/iframe.html, you will get a larger video.


Eric avatar
Eric says:
Monday, April 07, 2008

Or just double click on the video.


Zack Owens avatar
Zack Owens says:
Monday, April 07, 2008

Back to the ol roots of eCommerce are we Rob :)


Matt avatar
Matt says:
Monday, April 07, 2008

@Eric - thanks


Pat Gannon avatar
Pat Gannon says:
Monday, April 07, 2008

Is this going to evolve into a new open source project? CSK + MVC = <beavis>yeeeeeeeeees!</beavis>


Joshua McKinney avatar
Joshua McKinney says:
Monday, April 07, 2008

Would it be possible to get a downloadable version for watching offline?


PWills avatar
PWills says:
Monday, April 07, 2008

Rob:

Fantastic idea. Some feedback:

- The low-quality audio from Ayende and Steve was hard to understand. It's just a distraction. Even if it was higher quality, I'm not sold on the value -- I think in the interest of the viewer's time you can show their quotes without the original audio.

- The flash-forward of coding was great. Too many screencasts show the author coding, and it's just not an efficient use of time.

- What VS color scheme do you use? It's purty.

- This is a *total* nit, but I would have named the test either "Product_DiscountAmount_IsValid" or "Product__Discount_Amount__Is_Valid". I like the naming pattern of Object+Element+Behavior (we use it too) but the delimiter between names should be crystal clear.

- I second the calls for an offline copy; always helps people watch it on their commute.

- This textarea should be more than 8 rows.

Great concept. I'll definitely be following the whole series.


Rob Conery avatar
Rob Conery says:
Monday, April 07, 2008

Thank @pwillis... learning Camtasia isn't easy :).

The audio was captured with LiveMeeting - I agree it's whacky :) but I thought it worth it :).

RE Downloading the bits - I can't afford the bandwidth and I'm working to get a spot for the WMV's currently - I promise!


Torkel avatar
Torkel says:
Tuesday, April 08, 2008

Nice. A downloadable version would be good.


Rob Conery avatar
Rob Conery says:
Tuesday, April 08, 2008

@Torkel - I added a download link above.


Gokhan Demir avatar
Gokhan Demir says:
Tuesday, April 08, 2008

i was trying to make some samples with asp.net mvc.. rarely i got stuck when trying to make some architectural decisions for testability. nowadays this post is what i'm looking for.


Rich Mercer avatar
Rich Mercer says:
Tuesday, April 08, 2008

What a great idea! I can't wait to see how this plays out!


silky avatar
silky says:
Tuesday, April 08, 2008

must say; i know you have your own orm, but i don't really - at all - like the way the app was started. i mena designing the 'table' structure in code? meh, i prefer to start in the db and generate it out with llblgen. llblgen also has a very nice area for implementing those 'discount' type things [the partial class].

and while testing is nice, i don't see the point of doing it for things as trivial is calculating percents. or at least if you are going to do it, do it more thoroughly.

consider if the DiscountPercent was equal to 0.000000000000000000000000001m

crazy as it is, it'll result in an answer of 0 (because it goes out of range of decimal)


D'Arcy from Winnipeg avatar
D'Arcy from Winnipeg says:
Tuesday, April 08, 2008

Hey Rob, if you're worried about providing the videos for download due to bandwidth, you could post them up to SkyDrive and offload the bandwidth to MS (although they limit it to 50MB files, so if they're big you might have to unleash your Windows-Movie-Maker-Fu).

D


Eric avatar
Eric says:
Tuesday, April 08, 2008

I think you have a decent voice for a presenter. It's very soft and soothing. This is something I could listen to while relaxing in a bubble bath with a roomful of burning candles.


Shaneo avatar
Shaneo says:
Wednesday, April 09, 2008

I'm wondering...if Eric and The Mad Mexican have ever met.

Good series Rob. This is an excellent idea

-Shane


Willie Tilton avatar
Willie Tilton says:
Wednesday, April 09, 2008

Questions:

What are you using to access data? ss, nh, l2s, or something else?

Why did you separate out services and data into projects?

Will controllers reside in the services project? model classes in the data project? Why the rename?

Is it "open" in the sense that you'll take suggestions, or is it "open" source. If so, where's the repo located?


Rob Conery avatar
Rob Conery says:
Wednesday, April 09, 2008

What are you using to access data? ss, nh, l2s, or something else?

Hi Willie :)

>>>Why did you separate out services and data into projects?<<<

I wanted to have the logic bits in a different DLL. You don't need to do this for smaller apps - but in general it's a good first step. If I was following TDD to the letter, I wouldn't have done that until I realized I needed to.

>>>Will controllers reside in the services project? model classes in the data project? Why the rename?<<<

No - those control the flow of the app, not the commerce logic. This should be separated.

>>>Is it "open" in the sense that you'll take suggestions, or is it "open" source. If so, where's the repo located?<<

Yes, and yes. Part 3 is in the queue and will answer both questions.


Steve avatar
Steve says:
Thursday, April 10, 2008

Thanks Rob, this is good stuff :)

I'm using MS MVC with NHibernate and Spring.NET handling the controllers/NHibernate session/Dao objects.

I use jQuery for my client and ajax calls. I am really enjoying building apps in MS MVC!


Byron avatar
Byron says:
Friday, April 11, 2008

Hi Rob,

Firstly, well done on the screencast. I too like the code fast-forward idea.

Is this screencast about MVC or about TDD? If your going to be mentioning practices like ensuring the test is red first, you might want to be also mentioning other TDD fundamentals like writing ONLY enough code to make the test pass.

I noticed you have 3 paths through your 2 methods being tested and only 2 tests.

These methods were not driven out by the tests you wrote.


Otmar Pereira avatar
Otmar Pereira says:
Saturday, April 12, 2008

Hey Rob

I'm always hanging by your blog as lurker, but now i feel very encouraged to get into the discussion ,since this post presents something I'm always talking about with my coworkers: the 'perfect' architecture - altough i think it's impossible, we should pursue it. And something that i don't like at all are those value objects - from now on VO. I'm a purist, so i like to follow the concept of object: a representation of characteristics and behavior of a real world's thing. So, in my opinion, creating a Data project and Service means splitting an object in two things that each one are not an object. The part that holds the properties, basically, becomes a struct, and the other one is just like those oldschool C headers. It's very disgusting to do something like ProductService.Save(Product)... We are using a OO language!! What's the problem with Product.Save() ??

You may say that this data/service approach separates clearly concerns and some logic. But i think that you can achieve the same effect (separation of concerns) transforming both classes in Product base classes. So we could have something like:

internal class ProductModel

{

//Props come here

}

internal class ProductService : ProductModel

{

//Some DB Dirty code

void Save()

{

//Get props values defined in ProductModel and persist them

}

}

And finnally

public class Product : ProductService

{}

public class Product : ProductService

{

//Maybe some interface implementation here

//Make public internal base methods you want to expose

}

You still may ask me about object's methods isolation.Well... first of all, i don't believe the methods should be isolated, but maybe you can play a little with controllers (put them in the same real Model class Product's namespace).

I think this way you have a true object and separation of concerns too!


mike avatar
mike says:
Thursday, April 17, 2008

Nice post, i'll be sure to read them all. I agree with the poster that the audio from the other guys didn't sound good and didn't add much, you can just give the synopsis of your meeting with them.

@Otmar Pereira

That discussion is endless, you will find your 'holy grail' and it will be shattered in your next job or by a new experienced co-worker that has a different view. Reading the enterprise design pattern books will confirm this, there is no one pattern to rule them all.


Danny avatar
Danny says:
Friday, April 18, 2008

Rob,

Is the MVC Storefront similar to dashcommerce ?

I'm doing some R&D on building an e-commerce site using

asp.net MVC. I'm particularly interested in the PayPal

aspect.

thanks


Otmar Pereira avatar
Otmar Pereira says:
Friday, April 18, 2008

@mike: I face this very frequentely :(! But i don't believe that this is because of different views only... i see that people can't realize that it's possible to implement a very powerful object - just like a real world thing - and still separate concerns clearly. There are a lot of lazy developers who degenerate some concepts and definitions and end up thinking: "Oh, so to separate apps concerns clearly i must put each part in a separate DLL!". They go completely against the definition of an object - creating basically a set of VO classes, that in fact are mere structs, in one DLL, and a set of classes with functions for each VO into another one.When i have to work in systems with this architecture I feel obliged to code like in those C days at college :/

I insist at the point that if we are picking up an OO language, the first thing we must acomplish is to design an OO architecture. And an OO architecture isn't the antithesis of separation of concerns. It only requires that we spend our neurons a little more. But after seing the architecture that Rob picked up for this series, I really felt like i'm missing something! Hey, people, tell me! What's wrong with OO in C# and things like Product.Save() ????


Ram avatar
Ram says:
Tuesday, May 06, 2008

It would be nice if we can download the source code



Search Me
Subscribe

Popular Posts
 
My Tweets
  • @codinghorror: I may be weird but I don't ask my cats to write my blog entries :p.
  • @blowdart sure! Wanna come on and do a webcast with me - plugging CardSpace in?
  • People are very, very weird. Skypecasts are creepy.
  • Is Rob Howard trying to tell us something? http://www.rob-howard.net/
  • New storefront posted- all about OpenID :) http://tinyurl.com/5rkgux
  About Me



Hi! My name is Rob Conery and I work at Microsoft on the ASP.NET team. I am the Creator of SubSonic and was the Chief Architect of the Commerce Starter Kit (a free, Open Source eCommerce platform for .NET)

I live in Kauai, HI with my family, and when my clients aren't looking, I sometimes write things on my blog (giving away secrets of incalculable value).