View Poll Results: Which programming language do you prefer when it comes to creating web pages?
- Voters
- 98. You may not vote on this poll
-
Java
4 4.08% -
Ruby On Rails
3 3.06% -
ASP.NET
6 6.12% -
PHP
63 64.29% -
PERL
9 9.18% -
PYTHON
4 4.08% -
C++
0 0% -
No Programming - HTML Only
3 3.06% -
Other
6 6.12%
Results 51 to 70 of 70
Thread: What's your language?
-
07-10-2008, 01:05 AM #51Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
Where is the 'anything but PHP' option? PHP is a dog from hell, almost all the tutorials on the net are crap, and it lends itself to amateurs trying to be programmers, which means 90% of the time when you are given PHP code to clean up it will be a horrible insecure spaghetti mess of mixed logic and very_long_function_names, er, sorry, real_very_long_function_names.
It got one thing right, and that was ease of deployment. For people who have to use shared hosts, it's ideal. Using it myself on a platform I control is inconceivable (and with WebFaction and Amazon's platform, even on platforms I don't control now. yay!) Everything else is better. Perl, Ruby and Python are better languages, Java has insanely better tools...okay, not C++, but that shouldn't even be in the discussion.
-
07-10-2008, 01:12 AM #52Retired Moderator
- Join Date
- Sep 2004
- Location
- Flint, Michigan
- Posts
- 5,766
█ Mike from Zoodia.com
█ Professional web design and development services.
█ In need of a fresh hosting design? See what premade designs we have in stock!
█ Web design tips, tricks, and more at MichaelPruitt.com
-
07-10-2008, 01:29 AM #53WHT Addict
- Join Date
- Dec 2005
- Posts
- 106
I pick 8. No Programming - HTML Only
My team do the rest.Europe Internet Services www.snappedstick.com
-
07-10-2008, 01:33 AM #54Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
PHP does a lot of things that are well known and inexcusable in a modern language. The most glaring one, that I alluded to, is the lack of namespaces until like, RIGHT NOW. This is why PHP doesn't have nice packages and you have to name everything like my_module_blah_blah so you don't have collisions. I mean, this is stuff I'll take from C, which was created in the '70's...but PHP? Speaking of functions, there are approximately eleventy billion built in, many of which duplicate features(why do I need join and implode again?), have inconsistent naming, parameter order, etc..
Furthermore, it's weak, weak, weak. There are no first class functions, there are no closures...at least it finally got a decent OO implementation stuck in there. Compared to the things that those languages offer PHP is, to use JWZ's phrase, about as expressive as 2 cups and a piece of string. Java is a pretty sucky language too, especially since the generics mess they made, but it has tool support that is second to none as far as I can tell, which helps make up for it.
The PHP community's ideas about security are also not exactly highly regarded. The php.ini idea was a horrible error, both in spirit, because the language working differently at runtime based on a configuration file is a horrible idea, and in practice, because it makes it harder to move from host to host, unless you can set you own custom php.ini, in which case you've just outsourced the complexity tax to your host, but it still sucks.
It's not really fair to compare PHP to a real language, since it's a niche language after all -- its only use is in web scripting and templating.
A bad app is a bad app I agree. But some languages help you more than others. PHP makes it very, very easy to write bad apps, and based on my experience, a hell of a lot of people take it up on that offer.
-
07-10-2008, 05:38 AM #55Disabled
- Join Date
- Jul 2008
- Posts
- 25
i like php as it works great with many types of databases. easy to use and works on most if not all hosting plans clients or your self have
i also plan to learn JAVA soon as it the best one for a new site i am going to be making
-
07-10-2008, 07:14 AM #56Web Hosting Master
- Join Date
- Aug 2004
- Location
- Shanghai
- Posts
- 1,475
Face it, the only language that interfaces well with the web server is PHP. Look at Java, and the way you have to configure tomcat. NO WAY you can run that in a shared hosting server. True, there are some efforts for other languages (like python), but it's not as successful as PHP. No other language was MADE for the web servers, all were ADAPTED, which is the wrong way of doing things.
And ok, there are some issues with PHP itself, but really, I don't agree saying that the problem is OOP, or namespaces. YOU think it's a problem, because you like them. But that's not the case for everyone. I personally think that using namespaces is not a good idea, and I see no problem in using long function names. I also think that most of the people that use objects don't know how, and that the resulting code is most of the time totally stupid. See something like this:
PHP Code:class page{
var $content;
function addContent($txt){
$content .= $txt;
}
function printContent(){
echo $content;
}
}
$myPage = new page();
$myPage->addContent("Bla!<br>");
$myPage->addContent("Bli!");
$myPage->printContent();
PHP Code:$page = "Bla!<br>";
$page .= "Bli!";
echo $page;
ThomasGPLHost:>_ open source hosting worldwide (I'm founder, CEO & official Debian Developer)
Servers & our leading control panel and our Xen VPS hosting, which are already included in Debian and Ubuntu
Available in: Kuala Lumpur, Singapore, Sydney, Seattle, Atlanta, Paris, London, Barcelona, Zurich, Israel
-
07-10-2008, 02:55 PM #57Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
As I said, the one thing PHP got very right is deployment.
The trivial problem with long function names over namespaces is that they are longer to type and ugly. The worse problem is that it means you are constantly having to be on the lookout for naming collisions. If you are just hacking away by your lonesome whatever, keep it all in your head. When you work in teams scattered all over the place or want people to contribute, it's a pain in the *** to not have a good way to do modular organization. Why would I want to have to have a bunch of subtly differently named functions just because the language 'designers' (the idea expressed by someone else, that PHP was 'designed' is laughable) didn't see the need for namespaces that basically every other modern language designer has?
Classes are not about 'showing off' they are about combining data with methods that act on data in a natural way, about encapsulating that data, about code reuse, etc.. I mean, this isn't even a discussion. OO has, at this point in time, won, and if you don't know why and when to use it you are just a ****** programmer. That's not to say it's the best or a perfect paradigm...but until we start moving toward functional programming(which is happening in the better mainstream languages) it's here to stay.
-
07-10-2008, 11:25 PM #58Web Hosting Master
- Join Date
- Aug 2004
- Location
- Shanghai
- Posts
- 1,475
OO has, at this point in time
Why a class is more reusable than a function? I never understood it, I think it's fake, only praised by people that don't understand what OO is really about. Apart from that, I really agree with you when you say:
combining data with methods that act on data in a natural way
So yes, use OO WHEN it's needed, but not ALWAYS as I see it too often. Use the CONCEPTS of OO when you need them, don't use them when the result is not a cleaner code (see my example). That was what I wanted to write, nothing more, really!
ThomasGPLHost:>_ open source hosting worldwide (I'm founder, CEO & official Debian Developer)
Servers & our leading control panel and our Xen VPS hosting, which are already included in Debian and Ubuntu
Available in: Kuala Lumpur, Singapore, Sydney, Seattle, Atlanta, Paris, London, Barcelona, Zurich, Israel
-
07-11-2008, 12:04 AM #59Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
Last edited by Edevere; 07-11-2008 at 12:09 AM.
-
07-11-2008, 01:01 AM #60Web Hosting Master
- Join Date
- May 2004
- Location
- Toronto, Canada
- Posts
- 643
asp.net c# all the way! wuhuuu. lol.
█ Hussain Baig - 1-866-954-6747
█ Toronto based VPS - Dedicated Servers - Colocation
█ VPS Fusion - Providing scalable and reliable hosting solutions.
-
07-11-2008, 01:06 AM #61Web Hosting Guru
- Join Date
- Apr 2006
- Location
- Mandaluyong, Philippines
- Posts
- 316
Well, global meaning something in a storage structure that can be passed to a function, or global variables?
For instance, I could :
Code:volatile unsigned int some_var = 0; char *some_var = "some string"
Code:typedef struct { volatile unsigned int some_var; char *some_other_var; } mystorage_t;
Code:int main(void) { mystorage_t *store; store_init(&store, someint, somestring); /* inherits what store_init did and can pass it to others */ my_function(&store); /* de-allocate anything store_init() allocated */ store_finit(&store); return 0; }
I never really saw the need for classes.
You could take that a step beyond and store pointers to other functions within the structure, sort of like:
Code:typedef int * (* class_entry_t)(char **, somestruct_t *);
Code:typedef struct { volatile unsigned int some_var; char *some_other_var; class_entry_t entry; } mystorage_t;
Code:store.entry(argv, &somestruct);
That's just an off the hip example that should be more clear and neater, my only point is that globals are not needed for functions to inherit the results of other functions.
Although, in PHP or other 'high high' level languages, this is rather difficult. What is alarming is that OOP is becoming some kind of defacto standard where 'no code is good unless object oriented' .. and that opinion is juxtaposed on languages that offer better facilities to the programmer.
In the case of (but not picking on) PHP try a little test. Write 2 scripts that basically produce 'hello world' in various ways. One being a function or two, one being a class.
Head them with #!/usr/bin/php and run them via shell through valgrind, i.e.
valgrind ./helloworld.php
Look at the actual heap allocation (and leaks) in both instances. You'll see what I mean Some of the errors you'll see are trivial, some aren't.
But, most OOP fanatics really don't care what their code actually _does_ to a computer, they just care that it works and is easy to read.
-
07-11-2008, 01:24 AM #62Newbie
- Join Date
- Jun 2008
- Location
- Chennai, India
- Posts
- 13
For a free-to-use, easy-to-learn and easy-to-develop robust experience, PHP stands out great and no doubt its the choice of the most people.
As for JAVA, it's also really good.
-
07-11-2008, 01:47 AM #63Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
"But, most OOP fanatics really don't care what their code actually _does_ to a computer, they just care that it works and is easy to read."
I'm not an OOP fanatic by any means, I'm just saying there's a reason that the most popular languages all support that paradigm(some excessively so...looking at you Java). Optimizing "hello world" at the level of the heap is premature by any measure. As The Deity has stated, "premature optimization is the root of all evil" and as The Bible states "programs must be written for people to read, and only incidentally for machines to execute." I mean, unless you're programming an embedded system or doing some kind of real-time work, worrying about the overhead of creating objects is almost always pointless.
You can add function pointers to some struct and fake OOP, sure, but how much more work do you have to do to get encapsulation? And then when I want to let someone else extend mystorage_t with two other structs like that to combine them into one? Polymorphism? Etc. etc.
I completely agree that you can abuse it, and you shouldn't need to declare any classes to print 'Hello, World' (hi again, Java). If potential for abuse is the standard I could argue for the removal of the C preprocessor, which has led to some of the greatest abuses ever conceived by man, woman or child.
-
07-11-2008, 01:47 AM #64Web Hosting Guru
- Join Date
- Apr 2006
- Location
- Mandaluyong, Philippines
- Posts
- 316
Actually guys I just did it , below are two scripts that effectively do the same thing by saying hello to the world:
This is script 1:
Code:tpost@tower:~ $ cat hello.php #!/usr/bin/php <?php print("Hello, world.\n"); ?>
Code:tpost@tower:~ $ cat hello1.php #!/usr/bin/php <?php class Hello { var $hello; var $world; function PrintHello() { print($this->hello); print($this->world); } function HelloWorld() { $this->PrintHello(); } } $test = new Hello; $test->hello="Hello, "; $test->world="World.\n"; $test->HelloWorld(); ?>
Code:==12062== ERROR SUMMARY: 78 errors from 15 contexts (suppressed: 155 from 1) ==12062== malloc/free: in use at exit: 2,082 bytes in 18 blocks. ==12062== malloc/free: 17,925 allocs, 17,907 frees, 1,137,889 bytes allocated. ==12062== For counts of detected errors, rerun with: -v ==12062== searching for pointers to 18 not-freed blocks. ==12062== checked 1,032,664 bytes.
Code:==12067== ERROR SUMMARY: 78 errors from 15 contexts (suppressed: 155 from 1) ==12067== malloc/free: in use at exit: 2,082 bytes in 18 blocks. ==12067== malloc/free: 17,988 allocs, 17,970 frees, 1,152,675 bytes allocated. ==12067== For counts of detected errors, rerun with: -v ==12067== searching for pointers to 18 not-freed blocks. ==12067== checked 1,032,680 bytes.
Such things you probably _want_ in a class, otherwise how would using them be practical .. however the idea of 'pure OOP being better' is nonsensical.
-
07-11-2008, 01:56 AM #65Junior Guru Wannabe
- Join Date
- Jul 2008
- Posts
- 51
Fortunately nobody every claimed that 'pure OO was better.' What's nonsensical is measuring 'better' by trivial differences in the amount of memory that is allocated by the most trivial of scripts that has no cause to have a class. If you're optimizing for 14k of allocated memory instead of programmer efficiency and conceptual clarity, you're doing it wrong.
-
07-11-2008, 02:17 AM #66Web Hosting Guru
- Join Date
- Apr 2006
- Location
- Mandaluyong, Philippines
- Posts
- 316
I think much of the problem is that there are no peer reviewed standards for high high level languages. Many who spark these trends have never (or rarely) used lower level, or low level languages.
It was just an example to illustrate that classes are indeed more expensive. While premature optimization is the root of all evil, realizing how people are going to actually use the stuff that you write is also important.
If you are writing a blog in PHP, you should understand that someone will hope for it to serve 400 clients at once while competing with other over allocating processes hungry for memory. That's not really optimization, its just polite
I reviewed a patch for something a week ago which was just ugly, using a bloated class where 2 simple functions would have done it. When I asked the guy "err, why so much code?" he replied that he was worried about people complaining that he didn't use a class.
Thats just scary.
-
07-11-2008, 02:20 AM #67Web Hosting Guru
- Join Date
- Apr 2006
- Location
- Mandaluyong, Philippines
- Posts
- 316
I wasn't implying that anyone here claimed that However, many people do.
I also wasn't suggesting that someone optimize for 14k of memory. The examples were trivial just to show that there is a difference.
Take a much larger class in the same type of scenario and you would see a much larger difference.
-
07-11-2008, 03:12 AM #68Web Hosting Master
- Join Date
- Aug 2004
- Location
- Shanghai
- Posts
- 1,475
As I wrote earlier, you don't need the language to know about objects and classes, to work out with them. I wrote some polymorphism in assembly 68000, with some very fast jump table (tables containing the number of bytes to jump to get to the right function). Same goes for most concepts of OOP.
The most important thing is to UNDERSTAND the CONCEPTS and use them WISELY. Abusing them and saying that only methods are the only to be good (and functions stupid) is a non sense, IMHO.
ThomasGPLHost:>_ open source hosting worldwide (I'm founder, CEO & official Debian Developer)
Servers & our leading control panel and our Xen VPS hosting, which are already included in Debian and Ubuntu
Available in: Kuala Lumpur, Singapore, Sydney, Seattle, Atlanta, Paris, London, Barcelona, Zurich, Israel
-
07-11-2008, 03:59 AM #69Web Hosting Guru
- Join Date
- Apr 2006
- Location
- Mandaluyong, Philippines
- Posts
- 316
Code:<?php class Wht { var $who; var $what_they_did; var $how_much_they_suck; var $how_much_i_lost; var $filing_chargeback; var $suing_them; var $i_want_my_mommy; var $i_paid_less_than_five_bucks; var $losing_per_hour; ..... $gripe = new Wht; $gripe->suing_them = true; $gripe->filing_chargeback = true; $gripe->i_want_my_mommy = true; if ($losses < 10) { $gripe->losing_per_hour = 10000; $gripe->i_paid_less_than_five_bucks = true; } $gripe->Post();
Sorry, could not resist Please don't hurt me ....
-
07-11-2008, 04:35 PM #70WHT Addict
- Join Date
- Mar 2006
- Posts
- 161
PHP all the way I say, lol