...

View Full Version : PHP, ASP or JSP?



Pavon
12-09-2002, 05:22 PM
Hi,

Can anyone give me some feedback on what I should use,
between PHP, ASP, and JSP?

Thanks,

Fernando

ionsurge
12-09-2002, 05:25 PM
PHP - it is really good, and you will appreciate it later on too.
ASP is good too, but I prefer .php. It is up to you tho.


Ionsurge.

cg9com
12-09-2002, 05:25 PM
oh geez here we go, you may have started something here ...
JSP *thumbs down*
ASP is great
PHP is the best ;)

Pavon
12-09-2002, 05:29 PM
Thanks, I think I am hearing what I want to hear, but why do you say JSP *thumbs down?

Fernando

ionsurge
12-09-2002, 05:31 PM
We agree - no problem!


Ionsurge.

Spookster
12-09-2002, 07:33 PM
JSP has many very nice features however JSP tends to run rather slowly. You won't find JSP supported on very many shared hosting servers due to the amount of resources JSP uses. Typically businesses that have their own servers will use JSP.

PHP can do pretty much anything that JSP can do but PHP was originally designed for the web where as JSP draws it's roots from a high level standalone software development. Java, the lanaguage used in JSP has a very steep learning curve.

ASP is nice too but has a bit of a steeper learning curve than does PHP. The difference in speed between PHP and ASP is probably not real noticably different.

Pavon
12-09-2002, 08:51 PM
Thanks Spookster,

For your very useful information.

Fernando

beetle
12-09-2002, 09:00 PM
Are we talking about ASP classic or ASP.NET?

There's a big difference

While you ponder that, here (http://www.webmasterbase.com/article.php?pid=0&aid=546) is an excellent article about choosing a server-side langauge.

Just try to remember that terms people here use like "better" or "best" are subjective and biased, and need to be taken with a grain of salt.

oracleguy
12-10-2002, 12:56 AM
It also depends if what languages you already know. For example, if you know VB then ASP is the obvious choice.

kwhubby
12-10-2002, 06:17 AM
question, doesnt asp support multiple languages, VBscript, and JavaScript, etc?.

whammy
12-10-2002, 06:58 AM
I would actually disagree with spookster for once... ASP isn't a steeper learning curve than PHP (although ASP.NET is a huge learning curve!).

I think if you are familiar with a C based language than perhaps PHP is for you.

If you know BASIC or VB then ASP is likely more up your alley. The thing is, they can both do pretty much the same thing. Each has its advantages and disadvantages. It's up to you to figure out which language suits you best!

And yes, you can use VBScript or JScript with ASP, kwhubby, but that pales in comparison with what you can do with .NET.

Mhtml
12-10-2002, 08:09 AM
Yeah, I agree with Whammy.

I'm learning PHP right now and I find it considerably harder than ASP.

Although I wouldn't really call PHP hard when comparing it to ASP because it isn't the difficulty it is the structure of the language.
ASP (VBscript) is really easy to learn because the langauge structure is based almost completely on clean logical expressions.
I don't mean to say that PHP isn't, just that ASP's logical expressions differ making it easier to read because it is cleaner.

Example;


MyVariable = 2
If MyVariable = 1 Then
MyVariable = MyVariable + 1
Else
MyVariable = MyVariable - 1
End If


Now you can easily decypher that with no programming knowledge at all even if you haven't used a computer before.

PHP Example:


$MyVariable = 1
if ($MyVariable = 1) {
$MyVariable = $MyVariable + 1
}else{
$MyVariable = $MyVariable - 1
}


In my opinon that is harder to read when starting out due to the $ chars everywhere and having the paras and brackets. Now I think that you would find it a little harder making sense of it.

In the end it will depend on what you want to do.
It is up to you but I say start out with PHP as it will be a lot easier to pick up other languages later like ASP.

I think by starting ASP before PHP has made it a bit harder but then again I've used BASIC before ASP so it made it easier and I've a little knowledge in JavaScript so it makes PHP easier (a little) because of the language structure.

PS: I may have made a mistake with that really simple PHP code because I have only read about 2 pages on it so far.. lol ;)

ronaldb66
12-10-2002, 09:25 AM
You did... :D


if ($MyVariable = 1)

should be:


if ($MyVariable == 1)

"=" is the assignment operator, "==" is the comparison operator.

Of course PHP syntax differs from other languages, but as with all languages you'll get the hang of it. I personally have no experience with ASP, so i can't compare them, but i'm really impressed with the capabilities of PHP. There's also a vast supply of resources avialable which can help with learning, working out bugs, etc. I'd give it some serious consideration.

Pavon
12-10-2002, 12:34 PM
My only problem with ASP and ASP.NET in particular is the huge expence for Microsoft's development tools like Visual Studio, also hosting of ASP is more expensive than PHP and ASP.NET is even more expensive still.

It's a pity that Microsoft insists on making money even out of developers. I don't mind paying but I think Microsoft's prices for their MSDN is a clear rippoff.

On the other hand PHP, Apache and MySQL are all free for developers. And hosting is a lot cheeper.

Spookster
12-10-2002, 04:17 PM
and in Java it would be:




int MyVariable = 1;
if(MyVariable == 1){
MyVariable = MyVariable + 1;
}
else{
MyVariable = MyVariable - 1;
}




and it is pretty much the same in C++. Of course real programmers would typically use shortcut syntax like:




int MyVariable = 1;
if(MyVariable == 1){
MyVariable++;
}
else{
MyVariable--;
}





and in Javascript:




MyVariable = 1;
if(MyVariable == 1){
MyVariable = MyVariable + 1;
}
else{
MyVariable = MyVariable - 1;
}




So the syntax is almost identical in PHP, Java, C++ and Javascript. If you learn Javascript then learning those other lanaguages becomes much easier. Also if you know any of those other languages then learning additional ones becomes much easier. If you learn VBScript or .NET crud then guess what you haven't learned anything that is really going to help you learn other lanaguages.

beetle
12-10-2002, 04:26 PM
Whats a 'real' programmer? Are you talking about the ++ operator when you say 'shortcut'? What about shortcut syntax like this? (javascript version)
var MyVariable = 1;
MyVariable += (MyVariable == 1) ? 1 : -1;???

Spookster
12-10-2002, 04:51 PM
Originally posted by beetle
Whats a 'real' programmer? Are you talking about the ++ operator when you say 'shortcut'? What about shortcut syntax like this? (javascript version)
var MyVariable = 1;
MyVariable += (MyVariable == 1) ? 1 : -1;???

That was a playful stab at people that don't program in a high level language regularly. :)

And yes that is another shortcut way also possible in Java as well although rarely used in Java. Not sure about C++ though. Back in my computer science courses at college I wrote a few programs using that shortcut way and my professor was like "huh?" He had to look that one up.

beetle
12-10-2002, 07:39 PM
Ya, hehe. I haven't had any programming classes since high school, but I've heard of several teachers/professers snubbing ternary operations.

jkd
12-10-2002, 09:11 PM
Originally posted by beetle
Ya, hehe. I haven't had any programming classes since high school, but I've heard of several teachers/professers snubbing ternary operations.

Most computer science teachers appreciate clear code.

if (conditition) {
dothis();
}
else {
dothat();
}

Is much more obvious to anyone who may not know C++ than:

condition ? dothis() : dothat();

beetle
12-10-2002, 09:54 PM
Uh oh, I feel a debate coming on... :D

Why should I make my code easy to read by non-programmers?

I'm reminded of a topic hot in the blogs recently, about going to great lengths to make the web-server workload less, and to make search-engine's job's easier. Some clever and observational fellow said
Machines are meant to make life easier for us. ... the machine works hard so you don't have to. That's the way it's supposed to be. If we're working hard to make the machine's life easier, then we're doing something wrong."I couldn't have said this better with a fancy dictionary and a day to think about it.

Am I the only one, or does this topic and our topic have some parallels?

Spookster
12-10-2002, 10:30 PM
Originally posted by beetle
Why should I make my code easy to read by non-programmers?


So when you get fired for not being a 'real' programmer, the next programmer that gets hired can understand the code easily. :D

jkd
12-10-2002, 10:31 PM
Originally posted by beetle
Why should I make my code easy to read by non-programmers?

Algorithms. Algorithms are language-independent, and somebody familiar with it in one language should be able to easily pick it out written in another.

I'm not saying you should always waste bytes to make code more obvious, but when you have a mathematician involved, or an algorithms expert, it is always a good idea to take extra steps.

kwhubby
12-10-2002, 10:43 PM
interesting, I gues I am very happy that I learned javascript, since its really similar to other languages (:

beetle
12-10-2002, 11:47 PM
Thanks for the replies to my debate-starter everyone.

For the record, I have my own ideas about why code should be easy to read. I wanted to hear your opinions, see if they are similar to mine. Thanks :D

whammy
12-10-2002, 11:53 PM
I think in general if you write your code as simple and elegant as you can (and especially if you use descriptive variables), and indent your code, then there should be no need for comments in most cases...

I think that another programmer could read my later applications (ASP usually) and know exactly what's going on without any trouble at all (and I have very few comments in the code).

Thanks to people like jkd, joh6nn, glenngv, and beetle, I'm actually starting to write more elegant code too... ;)

I think to anyone fairly good at javascript, this simple but effective script wouldn't need comments at all, for instance:


<script type="text/javascript">
<!--
function alpha(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
}
function extractalpha(str) {
return str.replace(/[^a-z]/gi,"");
}
// -->
</script>


If a non-programmer can't read it, what does it matter, as long as you can tell them (or they can figure out without destroying it) how to use the function etc.?

Just my 2. :)

BTW, What ARE your views, beetle? I definitely value your opinion. :)

P.S. I REALLY have to take a moment to give a huge Thanks!!! to you guys for all the help you've been giving me over the years on this forum and its predecessors... I learn new things here constantly, and always recommend this forum to my friends.

It's truly satisfying when you can look up different "cross-browser compatibility" methods (i.e. concerning event.which) and most of the examples I saw take 6 or 7 lines at the least to accomplish what

document.all ? k = e.keyCode : k = e.which;

does in one line... again, thanks to all of the basic programming concepts I've learned from you guys - not to mention every concept I have learned here is directly applicable to ASP, PHP, or any other programming language, and has improved my general knowledge of programming (and my programs!) immensely.

If you kids (mostly) can get this stuff through a guy's head that is in some cases nearly twice your age and didn't mess with computers for about 16 years (after learning BASIC as a kid, that is), you can do absolutely anything... ;)

Sorry to use up so much space, but I really had to say thanks. Hanging around here for awhile you probably learn more than you would in "Programming 101" for sure. Can't wait to learn even more. :D

:thumbsup: :thumbsup: :thumbsup:

dauvm
12-11-2002, 12:34 AM
Originally posted by Spookster
It really kind of amazes me that MS created both C++ and VBScript as they differ so much. Woah holdup! I'm surprised this one slid past everyone... MS definately did not create C++. C++ was created by Bjarne Stroustrup in the late 80s when he worked at Bell Labs. If MS made C++ it would probably be sueing the open source community for all it's worth right now.... Hmm anyways Spookster... I think you might have been thinking of MS's propriety version Visual C++, a totally different creature? VBasic is about as good as Gates gets I guess. (say that ten times fast)

On the topic at hand... I just want to say that I find it really hard to read a book to learn a language... I like to see how other people have done things. I think it's just common courtesy sometimes to be clear? Not to mention, when you write things clearly, it's much easier for you yourself to come back and figure out what you were trying out accomplish later on.

Nice post, Whammy ;) Even though i'm relatively knew here I definately enjoy helping people out and the help people have given me has kept me from throwing my computer out the window a few times.

-Doug

whammy
12-11-2002, 12:39 AM
Perhaps he was thinking of Visual C++ or C# (the new language for use with .NET)... which actually does have a few advantages/improvements over other OOP languages like C++ from what I understand so far... but since it's proprietary, bleh...

The only decent "standard" Microsoft has come up with on their own (that I know of) is SOAP...

Good catch though. :D

jkd
12-11-2002, 12:54 AM
Originally posted by whammy
but since it's proprietary, bleh...

C# is actually undergoing ECMA standardization. And there is a C# compiler for Linux widely available created by a non-Microsoft vendor.

whammy
12-11-2002, 12:57 AM
Yay. :)

I guess they're doing something right again... I guess I'll have to look into the C# compiler for Linux since Microsoft is still charging about $1000 for Visual Studio.NET...

:rolleyes:

Spookster
12-11-2002, 12:57 AM
Originally posted by dauvm
Woah holdup! I'm surprised this one slid past everyone... MS definately did not create C++. C++ was created by Bjarne Stroustrup in the late 80s when he worked at Bell Labs.
-Doug

You're absolutely correct. I was wondering when someone would catch that. I did it on purpose. lol j/k :)

Well that just solidifies my case that MS produces languages outside the norm as far as syntax which ultimately confuses everyone.

As JKD stated earlier algorithms/pseudo code is the key to programming. It's important to understand programming concepts in general. Once you have that there is really no need to spend enormous amounts of time learning in depth any language unless of course it's a M$ proprietary language. :)

I don't know about other universities but at mine that is the concept they pound into your brain constantly. Matter of fact one of the courses involves writing different programs in over half a dozen different languages. Obviously you aren't going to learn all of those languages in depth in 4 months during the semester so you must understand programming concepts and then just put together an algorithm/pseudo-code and fill in the actual syntax later.

Kiwi
12-11-2002, 01:11 AM
When you've got millions of lines of code to trawl through, it's kind of nice to be able to work out how everything is being done easily. The days of all coders being idiot savants who can read machine code is long gone.

jkd also hit one of the key points: when you're developing code, algorithms are far more important than execution speed and saving a few bytes. Once you get it working, then optimisation can step in (but if you are using an inefficient algorithm, then no amount of optimisation is going to make you faster than a better way of doing it).

One thing I've noticed with most web-technologies. It's well suited to individual developers. But for large-scale projects, it lacks a development environment.

JDE is the major development environment around today. .NET is supposed to be -- but it's only just started. I've not seen anything like this for php as yet (there are some efforts to develop standard libraries for databases and security, but these have along way to go). If you are talking about the merits of individual languages, then you also have to look at the environment in which the developers operate. If you are a Java expert, you have a huge learning curve at the start. But once you get up that learning curve, you can then transfer your skills across projects very easily, because the development environments are standardised. If the language does not have a standardised development environment, then you might have a lower initial learning curve, but as you shift from project to project, you are likely to have to re-learn the development processes (which is a huge percentage of the job).

These two points link together. In a large-scale development environment, writing clear code becomes important (because the work is distributed; the person writing the code is unlikely to be the person fixing the code).

dauvm
12-11-2002, 01:15 AM
Just wondering... how does one go about pronouncing C#?
C-number? C-hash? C-sharp? C-pound? hah I'm out of ideas. That's pretty fascinating that microland is letting something of their's slip and be useful to people that haven't paid them for it. If they keep this up I might have to change my tune about them....I won't hold my breath :D

-Doug

Kiwi
12-11-2002, 01:17 AM
Originally posted by dauvm
Just wondering... how does one go rap and MS Java are the two most common I've heard (well, they're the two most common that I can repeat anyway).

whammy
12-11-2002, 01:18 AM
This probably won't happen for a long time as regards to OOP - but using javascript as a basic example, with a truly well-written language you shouldn't have to use any specific IDE in order to program in a particular language, in my opinion... perhaps you could have a "one size fits all" compiler - and .NET has definitely failed in this respect with its dependence upon Visual Studio.NET to "take care" of all the "behind the scenes" programming for you (not to mention making it nearly impossible to write an application without it!).

What amazes me is if I was to write a simple email form using .NET (and Visual Studio.NET), it creates about 100 times as much code as it would take for me to send a simple email using CDONTS in ASP. Perhaps it may run faster, once it's compiled... but if it worked right in the first place you'd never NEED to see what was going on behind the scenes, would you? That's not really a very good example since that is done rather easily even in NotePad, but I'm sure you get my drift...

Anything else should be "built in" to the language... perhaps I'm naive and I know that most of this code is "created" by VS.NET in order to prevent things like "dll hell" and allow programmers access to stuff they never had before, but I really think something like this could be done a lot better and even more efficiently, even though I would have NO idea how to do it myself...

Just a concept I thought I'd throw out there... I'm a little out of my league here, but I can still see what's going on. ;)

P.S. It IS pronounced C Sharp...

firepages
12-11-2002, 02:26 AM
.. what I love (and others hate) about PHP is that it gives you so many options..., I wont go into my other reasons for shouting PHP as you will all get bored quite quickly ;)



<?
$MyVariable=1;

/************alternate*************/
($MyVariable==1)?$MyVariable++: $MyVariable--;

/**********standard*good**********/
if($MyVariable==1){
$MyVariable++;
}else{
$MyVariable--;
}

/***********depracated?*evil*******/
if($MyVariable==1)
$MyVariable++;
else
$MyVariable--;

/**************daft**************/
switch($MyVariable){
case 1: $MyVariable++;
default: $MyVariable--;
}
?>

jkd
12-11-2002, 02:43 AM
myVariable = !(--myVariable) ? myVariable : myVariable+2;

;)

And firepages, unless PHP is different than every other C-based language in that it doesn't allow fall-through on the case statements, you need a break; statement after each case, otherwise your variable ++ and subsequently --'ed.

whammy
12-11-2002, 03:13 AM
:D

firepages
12-11-2002, 03:29 AM
I wondered who would spot the deliberate mistake ....

cough cough whistle.

like I said, options.... that obviously includes the option of stuffing up :D

whammy
12-11-2002, 03:30 AM
Heh... that's another thing I love about this forum. Noone's perfect, and noone pretends to be. But anyone who isn't learning from here is seriously missing out. :)

beetle
12-11-2002, 03:53 AM
Hey, I'm back.

Wow, lots to read.

Well, whammy, my opinion is: The purpose and environment that the code is developed for/in should dictate the syntax used and how much commenting is performed. Yes, I know I sound like Captain Obvious&trade; but that's what I think :D

oracleguy
12-11-2002, 05:59 AM
Originally posted by Pavon
My only problem with ASP and ASP.NET in particular is the huge expence for Microsoft's development tools like Visual Studio, also hosting of ASP is more expensive than PHP and ASP.NET is even more expensive still.

It's a pity that Microsoft insists on making money even out of developers. I don't mind paying but I think Microsoft's prices for their MSDN is a clear rippoff.


Regular ASP doesn't require any special program. You can do it in notepad if you wanted.

And yes, MSDN is a rip off but it is nice to have all the cds so its a breeze to look stuff up. Whenever you go to a MS conference or buy a development product they give them out so its not too bad.

DLL Hell.... *shivers*

This is a very intresting thread.

Mhtml
12-11-2002, 06:38 AM
Woah, this started out as a thread regarding what server side language Pavon should start learning and now it is all into dev environments who owns what and why this is such a rip off.

...

Completely out of my league..lol :D


Question though since you guys are on the topic (which is off topic) what language do you recommend to a noob with lmited knowlege of anything more than BASIC and a little Javascript?

I mean out of C, C#, C++

I learnt a little Java last year and a little Python but they are nothing in comparison to the above three I am lead to believe.:confused:

dauvm
12-11-2002, 07:06 AM
Hey Mhtml...

I've been doing a lot of research lately trying to find a good starting language for me too...
I did start learning Python. It's supposed to be a super easy language and great for beginner, but also powerful. Java is actually a high-level OOL and is powerful enough for writing large applications in.

Out of the three Cs I have only heard that C is "sloppy" and since C++ has all the functions of C "plus" many more, it is generally accepted that if you learn C++ first, there's no reason to learn C.

I did not know that C# was going to be standardized or I probably would have looked into that more. I don't like to waste my time with propriety stuff. Java is also "propriety" but it's more half and half... Sun just hasn't made it completely OSS (despite much begging) because they feel that they're the only company standing in the way of microsoft... and I forgot the exact figure, but Sun spends a phenominal amount of money in R&D trying to stay ahead of the game... so you can't blame them for that.

I'm sure other people can fill in a little better... but yea this thread got out of my league quite quickly so I figured I'd jump back in while I had the chance :)

-Doug

ionsurge
12-11-2002, 11:29 AM
I am fluent in C++ which is a high level code - unlike Java which is a low level code, like vc++.

A lot of people seem to not know that, but it is something to take into consideration when you want to learn something.

The most important thing is when learning C++ is that you have the right software to actually let you learn more easily, and a lot of them do not come cheap.

I use C++Builder 6, which is pricey, but it is worth it, and pays for itself as you learn and find out what it does offer you.

Delphi is great, and it uses Pascal, which is not alto different from C++, just a few differences in the style of coding.

I recommend C++, and well C# seems to have made very little impact - and I have not really seen much demand for C or C# programmers.



Ionsurge.

allida77
12-11-2002, 02:27 PM
You do not need studio for asp.net. I use edit plus for all my asp.net pages. As far as email goes you just have to inherit:
<% @Import Namespace="System.Web.Mail" %>
and then use the appropiate methods and properties of this class. I initially got sudio because I thought it was needed ,but after creating a "project" and realizing how many pages it created I just went back to edit plus.

And what language is best..I only have experience with asp so I couldnt give an good answer. I will say that learning a true programming language such as C++ will help you no matter what you decide to learn. I didnt read all these threads but there is really no one "Greatest" scripting language. It is whatever is best for the job and what you are getting $$ for.

dauvm
12-11-2002, 08:32 PM
unlike Java which is a low level code Hehe... right you are. Got my highs and lows mixed up there... thanks for the correction.

-Doug

Spookster
12-11-2002, 08:55 PM
Originally posted by ionsurge
I am fluent in C++ which is a high level code - unlike Java which is a low level code, like vc++.

A lot of people seem to not know that, but it is something to take into consideration when you want to learn something.



I am assuming you are being facetious. Java IS a high-level programming language just as C++ is.

oracleguy
12-11-2002, 10:29 PM
Question.... I have a copy of Visual C++ 6 that came with Visual Studio 6 when I bought it like 2 years ago. Its on "the list" to learn. Now does that use the same C++ as the other C++ programs mentioned earlier or did microsoft do a whole bunch of special things? I remember reading about someone saying that VC++ is diffrent than the "regular" C++.

I hope that makes sense.

beetle
12-11-2002, 10:46 PM
Ok, I've got a question for you 'real' programmers :D (hah!)

High level. Low level.

What's the difference? Sure, the words high and low carry their own connotations, but what exactly do these adjective phrases mean? I could guess that I understand (I do have some suppositions), but without really understanding, kinda pointless.

dauvm
12-11-2002, 11:11 PM
Originally posted by Spookster
I am assuming you are being facetious. Java IS a high-level programming language just as C++ is.
eeesh... now I'm getting confused too haha...
I thought it was
Low level - Closer to the hardware (assembly code).
High level - a higher level of abstraction away from the hardware.

-Doug



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum