Tuesday, July 27, 2010

ASP.NET MVC 3 Preview 1 out...

I've been spending my free time with ASP.NET MVC 2 for last few months and I do love the way it let's me be in control. I've never been such a big fan of ASP.NET Web Forms, or ASP.NET at all. However, I've tried out Ruby on Rails, Django, etc. fancy web frameworks and haven't just seen the use of those in enterprise software and in web applications especially. But ASP.NET MVC feels like suitable for those also.

So, I'm very enthusiastic about the new stuff that's coming out. I've already played around with the Razor view engine that was included in WebMatrix. And now I got the first preview of ASP.NET MVC 3. Yei!

So what's nice and new in this one?

Razor view engine

This one I've played with already a bit. The razor engine is more streamlined option for HTML templates with minimalistic syntax. It just feels like coding C# inside a HTML page. E.g.

WebFormsViewEngine:

<ul>
<% foreach (var invoice in Model.Invoices) { %>
<li><%:invoice.Balance%></li>
<% } %>
</ul>



And same in Razor view engine:


<ul>
@foreach (var invoice in Model.Invoices) {
<li>@invoice.Balance</li>
}
</ul>



Or example with if and foreach statements:

@if(Model.Invoices.Count == 0)
{
No invoices open!
}
else
<ul>
@foreach (var invoice in Model.Invoices) {
<li>@invoice.Balance</li>
}
</ul>
}


So the idea here is to make things a bit easier for everyone.

ViewData dictionary improvement

Another thing that makes your life just a bit easier is the support for the dynamic ViewData dictionary.

Previously we added stuff to the ViewData dictionary like this:

ViewData["Field"] = "Field content stuff";

Now we can use dynamic properties:

ViewData.Field = "Field content stuff";

A small change that makes me happy!

Dependency injection support

To ease up the unit testing and TDD, there's also new DI and IoC related features, that I haven't yet had time to play with. The following hooks are provided:
  • Creating controller factories
  • Creating controllers and setting dependencies
  • Setting dependencies on view pages for both the Web Form view engine and the Razor view engine
  • Setting dependencies on action filters

And of course tons of more stuff, check the release notes for more!

Sunday, May 31, 2009

Test-driven development and its flavors

Someone asked me on some of my agile courses months ago that what is the difference between test-driven development and test-first programming. I guess I answered right away without much thought that these terms refer to exactly same practice. Later on I've been experimenting with different ways to do TDD and suddenly found out that there really are different flavours of TDD. These all also have their own value and purpose in sw development.

Test-driven vs. Test-first

Test-driven is the traditional strict and very disciplined approach to development. Basically it means the RED-GREEN-REFACTOR cycle where tests are written one test at a time, the simplest possible solution to make that test is implemented and finally the code is refatored.

Test-first gives us means to make some more planning and test design before implementing the solution. We might e.g. write some high-level acceptance tests, integration tests and a bunch of unit tests to see how few tightly coupled classes work. After this the production code is written in order to make those tests pass. This approach might give us an opportunity to look at a broader picture in cases where it is needed.

Development vs. Design vs. Programming

What comes to test-driven development/design/programming I feel that the development is a bit more like an umbrella term. The terms design and programming have more interesting distinction.

Test-driven design is again the more XP way to implement software. We approach the whole design by writing tests that drive our design to certain way. After each test implemented we step back and look at the design and refactor in order to improve it.

However test-driven programming is highly popular approach throughout agile community. Design can be developed in front of whiteboard with few fellow team members and after the design seems suitable for the task at hand we'll move to implementation phase. The programming is done in test-driven/-first manner but with keeping the design in mind.

Well, this is how I see it. How about you? Any thoughts on this?

Sunday, December 28, 2008

Hello world

As everyone who is somehow involved in software development, I also know that everything new should be started with simplest possible solution. In programming languages it usually is a application called "Hello World". So this is my hello world for my new blog.

This blog is meant for more technical, software development related articles than my other blog, Managing dynamics. I plan to have at least few series of articles I'm about to write. First of all, I would like to introduce different Linux software development tools with a brief tutorial for all those. Second, I would like to go through agile software development practices and introduce tools that support them and tutorials to show what they are all about. So basically at least two different categories of articles will be published here: Agile and Linux.

Hopefully, I'll have soon time to get this started...