Which language separates code and HTML more readable?
Hello!
Is it JSP or Perl? I was learning and coding PHP for about 6 months and I start hating it. It's like for little kids, plus it doesn't separate HTML and the code itself which makes everything a bloated mess. So I started to think what else do we have for normal web-programming. Java for Web sounds very interesting. How readable is it compared to Perl? Is it also separated from HTML? |
Hi there,
Quote:
Quote:
So I'm convinced that the clarity and structure of code isn't a matter of the programming language, but a matter of the programmer's discipline. [X] Doc CPU |
I have used all of what you've mentioned, and quite a but more, extensively for web pages. Since you appear to have mixed elements in your question, that tend to be used at different levels in web page applications, I'm not quite sure what you're going for here.
I can say, that I have seen plenty of JSP's and so called JSP documents, that are rather painful to read. I much prefer an approach than uses something like Velocity Templates. Instead of nesting several "languages" all delimited with "<" and ">", Velocity uses the much more visually distinctive "#" to introduce its VTL ( Velocity Template Language ) elements. Also, although JSP's allow embedded Java, including conditional statements to further conditional the use of elements in a JSP, Velocity does not. The tendency is for people to write cleaner files. |
So you're saying there is no separation of code and layout in PHP/Perl/JSP? There are little pieces of information on different forums where people say something like "PHP's biggest problem is that it can't separate code and layout". Something like that. And it sounds like others can do it. What do those quotes mean?
And there is one more thing that makes me hate PHP: it has 4000+ functions and they have no system in naming. Man! How many sort function of PHP are out there? Such a mess you will never remember in your life. So if Perl or JSP have something more beautiful and readable for eyes, I wanna go with one of them. Recently I read some examples of Perl working with MySQL DBs - so clean. Looks several times cleaner than PHP's working with MySQL. |
There are ways to build PHP classes that could clean the code, also using good HTML layout helps (use CSS divs layout rather than tables)
|
Cedrik, thanks.
What about Ruby? How well is it suit for server-side web-development? |
Quote:
http://www.sitepoint.com/ruby-on-rai...k-at-the-code/ http://guides.rubyonrails.org/getting_started.html |
You want something with a server-side templating language.
Django (HIGHLY RECOMMENDED Python framework): https://docs.djangoproject.com/en/1.3/topics/templates/ ASP.NET MVC (C# framework for SQL Server/IIS deployment): http://www.asp.net/mvc/videos/mvc-3/...or-view-engine Mustache (available for most languages): https://github.com/bobthecow/mustache.php Google Closure templates (Java): http://code.google.com/closure/templates/ Twig (for PHP): http://twig.sensiolabs.org/ (And yes, Ruby on Rails and Velocity too. But that's been mentioned). |
I developed ONE website in Perl, and I was about to collapse at the end of it. No idea how lazy I am compared to others, but that's what happened to *me*. I had to put huge amounts of HTML in Print statements, it was an absolute NIGHTMARE.
I hadn't known much about PHP at that point, but then I did and started liking it, so I used it for my next site (which was finished about 1 yr. 6 months after the other one!!!!) Making pages which look artistic on the SERVER is, well, .... a fine art! I want more money for it than this kind of job currently pays, so..... My heart and soul is elsewhere, but I also can't resist the urge to tamper with the world from the corner of my bedroom (and my sites are GOING to do that, I'm going to MAKE them!) :) Just a little heart-to-heart, would appreciate yours! :) |
Just to add, something that occurred to me while I was reading dugan's Django page, as to where my heart IS - well, how about a *Flash* frontend communicating with a PHP script or whatever? :)
Would I end up a millionaire doing that? :) |
Quote:
Overall, in a sense, I prefer not to physically work harder, but instead to find a better way to do things. I tend towards automation, and/or code generation, as long as the result is at least as good as a Human could accomplish following "Best Practices". That usually leads towards something involving templates. One of the things I've done with which I was fairly happy, combined Velocity, HTML, CSS, Javascript, Java but not JSP's, and Perl. Java was used to write code to process data, once the data was past the web layer. Some of the Java code was hand written, and the CSS, but templates were also written, which could be used to create much Java code for the server side, as well as plenty of HTML and Javascript for the front end. A fair amount of the SQL for the server side was also generated from templates. Multiple layers of code in various languages were generated. Since they were done from templates, templates created by Humans, you wouldn't necessary be able to tell the hand crafted code apart from the generated code, if the generated code hadn't labeled as having been generated. Originally it was done in the early days of Velocity when we didn't necessarily have a lot of the other platforms we have today. But now we have a variety of the options which have already been mentioned. |
I think I found what I might need - Python.
Python was intended to be a highly readable language. It is designed to have an uncluttered visual layout, frequently using English keywords where other languages use punctuation. I'm a little surprised noone suggested this option... |
php can be written with a significant separation of code and HTML, if you use a templating engine like
phplib, which provides a templating engine http://sourceforge.net/projects/phplib/ smarty, another php based templating engine http://www.smarty.net/ in fact here is a list of 10 templating engines for PHP http://www.webresourcesdepot.com/19-...plate-engines/ separation of code and html really depends alot on how the program is written, not just on the language used. |
Thanks frieza.
But I am neither interested in templating engines nor in frameworks. Just a pure language. And no matter how well organized can PHP be - it's still disgusting. |
Thanks frieza.
But I am neither interested in templating engines nor in frameworks. Just a pure language. And no matter how well organized can PHP be - it's still disgusting. |
All times are GMT -5. The time now is 12:27 AM. |