For web based applications, why doesn’t PHP need middleware to run – yet languages like Java, C#, etc do?
UPDATE:
Re-worded: Why doesn’t PHP need a middle tier, or business layer separating it from the database, whereas the others do.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that by the term “middleware” you mean “a middle tier”, or “a business layer” the answer is that none of them need it.
For example, there is nothing to stop you in C# (or more correctly, on the .Net Framework “stack”) from writing code in web pages that directly accesses the database. Indeed, lots of prototypes start out this way.
The issue here is more around good practice – it is generally considered A Bad Thing(tm) to write web pages (sticking with the same example) that directly access the database and the reasons for this are many. Testability, security, good decoupled code – all these require you to separate your code out, and having several tiers is a natural way to do this.
Why do you not see as much of this with PHP? I think Jeff’s latest blog post covers this well 🙂
I’d go as far as to say that C# (the language), .Net (the Framework), ASP.NET (especially ASP.NET MVC) and much of the documentation and tutorials encourage you to do the right thing and not punch a whole from the web page through to the database.
But there isn’t actually anything stopping you from doing it.