Blog

Day Seven – Razor and Essential Tools

Today I was able to read Pro ASP.NET MVC 3 Framework earlier than I have the last few nights.  I finished off Chapter 5 which was a quick lesson on the Razor view engine.

Then I started on Chapter 6 which explains some of the author’s “essential tools” for MVC development.  The tools explained were dependency injection container (Ninject), unit test framework (Visual Studio 2010′s built in tools) and mocking tools (Moq).

After reading the chapter, I find myself wondering what the distinction between the three are and why its important to use them.  I saw what each of the tools did and I can see their value to some degree, but I’m one of those guys that needs to know why something is important before it is important to my own workflow.

Further reading for myself:

I will have to find some time to better understand these, but at the same time I feel like they are the icing and I came into this looking how to make a cake.  So for the time being I’m going to focus on moving forward to Chapter 7 where the book finally starts to create a project over the next 3 chapters.

Also woo hoo! Seven days down.

Day Six – Automated Testing and Language Tools

Finished a chapter on automated testing.  Both unit testing and integration testing.

My understanding is that unit testing allows the programmer to test individual classes in isolation.  Integration testing allows the programmer to test multiple components together (this can include the whole web application).

This is important information and I plan on using it in the future, however to get a grasp on ASP.NET and MVC quickly I plan on foregoing automated testing while I go through this books later examples (the author’s kindly make it optional).  This decision was made so that I can focus on learning the core language first.

I also read through the majority of a chapter explaining essential language tools.  This included C# language features, Lambda expressions and LINQ.

Lambda expressions have went onto my whiteboard list of stuff to look into and gauge as I go forward.

Day Five – The MVC Pattern

The MVC (Model-View-Controller) pattern was the focus of my reading today.  This pattern was one of the reasons I chose this book as my goals were to learn MVC and ASP.NET

I may be over simplifying things but the pattern breaks down to:

  • Model – The data or database
  • View – Renders the HTML and C# the user sees
  • Controller – The interface between the other two.

The book also explains other possible patterns: Smart UI, Model-View, and Three-Tier Architecture.
As well as MVC variants: Model-View-Presenter and Model-View-View-Model

I can’t wait to put this into action.

I also started a whiteboard of terms that I felt were important and that I was fuzzy on.  Terms I could come back to later and continuously check my understanding of them as I gain more knowledge.  These include:

  • Aggregates – these seem really neat.  The ability to do group wide validation and cascading deletions are things I’m looking forward to learning more about.
  • Repositories
  • Dependency Injection

Day Three – First ASP.NET MVC Program

Today I came home, turned the computer on and gave Web Platform Installer one more go.

Success! Third time was definitely the charm.

Once I had the IDE set up I started on Chapter 2.  The chapter focused on having you make a full party invitation utility (index, RSVP form, validation, submission to email).  It favored functionality over understanding.  Brushing over complex concepts while reminding the reader that the details were to come in later chapters, but for now to just get a taste of what a project contains.

The chapter went over:

  • How to add a controller
  • Overview of Routes
  • Rendering views
  • Adding a data model
  • Creating forms
  • Get/Post
  • Model Binding
  • Validation

I’ve had very basic experience with Ruby and felt that Razor view engine mixed with MVC felt a little similar.  I could be wrong.  It has been awhile since I played with Ruby.

Here are some screenshots of what I created.

Slow and steady.

 

Questions

I had a few questions while reading through this chapter that I hope to better understand in the coming weeks.

What is C# Lambda expressions?
What makes a strongly typed view different?

Day Two – Installing Requirements

Last night I went through Chapter 2 of the book.  This chapter focused on setting up your development environment.  I already had Visual Studio 2010 Ultimate and Microsoft Server 2008 installed.  What I was missing was ASP.NET MVC 3.0 and the Visual Studio 2010 SP1 updates.  I honestly thought it would be a quick update.  It wasn’t.

I spent most of the night looking at this.  Notice it says it is installing.  It was confused because it was doing a lot of nothing.  I restarted it and went to sleep.  Woke up and only 12 of 16 installed successfully.  So overall not much accomplished.

What I learned

Web Platform Installer sucks a little.  It crashed on me three times last night, but its still a good utility when it works.