From PHP to .Net MVC

Speed of development is the main problem

I recently joined a project that runs entirely on .Net MVC. The only problem is that for the past 6 years, I spent the majority of my time programming on PHP projects. Obviously, there has been a lot of issue to go through the switch and I would like to list the main problems I had so anyone jumping in the same wagon could find some guidance.

Command line.

PHP thrives best in a Linux environment. I have been mostly programming with PHP on a Linux box, and you can't use Linux to it's full extent unless you are very familiar with its command line interface. Even simple things like navigating through a folder structure and quickly peaking through files with vim or less are much harder in Windows. Although you can use the command line in windows, it is more convenient to just use the file explorer.

I cheated and downloaded Git bash, which is a bash implementation in windows. It has most of the command features you will find on a Linux box. My favorites are vim, less, grep, and ls. The rest I can do without, but these 4 can help me work on windows at the same speed.

One of the things that we develop over the years as Linux users is cutting the middle man. For example, if I want to activate a feature, I don't have to open an application, navigate to settings, click on the wizard, got to step 3 and change the setting. Through the terminal, every setting is usually one command away. The only problem is you have to know the command.


Most of the time Apache comes in pre-installed with the system, but usually take no more than a single command to install it. It's power lies in its natural integration with PHP. Any issue you have with it is extensively documented on the web.

When I first tried to run my MVC project I was confused. I had already installed IIS on the machine for static pages I run locally. But I never managed to run the project with this instance of IIS. I had to download visual studio express, which comes bundled with IIS Express, and runs a new instance every time I build the project.

I won't call my self an expert, maybe it is my configuration that needs to be optimum. But lunching the project is super slow. I spend an enormous amount of time just waiting for IIS to load.

Maybe in time, I will learn to make it run faster. But for now, it is a pain.


I have heard countless of times that you can run a .Net project without an IDE, but I have yet to figure out how. But this may come from my years of using PHP and may not be what most people need. With PHP, I never stick to a single IDE. I use multiple machines, some Windows, some Linux and I never care about what IDE it is running on. In fact, the IDE is just a frame around the code. So you will see me use ZendStudio, NetBeans, Sublime, or vim. Either way I am writing code and it is running.

With .Net, so far I can only do it on Visual Studio. I'm using the Express version since it is free, but will soon try the community version. Not that I need to, but I don't have any other options. I don't get to be mad when it crashes because I have no alternative. One thing, I have gotten used to by using Sublime, is to have the IDE load instantly, no question asked. With Visual Studio, I have to let it do all its thinking first before I can do anything. The same for ZendStudio, or all the Eclipse based IDEs.

I was told that the older versions of Visual Studio had less bloats, and I don't remember it being this slow when I worked on it around 2010.


One of the strong points of Visual Studio is how coupled it is with the code. C# on .Net is compiled which gives it lots of control when it comes to debugging. At any point, you can insert a breakpoint and inspect values and variables. The only problem, it is not instant. Running the website in debug mode is ultra slow. It gives you all the benefits of debugging if you are willing to wait for it.

With PHP, you can have breakpoints if you install xdebug. But, 9 out of 10 times, var_dump will do the job. Many times, people had tried to convince me that break points are more efficient, but when it takes only a few milliseconds to print the content of a variable after you hit F5, I don't see how else you can top that. So in this case I take speed over thoroughness.


MVC on .Net produce compiled binaries. In other words it is supposed to be very very fast. But it is not. On the same machine, I run Apache and PHP on a VM, and the websites render instantly, even on the first request. With the .Net project, I dread the first request. And if I make the mistake of running it on debug mode I will take double the time.

There must be settings to make it render faster, but for a brand new project in PHP, things just render. Almost too fast.


This may be an unfair comparison because the majority of websites run on PHP. But for my needs, I can get blazing fast servers on non shared hosting environment for very cheap. On digital ocean I only spend $5 a month for a small server. And for bigger one I can go up to $20. And for scale I simply spin multiple $5 servers.

With .Net, there aren't a lot of options. You have shared hosting which is affordable, but you have to settle for the fact that you have thousands of website sharing the resources. If you want a better server, you will have to be ready to pay at least $70 a months. Again, not very expensive, but not as convenient as the Linux servers available today.


I've been working on .Net for 2 months now and it can be very challenging to adjust to these new realities. Whether I like the process or not, I will still have to learn to manage it. Just like I did with PHP. The speed is a big factor, because I spend more time waiting than building my application. And series of small bumps really add up.

But one of the things that matter more than the platform that runs the project is how you organize it. For example, with PHP it is easy to create spaghetti code, and unless you make the conscious effort to organize your code, you will soon find yourself trying to maintain a tar of mess. When I first started with .Net I tried to approach it with the same process I did with PHP, but now I stop myself and try to not figure out how to convert from PHP to .net. Instead I try to find how .Net tackles this type of problem.


There are no comments added yet.

Let's hear your thoughts

For my eyes only