Web Hosting Talk







View Full Version : Which programming language do you prefer?


Fremont Servers
07-22-2002, 02:26 AM
Hello,

I'd to see which programming language do you prefer for web related applications/programs, and which will be highly used in the future?

1. JSP
2. ASP
3. CFM
4. CGI
5. PHP


There are more, but I just want to see the future of these five (5).
Or if there is one that you know will be popular, just post it.

If you could analyze the advantage of each, then it would be great.

fractiousws
07-22-2002, 02:29 AM
I would have to say PHP all the way, CGI is a close second. ASP is buggy.

Synthetic
07-22-2002, 02:32 AM
There's been a rapid growth in the use of PHP and I'm sure this'll continue on into the future.

Jedito
07-22-2002, 02:35 AM
CGI its not a language

Fremont Servers
07-22-2002, 02:39 AM
Jedito,

How about Perl

Jedito
07-22-2002, 02:43 AM
hehehe, Yes, Perl is it a language..
Althrough I'm not a programmer, and I'm far from there, I'm learning JSP and PHP

esdjco
07-22-2002, 02:49 AM
1. PHP
2. PERL
3. JSP
4. CFM
5. ASP

I've developed with the top three and they are listed in that order out of personal preference.

Fremont Servers
07-22-2002, 03:02 AM
Could you tell me the advantage of PHP over the others. What is so unique about PHP?

If you were to choose a language above to build your business infrastructure, would you still choose PHP over the others.

esdjco
07-22-2002, 03:05 AM
7 Reasons Why PHP is Better than ASP (http://php.weblogs.com/php_asp_7_reasons)

Fremont Servers
07-22-2002, 03:14 AM
Ok..I'm convinced PHP over ASP.

How about PHP and Cold Fusion?

Also, is there anything unique about JSP that others can't do or not very flexible in doing it?

esdjco
07-22-2002, 03:17 AM
Google

shaunewing
07-22-2002, 03:47 AM
In my order of preference:
PHP
Perl
ASP
CFM

I've never used JSP so I couldn't comment on that.

PHP I find the most versatile and it's good for building quick applications that aren't resource intensive.

Perl is also a good language, but can be quite temperamental.

ASP is easy to use but unless you're using Windows it is expensive to implement.

CFM I used briefly but I never really liked it all that much. It is also expensive to implement regardless of OS.

--Shaun

WebmastTroy
07-22-2002, 04:02 AM
I will admit, PHP does look like a nice programming language, but I'm a Perl guy, so I need to stick with it. :D

chirpy
07-22-2002, 04:36 AM
Perl, as it does everything I need it to from a product/script development and delivery standpoint. In the future I'll look at PHP in more detail.

Wouldn't it have been more beneficial to make this a Poll? :)

Steve-PWH
07-22-2002, 06:03 AM
Originally posted by Jedito
CGI its not a language

Tell them

GET THIS THOUGH YOUR HEADS

CGI is a interface

Steve-PWH
07-22-2002, 06:05 AM
Originally posted by chirpy
Perl, as it does everything I need it to from a product/script development and delivery standpoint. In the future I'll look at PHP in more detail.

Wouldn't it have been more beneficial to make this a Poll? :)

You will also note that PHP was based on PERL :)

And not includes PERL regexps systems

i.e. any functions starting with preg_

Fremont Servers
07-22-2002, 06:08 AM
Originally posted by Steve-PWH


Tell them

GET THIS THOUGH YOUR HEADS

CGI is a interface

Steve,

Really? Isn't I stands for Income :rolleyes:

JTY
07-22-2002, 12:54 PM
PHP

And, the option you didn't give... Expect :)

dynamitehost
07-22-2002, 03:31 PM
Definately got to be PHP. I spent a few months learning and messing around with perl... and I still wasn't very good at it, and i've learnt how to write my own MySQL & PHP forums script in roughly the same amount of time :)

I must say one thing about ASP, its bugged, just like all of microsofts products.

weeps
07-22-2002, 04:12 PM
Originally posted by Steve-PWH


You will also note that PHP was based on PERL :)

And not includes PERL regexps systems

i.e. any functions starting with preg_


http://www.php.net/manual/en/function.ereg.php
http://www.php.net/manual/en/function.eregi.php

http://www.php.net/manual/en/function.ereg-replace.php
http://www.php.net/manual/en/function.eregi-replace.php

http://www.php.net/manual/en/function.preg-grep.php
http://www.php.net/manual/en/function.preg-match.php **
http://www.php.net/manual/en/function.preg-quote.php
http://www.php.net/manual/en/function.preg-replace.php
http://www.php.net/manual/en/function.preg-split.php

The Prohacker
07-22-2002, 05:02 PM
PHP is great for doing web sites, and scripting...

I still use perl a bit for stand alone apps that don't have web intereaction...

I personally prefer PHP over Perl, but both have their good and bad points....

iamdave
07-22-2002, 05:14 PM
I would have to say PHP and ASP, both are very easy to learn and to catch on to...

YUPAPA
07-22-2002, 05:40 PM
PERL PERL PERL!

secludo
07-22-2002, 06:37 PM
PHP and Perl.

mwatkins
07-22-2002, 06:43 PM
Python. Sorry, you can't miss the best off your list.

Aside from all its other good attributes, its named after the good folks who brought us "Knights Who Say Ni !" and "Killer Rabbits" and the "Blanc mange!"

However, since you are asking the question, invariably you will learn PHP on Unix or ASP on Microsoft that that will be that, unless you have a sense of adventure or specific purpose in mind.

-- Mike "I didn't expect the Spanish Inquisition" Watkins

Ahmad
07-22-2002, 11:10 PM
Originally posted by Steve-PWH


Tell them

GET THIS THOUGH YOUR HEADS

CGI is a interface

Actually, CGI is a language.

Ahmad
07-22-2002, 11:12 PM
Originally posted by Steve-PWH


You will also note that PHP was based on PERL :)

And not includes PERL regexps systems

i.e. any functions starting with preg_

Only partly, PHP has lots of things from C and Java. Prefixing the variable names with the dollar sign is probably the biggest thing PHP got from Perl.

Most of the syntax and fuction names are from C.

Ahmad
07-22-2002, 11:17 PM
I learned Perl first myself, and wrote many scripts in it then I left it for PHP.

PHP is great.

JSP is very good for large projects with many advanced web features, but it is too complicated and resource intensive for small applications.

That for web development.

But generally, I think Python is the best!

Fremont Servers
07-22-2002, 11:29 PM
Like for andale.com, would you still use jsp to create a site and services like that, or would it be better if you use php to create those kind of site.

FDrive
07-22-2002, 11:40 PM
Python!

Fremont Servers
07-22-2002, 11:50 PM
Do you have an example of Python for me to take a look at?

alpha
07-23-2002, 12:24 AM
Originally posted by Asia
Do you have an example of Python for me to take a look at?

Here's couple of links that you can look at for testing the waters ;)
http://www.python.org/doc/Newbies.html

neil
07-23-2002, 12:31 AM
my vote: php - runner up: perl

zRedDice
07-23-2002, 12:31 AM
What does 'e do? Nibble your bum? ;)

I've never used Python, so I wouldn't know... :)

Originally posted by mwatkins
Python. Sorry, you can't miss the best off your list.

Aside from all its other good attributes, its named after the good folks who brought us "Knights Who Say Ni !" and "Killer Rabbits" and the "Blanc mange!"

However, since you are asking the question, invariably you will learn PHP on Unix or ASP on Microsoft that that will be that, unless you have a sense of adventure or specific purpose in mind.

-- Mike "I didn't expect the Spanish Inquisition" Watkins

Ahmad
07-23-2002, 12:42 AM
Originally posted by mwatkins
Python. Sorry, you can't miss the best off your list.

Aside from all its other good attributes, its named after the good folks who brought us "Knights Who Say Ni !" and "Killer Rabbits" and the "Blanc mange!"

[snip]


Besides, it is the only language mentioned here that have a name that passes a spell checker. :D

fractiousws
07-23-2002, 12:56 AM
Just to clarify...

Common Gateway Iterface

MaB
07-23-2002, 01:37 AM
I vote Perl
IMHO: ASP and PHP are perl wanna-bes

Ahmad
07-23-2002, 09:04 AM
Originally posted by fractiousws
Just to clarify...

Common Gateway Iterface

Is HTTP a language?

shaunewing
07-23-2002, 09:07 AM
Originally posted by Ahmad


Is HTTP a language?

No, it's a protocol... Hypertext Transfer Protocol :)

--Shaun

Ahmad
07-23-2002, 09:16 AM
Originally posted by shaunewing


No, it's a protocol... Hypertext Transfer Protocol :)

--Shaun

And what is a protocol?

shaunewing
07-23-2002, 09:25 AM
Originally posted by Ahmad


And what is a protocol?

I'm guessing you're now being sarcastic :D

Anyway, from dictionary.com: "A standard procedure for regulating data transmission between computers"

:)

--Shaun

Ahmad
07-23-2002, 09:37 AM
Actually, I know where I'm heading since I said CGI is a language. ;)

Is XML a language?

How can you decide what is a language and what is not a language?

MaB
07-23-2002, 09:42 AM
Originally posted by Ahmad
Actually, I know where I'm heading since I said CGI is a language. ;)

Is XML a language?

How can you decide what is a language and what is not a language?

A protocol is a common command set (i guess you can say) shared between the client and the server no matter what OS or browser or server software.
For example,
netscape says to apple.com: please give me /index.html
apple.com: here is /index.html

every browser and server has to use the same protocol or they wont know how to talk. If netscape said: give me index.html now punk! the server wouldnt understand the commands because its not in teh protocol. Protocols are universal and shared by every client and server


The programming language is the back end to a website - its the developers way of making the output.
The difference can be perl saying:
print "HI";
and another language saying:
out "HI";

either way the server sends back the same data, but the way the program generates what to send back is the programming language.

Ahmad
07-23-2002, 09:48 AM
Originally posted by MaB


A protocol is a common command set (i guess you can say) shared between the client and the server no matter what OS or browser or server software.
For example,
netscape says to apple.com: please give me /index.html
apple.com: here is /index.html

every browser and server has to use the same protocol or they wont know how to talk. If netscape said: give me index.html now punk! the server wouldnt understand the commands because its not in teh protocol. Protocols are universal and shared by every client and server


The programming language is the back end to a website - its the developers way of making the output.
The difference can be perl saying:
print "HI";
and another language saying:
out "HI";

either way the server sends back the same data, but the way the program generates what to send back is the programming language.

I agree with the explanations.
But that was not my point.

Still, is XML a language?

MaB
07-23-2002, 09:49 AM
Originally posted by Ahmad


I agree with the explanations.
But that was not my point.

Still, is XML a language?

Yes X(something)M(Markup)L(language)

Kevin2001
07-23-2002, 09:53 AM
For me it's got to be PHP and then CGI.
IMO - I've found php to be alittle easier to get into production.

But I use both quite a bit.

- Kevin

Ahmad
07-23-2002, 09:54 AM
Originally posted by MaB


Yes X(something)M(Markup)L(language)

OK, it is: eXtensible Markup Language.
So it is a language, but it is not a set of commands is it?

MaB
07-23-2002, 09:57 AM
no:

ftp protocol example:
client: server are you alive
server: i am alive
client: send username password?
server: send away
client: username: XXX password: XXX
server: accepted
client: change to /web
server: changed
client: upload BLAH.html
server: done

that is universal and can be said for browsers too.

Now a programming language generates the output
The protocol is the communication between the client and the server so the server is sending the output of the langauge

mwatkins
07-23-2002, 11:10 AM
Originally posted by Asia
Do you have an example of Python for me to take a look at?

Here's something quick:


#!/usr/local/bin/python
# increase prices for all users

# postgres stuff
from pyPgSQL import PgSQL

dsn = 'localhost::users' # our connection string
db = PgSQL.connect(dsn)
cursor = db.cursor()

idiot_email_tolerance = 3
pointless_paging_tolerance = 0
increase_percentage = 15

# loop through the users and raise prices accordingly
query_string = """select user_id, num_email_requests,
num_pointless_pages, fee from users"""

cursor.execute(query_string)
row = cursor.fetchone()

while result:
if (row.num_email_requests > idiot_email_tolerance) or
(row.num_pointless_pages > pointless_paging_tolerance):
new_fee = row.fee * (increase_percentage / 100)
cursor.execute('update users set fee = %s where
userid = %s', new_fee, userid)
row = cursor.fetchone()


Things to note:
- indentation makes code blocks, not braces {}, easier to read

- no annoying $ attached to all your variables, cleaner, easier to read

- Python has a standard database abstraction layer. dealing with Postgres, MySQL, SQL Server, ORACLE, all the same.

- Here's a real time saver, check out the last cursor.execute line,
note that the parameters appear to all be %s strings, but
new_fee and presumably userid are both numbers? The DB API
takes care of all type conversion and quoting, when required.

- Just think, no more stripslashes / addslashes just to get quoted text into a column. For example:


title = 'My simple title with "quotes" in it' # this is valid but simple.

content = """<html>
<head>
<title>Mike's house of horrors</title>
<body topmargin="0">
<p>Note all the 'quote' characters I can stuff in here at
random " and not worry about escaping them
with slashes.</p>
</body>
</html>"""

# the above is made possible with the triple quote """ form of a string. Very handy.

# and this will insert it into my table without hassle
cursor.execute('insert into articles (title, content) values (%s, %s)', title, content)
cursor.commit()



There are so many positive things about Python, but, for the average web hoster / developer, a number of drawbacks. Principally - for most web applications you will probably not want to run your app as CGI. Few web hosters are able to deal with anything similar to mod_php for Python.

If you have a lot of control over your computing environment, and have sizable projects (or just want to tinker with a very useful language), then Python is one to consider.

Last word - Python is not just useful for web scripting. You can write Windows or Mac or X GUI applications using Python. I pretty much use it as a replacement for small VB projects now. Frequently use it for any type of "glue" programming / system integration work. Cross platform, character based or GUI, its very versatile - and that is one of its strongest features - learn one language, be productive every where.

Ahmad
07-23-2002, 11:15 AM
HTTP Example:

http://www.webhostingtalk.com/showthread.php?postid=384697#post384697

:)

OK, I don't want to go with it much more. My point is, the people here tried to make a fact more specific, but instead they make it wrong.

A language doesn't have to be a programming language. XML and HTML are markup languages. HTTP is the language of web servers and clients, SMTP is the language used to transfer mail between MTA's. They are all languages in the general sense of language, and so is CGI.

If you want to get specific, you can say that CGI is not a programming language, but you can't say that it isn't a language.

These are all languages, but are different on the purpose of the language they are using, and for those different purposes there are different terms:

Perl is a programming language.
CGI is a programming interface.
HTTP is a network protocol.
XML is a markup language.
ASP is a programming framework.

Ahmad
07-23-2002, 11:22 AM
Python ..

In addition to what mwatkins just mentioned.

Python has a very nice and clean OOP implementation. It is OOP by nature. That is the most thing I like about python.

For something similar to mod_php and mod_perl, there are some alternatives, but I haven't looked at any of them:

mod_pyapache
mod_python
mod_snake

mwatkins
07-23-2002, 11:35 AM
Ok, sorry, I'm not dead yet, and have one more point to make - choosing a programming language should be made, in my opinion, based on what language makes the task easiest.

In that light, I would have to say that a beginning web developer is probably best off using PHP or ASP - whatever the default is for the box they are using / writing for.

But, and its a big but, when you get farther down the learning curve line and are doing ever more complex work, you may then wish to re-evaluate your choice. Some languages make complex things simple, and what's nearly impossible, possible. Python is one of those languages. (my opinion)

Here's something that is becoming more common - "web services". No doubt many of us have heard about this - Google, Amazon and others open up their back ends to access via remote procedure calls, the so-called web services approach. These are typically XML-RPC or SOAP based calls. .NET ziens will know about this too.

You can create and/or call web services in PHP readily enough, but not easily enough. Consider the following, very simple, example:

(In both examples all this does is call a remote web service, supply a string, and ask the web service to repeat the string N times in its reply.)


// PHP
#include("xmlrpc.inc")

$myString = "killer rabbit ";
$numTimes = 10;

$client = new xmlrpc_client("/rpc2/", "someserver.net");
$msg = new xmlrpc_msg('echoString');
$msg->addParam(new xmlrpcval($myString));
$msg->addParam(new xmlrpcval($numTimes, 'int'));
$response = $client->send($msg);
$value = $response->value();

echo "The xmlrpc server returned: " . $v->scalarval();


Now look at the Python example:


# Python
import xmlrpclib

myString = "killer rabbit "
numTimes = 10

myServer = xmlrpclib.Server("someserver.net/pathtorpc/")

print "The xmlrpc server returned: %s" % myServer.echoString(myString, numTimes)


Which form would you rather have to deal with, day in, day out?

What I've shown you is that the language design itself can have a *major* impact on programmer productivity. The Python example is so much cleaner because it really is object oriented in all ways, not just in appearance as is PHP. To make this clear, every thing in Python is an object. A string is an object.

Repeat after me, even a string is an object.

eg:
>>> t = "Foo BAR makes nice DrInKs"
>>> t.lower()
'foo bar makes nice drinks'
>>> t.title()
'Foo Bar Makes Nice Drinks'
>>> t.swapcase()
'fOO bar MAKES NICE dRiNkS'

Ok, so what else does the string 't' have for me?
>>> dir (t)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper']

Yikes! Too much info! Just pointing out that objects can be interrogated. Object orientation is so natural in Python that you will barely notice it when you are starting out but you will always benefit from it.

And finally, just to drive the point home, our variables and constants are objects...

>>> "foo AND bar".lower()
'foo and bar'

(By the way, having a command prompt >>> to test things out on is very handy)

SO.... depending on what features are implemented, and how, a language can make something simple or very hard to do.

I made the switch to Python from PHP / ASP because I had a project with a lot of web services work built into the requirements - after one afternoon of dealing with how clumsy PHP is in the web services world, I switched to Python.

It wasn't a fast switch but the productivity gains are long term and a competitive advantage IMO.

zRedDice
07-23-2002, 03:35 PM
mwatkins:

I agree 100% with you. However...

I feel that there is one other aspect of great importance: what the programmer is most comfortable with. I can do _some_ programming with Python, but the bulk of what I do is in PHP. I haven't taken the time to learn Python (or Java, or many others), and so for me, to program that, would take more work...

now... I daresay I should learn Python to a much larger extent. :) No arguments there... and I don't feel like I'm being repressed. :P

- James

Gem Hexen
07-23-2002, 03:45 PM
PHP & ASP

Studio64
07-23-2002, 04:09 PM
Originally posted by Ahmad


Actually, CGI is a language.

Buwahh!!.. :eek: :eek: :eek:

OK... I know the thread got a bit off topic about this. But, this needs to be cleared up....

CGI = Common Gateway Interface

CGI is a wrapper (something that encapsulates an actual program (that is written in a language) to execute on a webserver. You can write a CGI script in any language: C, C++, Fortran, PERL, TCL, any unix shell (bash, etc.), VB, AppleScript, even PHP)....

All CGI does is force the webserver to execute a page stored on a webserver instead of displaying it to the user.


But, back on topic.,... PHP... why?


Blistering fast
Free....
Free....
Great MySQL database support
MySQL is free :D
Quick, clean, simple
Easy installation to webservers
Low server load
Very easy to integrate into HTML
Script and HTML in same page
The simple fact that I can right code like this

<html>
<center>Hello <b><?echo $name?></b></center>
</html>

Makes coding so quick and easy, it's almost dumb how interactive you can get web pages to be
Great documentation, that's free :D
Module's that are out: Such as creating Flash graphics on the fly through coding in php
Just plain cool


Well... that's my $.02......

zRedDice
07-23-2002, 04:11 PM
Add to that list for PHP:

..... Easy for beginners but advanced for hard-core-coders
..... Plenty of books for reference and a huge community of developers

- James

mwatkins
07-23-2002, 04:21 PM
James, I agree with you - there's no point in pushing a programmer to use a tool they do not feel comfortble with, which is why I always include statements such as
In that light, I would have to say that a beginning web developer is probably best off using PHP or ASP - whatever the default is for the box they are using / writing for.
PHP is good for people just starting out with web development because it doesn't require much knowledge to get going with. Want to print something to the 'screen' (browser) - use a print or echo statement.

echo "Hello"


You don't need to know anything about protocols etc. PHP assumes you won't know or that you will be happy with a content-type of HTML and know enough to override that when required.

Whereas with Perl or Python or any language that intentionally gives you more control, and isn't web centric (not to say they are not very powerful for the web), you'd need to know at least to output to the browser first:

print "Content-type: text/html"
print
print "Hello"

if you wanted output on the browser.

Not hard to learn, clearly, its just another thing the beginner doesn't want to contend with.

As I showed much earlier in this thread, CGI performance is going to be the big reason why most people will not develop in Perl or Python, as its few hosters that are set up to serve the needs of some one that wants to write high performance web apps in anything but PHP or ASP.

I put more effort into these responses than originally intended, but thought it would be useful for some readers to understand that there are options out there and to also know why some (PHP, ASP) are more or less the defacto solutions of choice -- simply because they are configured by by default by most hosting providers to provide relatively high performance.

Ahmad
07-23-2002, 06:40 PM
Originally posted by Studio64

OK... I know the thread got a bit off topic about this. But, this needs to be cleared up....

CGI = Common Gateway Interface

CGI is a wrapper (something that encapsulates an actual program (that is written in a language) to execute on a webserver. You can write a CGI script in any language: C, C++, Fortran, PERL, TCL, any unix shell (bash, etc.), VB, AppleScript, even PHP)....



Mr. Studio64 :D ..

I already commented on that. I know CGI is not a PROGRAMMING LANGUAGE, but it is a language. Just like XML, HTTP, Perl, English, .. etc.

DefiantPc
07-23-2002, 06:53 PM
listed in order of personal preference.

1. perl
2. PhP
3. CFM
4. JSP

alchiba
07-23-2002, 06:56 PM
<nostalgic>

No one has mentioned RSX-11M macro assembler. (sniff)

</nostalgic>

Back in the day, I used to write assembler code on PDP-11's to generate dynamic Web pages. Who woulda thunk it?

MGCJerry
07-24-2002, 01:56 AM
My preferred language is PHP...

I used to mess with java, javascript, perl, and some python, but I find php easier.

In the short time I've been messing with php I have wrote a few programs in a couple months compared to zero programs and/ or scripts with java, javascrpt, perl and python combined in 2 years :eek: . Of course I dont include all the "Hello World" starts. My first php from scratch script was a random generator for my RPG.

RobTheGolfer
07-24-2002, 09:28 AM
Well my favorite is HTML! :D :D