3 ms·
The thing PHP and JSP were designed to do seems to be generally seen as a bad idea nowadays. PHP is used anyway only because it's already installed everywhere,
by ptx 12y ago
The thing PHP and JSP were designed to do seems to be generally seen as a bad idea nowadays. PHP is used anyway only because it's already installed everywhere, so those who would be able to set up JSP can also choose something else (i.e. neither PHP nor JSP) and probably do.
- tormeh 12y agoWhat would you use instead? Javascript fetching data from server and doing all UI stuff on client?
- superuser2 12y agoYou use a structured framework that has some separation of concerns (typically Model-View-Controller or some variant). In Java-world, some examples are Struts, Spring MVC, and Play, all of which can be used to write high-quality software for real-world applications. JSP might even be involved in the view/presentation layer. There are also MVC frameworks for PHP. The most popular, though, are those for scripting languages like Ruby and Python, namely Rails and Django. What you shouldn't be doing is interleaving data access, business logic, and presentation all in one file, which is what straight PHP and JSP usually consist of. This is called "spaghetti code" and it's been widely regarded as a really terrible practice for around 10 years. You can do client-side apps in Javascript that fetch JSON or XML from the server, but you want to be using a framework with some structure to serve the data, still not just straight PHP or JSP.
- dragonwriter 12y ago> What you shouldn't be doing is interleaving data access, business logic, and presentation all in one file, which is what straight PHP and JSP usually consist of. This is called "spaghetti code" and it's been widely regarded as a really terrible practice for around 10 years. "spaghetti code" actually has a much broader definition than that particular kind of lack of structure (though I agree that that example might be viewed as a fairly modern example of "spaghetti code") and has been considered a terrible practice for much longer than PHP, JSP, or even the web itself has existed. [1] [1] http://en.wikipedia.org/wiki/Spaghetti_code http://en.wikipedia.org/wiki/Spaghetti_code
- Arnor 12y agoIf all you're looking for is an html template system, there are html template languages for almost every programming language (including ruby, python, nodejs, Scala, Haskell, C, C++). Even most PHP developers are using template systems besides just PHP intermingled in HTML these days. I still agree that PHP is probably the fastest way to get a couple dynamic HTML pages that include server data. The limitations of PHP as a template language quickly reveal themselves as projects grow.