Is ASP.NET MVC completely (and exclusively) based on conventions?

Posted by Mike Valeriano on Programmers See other posts from Programmers or by Mike Valeriano
Published on 2012-10-01T13:54:56Z Indexed on 2012/10/01 15:52 UTC
Read the original article Hit count: 379

Filed under:
|
|

--TL;DR

  • Is there a "Hello World!" ASP.NET MVC tutorial out there that doesn't rely on conventions and "stock" projects?
  • Is it even possible to take advantage of the technology without reusing the default file structure, and start from a single "hello_world.asp" file or something (like in PHP)?
  • Am I completely mistaken and I should be looking somewhere else, maybe this?
  • I'm interested in the MVC framework, not Web Forms

--Background

I've played a bit with PHP in the past, just for fun, and now I'm back to it since web development became relevant for me once again. I'm no professional, but I try to gain as much knowledge and control over the technology I'm working with as possible.

I'm using Visual Studio 2012 for C# - my "desktop" language of choice - and since I got the Professional Edition from Dreamspark, the Web Development Tools are available, including ASP.NET MVC 4. I won't touch Web Forms, but the MVC Framework got my attention because the MVC pattern is something I can really relate to, since it provides the control I want but... not quite.

Learning PHP was easy - and right form the start I could just create a "hello_world.php" file and just do something like this for immediate results:

<!-- file: hello_world.php -->
<?php>
    echo "Hello World!";
<?>

But I couldn't find a single ASP.NET (MVC) tutorial out there (I'll be sure to buy one of the upcoming MVC 4 books, only a month away or so) that would start like that. They all start with a sample project, building up knowledge from the basics and heavily using conventions as they go along. Which is fine, I suppose, but it's now the best way for me to learn things.

Even the "Empty" project template for a new ASP.NET MVC 4 Application in VS2012 is not empty at all: several files and folders are created for you - much like a new C# desktop application project, but with C# I can in fact start from scratch, creating the project structure myself.

It is not the case with PHP:

  • I can choose from a plethora of different MVC frameworks
  • I can just create my own framework
  • I can just skip frameworks altogether, and toss random PHP along with my HTML on a single file and make it work

I understand the framework needs to establish some rules, but what if I just want to create a single page website with some C# logic behind it? Do I really need to create a whole bloat of files and folders for the sake of convention?

Also, please understand that I haven't gotten far on any of those tutorials mainly because of this reason, but, if that's the only way to do it, I'll go for it using one of the books I've mentioned before. This is my first contact with ASP.NET but from the few comparisons I've read, I believe I should stay the hell away from Web Forms.

Thank you. (Please forgive the broken English - it is not my primary language.)

© Programmers or respective owner

Related posts about php

Related posts about ASP.NET