Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MVC easy for a Classic ASP guy to learn [closed]

I've pretty much worked with Classic ASP for ever since it was released almost.. But i am having trouble adapting to the ASP.NET platform.

I have been suggested by many to move to PHP, since it's spaghetti code (I LIKE SPAGHETTI CODE), and it's just like classic asp.. But learning Apache servers and securing them i heard was another big project to learn by yourself.. And since i know more about MS servers, i prefer to stay with MS.

But, I really want to learn another platform, and i was looking at MVC framework and that MVC 1, 2 or 3 is like spaghetti code? Maybe i'm wrong. I assume MVC3 is the best now?

Anyway, From Classic ASP, which would be the easiest and most difficult to grasp you think? ASP.NET with all the compiling and using visual studio, reminds me of when i used to make apps in Visual Basic, but i really like spaghetti code more than compiling stuff..

If there is anyone who has done this switch over from classic asp before, what did you do and why, how easy was it to grasp the new platform? (Preferrably MVC)

like image 707
Wilkins Avatar asked Dec 17 '22 10:12

Wilkins


2 Answers

Well, MVC is more like classic asp than webforms is. However, it uses structure and frameworks to reduce spaghetti code and make it more maintainable. You have to apply a lot of new concepts to not fight the framework.

For example, a strong seperation of view, model, and controller. This is not something you would do in classic asp, or even generic php (you can do mvc in php, but it requires more discipline and using frameworks as well).

Bottom line is, spaghetti will always bite you in the long run.

Asp.net supports a mode where you don't have to compile anything, you just edit the files on the server and it compiles them at runtime automatically. This is the so called "Web site" model. However, MVC does not work that way and requires the "Web application" model that does compiling (although you only have to compile code, not markup).

like image 163
Erik Funkenbusch Avatar answered Dec 31 '22 19:12

Erik Funkenbusch


I'm currently smack in the middle of my first large ASP.NET MVC project after (and while still) programming in classic ASP for years. I have also programmed in ColdFusion and I have tried Python as an alternative to ASP.NET MVC.

If you want to stick to Microsoft technology MVC is the closest you will come to classic ASP. Webforms is really Microsofts way to make web-applications similar to application development. Microsoft has tried to abstract away the fact that the web is a stateless medium. However, this results in pretty ugly things such as the viewstate (a hidden form field that tries to keep the state of all form fields) and controls that generate HTML over which you have absolutely no control.
MVC gives you more control, and leaves you to handle the statelessness like classic ASP does.

I have still found there is a steep learning curve though; you will have to learn a lot of new things, if all you ever did was program vbscript/ASP:

  • C# or VB.Net Syntax
  • Object oriented programming in general (inheritance, dynamic versus static, etc.)
  • Concepts such as lambda expressions, delegates etc.
  • The MVC pattern
  • Most likely also a data-access technology like LINQ or Entity Framework

I'm still struggling with some of these, but I'm getting there. It does take a lot of work though, and perseverance. Not everything is better or easier than in classic ASP. Especially for me, as I have been using WSC's in classic ASP for years, which enables n-tier applications in classic ASP, and eliminates spaghetti code completely.

As I mentioned, I also looked into Python as an alternative; Although at the company I work for we now switched to ASP.NET MVC, I actually found the transition to Python a lot easier. The only reason we went with MVC is the fact that it seemed easier to get new developers when using C#/MVC. (In retrospect this wasn't actually true, we are having an incredible hard time finding a suitable C# programmer around where we are located)

Mind you, in Python you will still have to learn basic Object Oriented programming, but the implementation is much simpler to use than .NETs and the Python language is (IMHO) more like vbscript than VB.NET is.
Also I liked the fact that I don't have to define the type of every variable/function/parameter. This sometimes drives me crazy in C#; if the type of a function changes, it could affect a lot of other functions and variables, which all have to be changed. Also, the syntax is easier to pick up because the language is simple and there aren't a hundred ways to do the same thing.
You can choose between different frameworks, MVC or non-MVC and you can use Python in a lot of other fields as well (application programming, scripting-for example XBMC).
There are also ORM solutions available like Entity Framework for .NET and I found the one I looked into (SQLalchemy) a lot more powerful, and easier to pick up than EF.

So at work I'm currently learning ASP.NET MVC, at home I'm slowly picking up Python. I suggest you try a very simple project in different technologies, and pick the one you find easiest to get started with.

Hope this helps.

like image 23
Erik Oosterwaal Avatar answered Dec 31 '22 18:12

Erik Oosterwaal