When I look at ASP.NET MVC projects I everytime see loose coupled architecture.
For what do I need a loose coupling in a web architecture (if I do not make unit tests)?
What are advantages and disadvantages of this?
What is the main reason to decouple layers/classes?
What if I do not want to change my DAL for example? I mean when shall I change my whole DAL?! So I could couple my DAL to the UI. What is bad with this?
A loosely coupled architecture will help you when your application needs to change or grow. And any non-trivial application will eventually need to change or grow.
If you design with a loosely coupled architecture, only a few parts of the application should be affected when requirements change. With a too tight coupled architecture, many parts will need to change, and it will be difficult to identify exactly which parts will be affected.
One of the main benefits of TDD, in my opinion, is that at helps promote a loosely coupled architecture.
Because the stuff in the back might be useful even if it's not communicating with a browser-based, HTTP web UI. So you want to be able to disconnect it from that particular UI.
Responding with an angle noone else discussed; temporal decoupling. It can be done in a few ways:
When using the above (except the async monad), you often deal with messages explicitly rather than method invocations. This leads to thinking correlating with how message passing works (idempotence of handling them, queues for storing them in transit, security data attached to their envelopes, retry logic in handlers rather than requestors, ...).
By moving towards message-oriented architectures that are temporally decoupled you can make it easier to extend the application - especially if you have mostly doing publish-subscribe (see also, event driven architecture) - anything may listen to events and react on them and you don't bind the implementations of integrators to the initial call sites.
Web sites that push work onto queues are more responsive in general, because they don't let worker threads hang around waiting for IO to happen. They are also often cheaper to maintain in the long run.
For different types of compile-type coupling (and other metrics), browse http://www.ndepend.com/Metrics.aspx and read some about it yourself.
Loose Coupling allows you to make changes in one area of the application without affecting the others. Theoretically it allows you to do things like change your Data Access Layer without rebuilding your Business or UI Layers.
It definitely makes your applications more flexible, more adept at change, and easier to maintain (since you don't have to worry about a change in one area of the application breaking another).
I think that the "right" way was explained in the other answers. But I'll write now from my own experience.
There are few things that you must take into account when deciding an architecture.
a. Client
Do you have enough time to make everything the "right" way (great architecture, tests, etc...)? Sometimes the client wants to see results quickly. We can complain that the time is short, and the product will not be at the highest standards, but in the end that is our problem. In this situations we explain to the client what he will get, and write the spaghetti code that we all know.
What are the clients requirements (in terms of reliability, scalability, expand-ability, speed)? I think this is self explanatory. Sometimes the client dictates the "right" way. We can offer the client the "right" way, but in the end the client will decide (depending of time and money of course).
Who will support the system after you have developed it? I would like to support a nice and decoupled code. So when I write the code I'm giving my best to make it "right". Sometime I might couple the view and the controller or couple some service and be happy with it. Knowing my own code it is easy to support it.
b. Project
What is the size of the project? Some projects are so small that any complicated architecture is not warranted.
Is there a chance for the software to rapidly grow in the future (more features)? This is one of the biggest challenges. But if the software grows it means that it is a success. You would probably have more resources to work with. It is relatively easy to refactor your code and make it "right".
Will the project potentially have scalability issues? There are projects which are never gonna grow, in terms of users and data. I've seen projects which are trying to look serious by using an Oracle RAC database setup, when a simple embedded database would work just fine!
Did you start the project or you are taking it over from other developers? This is a combination of the questions of who will support the software and will the software grow. You might get a spaghetti code from other developers. Will you have the time and resources to make it "right"?
c. Development team
Is the team experienced enough to make the decoupling right? When I was less experienced, I have tried to write the "right" code. And I have failed. The point is to really know your development team, their skills and knowledge. Don't underestimate this issue. When working with less experienced developers, I usually make some sacrifices to the architecture. The sacrifice that will be made is the best educated guess that I have. There are some points from the architecture that you can sacrifice and there are some that you cannot. Usually one or more sacrifices you have made earlier will came back and bite you.
Are the developers experienced writing automatic tests? It is not enough to have automatic tests. They should be complete (as much possible) and done right. If your tests are weak, than you better not have them at all. You wouldn't want to lean on a wall full of holes.
Conclusion:
I know that we all want to be professionals. And as professionals we must take all things into account. We cannot waste our time and energy on doing things the "right" way. Sometimes we must look at other factors (reality) and make our choice. And the most important thing is to live with it.
It all depends on the intent of making the Application along with the business interest. If business is keen to scale it and enough fuel (read corpus) is involved which gives enough thought to the architect to make the application reap long term benefits.
So the advantages are :-
1) If you are using a third party control/code : Always write a "wrapper/adapter layer" so that for any reason if that is not usable you can get something else and change the adapter layer without disturbing your application repository code.
2) Encapsulating specific complex functionalities in a "Service Layer" which may or may not require database requests : Its beneficial because as the request and response remains the same (it can surely change with time as well), you can always work on the performance of that specific code without changing the output. With unit cases in place we can also measure the performance of the code.
3) Making specific roles write specific code : If we create a lot of roles, it comes easier for people in the team to focus in their specific repository instead of getting lost in the pile of not related code.
4) Focussed QA : If we have layered architecture, it always helps to better the QA as its focussed.
5) Finding/Solving Bugs : Using layered architecture and assuming you have good logging in place, it always saves time to find the bugs and resolve it.
Disadvantages are :-
1) Setting up an application with this kind of framework will take extra time. So "go to market" will be delayed.
2) If you get too technology enthusiast it might end up in over kill.
3) Extra transaction latency: As the data travels through various layers there is extra latency which gets added in each transaction.
About changing the DAL :-
Of course there will be a time, when performance will take priority over features at that time you will have to start considering your data providers leading to the change in DAL.
If you couple your DAL to your UI, everytime you change your DAL (if at all, when at all) you always would require to re-release the entire binaries in production. Which has its own set of issues (am shying away to explain it here, if you require I can always include that)
That's the reason, initially its always better to spend time and conclude when will the "self destruct" happen for the application. I meant what's the life of the Application, if this is answered well, rest everything will fall in place.