Question:
A more object-oriented alternative to PHP?
Matthew Miller
2011-09-25 10:12:50 UTC
Is there a better language than PHP for server-side scripting? I love PHP, but after two years of Java for college, I am also in love with object orientation. I understand that PHP 5 has support for classes and objects, but it is not a natural construct and it feels weird trying to program in classes when all the built-in functions you use aren't.

I have tried ASP before but I couldn't stand it; making a simple database connection is far too unnecessarily difficult. What other OOP web server languages are there?
Six answers:
raina_vissora
2011-09-25 10:31:01 UTC
Ruby on Rails, I suppose, would be an alternative, in terms of web scripting. Personally I prefer PHP to Ruby, but it's really just a matter of opinion.
peteams
2011-09-25 11:03:48 UTC
Java can be used for the server side stuff, so I would look at its features.



If you want a truly object-oriented system I'm afraid that might mean looking at ASP.NET. You say you tried ASP, which was the older version of ASP.NET, and didn't like it. If you didn't mean ASP.NET, then ASP and ASP.NET are very dissimilar.



"Traditional" web development tends to involve interspersing HTML and another language. Under the hood something mucky is going on, the HTML is being converted into a write statement. This is a very procedural way to work, but is simple to implement.



ASP.NET can be used to implement code the old way, however it also supports a far more object-oriented fashion. The pages are merely templates that wrap themselves around an object model. The code behind the page merely exposes the object model that the page wraps itself around. As the code behind is just exposing an object-model it can be unit tested really easily and thoroughly. Because the pages contain no code, they can be radically restyled and restructured without touching the code behind.



You may also find that ASP.NET database connections are easier than you remember. Normally you just sign into the database in the server explorer and then drag the connection into your project.
SteveO
2011-09-25 10:13:44 UTC
You can try Ruby or Python, although not necessarily server scripting languages.
Silent
2011-09-25 10:17:11 UTC
Why not use Java, since you already know it? Plenty of Java web applications out there.
anonymous
2011-09-25 10:45:21 UTC
look into COBOL. It's 2002 standard has support for object-oriented programming.
bonni
2016-12-02 07:27:52 UTC
considered one in each of my pals brother has used a ingredient referred to as pidgin it is very lots msn in a distinctive format even interior the adventure that your human beings use msn pidgin will in spite of the undeniable fact that assist you chat with them it form of appears like an very nicely option


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...