Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Location
    Dublin, Ireland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The most useful web scripting language


    Hey all, im new to CodingForums, and wanted to get started so heres my first question...

    I want to learn a web scripting language, my 2 choices are Javascript and PHP,
    i just want to know there differences and purposes for using each one, and some advantages perhaps.

    im gearing towards php although javascipt is client side, and php is server side, and one advantage to php is that it can connect to a mySQL database with ease, i want to know what javascript can do because w3 schools called it "THE scripting language of the web"

    ..as much detail as you wish, i want the most usefull web scripting language so i can have it in my repertoire

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Hey, welcome to the forums.

    You're right, JavaScript is client-side (meaning it is rendered and runs through your browser on your local machine), and PHP is server-side (meaning of course that it is run on the server via HTTPD module, e.g. via Apache web server).

    PHP is great for producing dynamic content (text, XML, (X)HTML / CSS / JavaScript, JSON, etc), connecting to other servers, consuming web services (XML), interacting with various types of databases, the list goes on. But it's what happens before your web page loads. JavaScript is what happens after the page loads to provide a more rich interface for the user. It allows you to dynamically alter the document after it's loaded, either via asynchronous calls to the server for more content (Ajax, in other words), moving content around, creating new elements on the page, hiding elements, etc.

    PHP has "C-like" syntax, and object oriented capabilities (which have improved drastically, but PHP is still not an "object oriented language"). JavaScript has a "Java-like" syntax and function based object capabilities.

    The bottom line is, in today's market, you need to learn both. One is not a replacement for the other.

    JavaScript requires nothing more than a text editor and some ability to test code, which generally means opening (X)HTML in your browser. I strongly recommend any JavaScript coding be done with the assistance of Firefox and the Firebug extension. I also recommend the use of one of the popular frameworks such as jQuery, YUI or prototype, but only after you have a proper understanding of JavaScript and can "do something" with it.

    PHP, on the other hand, requires an HTTPD server (well, technically it can run standalone in CGI mode, but that's no good) such as Apache. You'll have to decide whether to install the server on your local machine, use an old PC sitting around as a server platform, or find yourself a web host. If you want to use MySQL, Postgresql, or make use of some of the other extensions PHP offers, this will require installing additional services.

    Either way, a good text editor with syntax highlighting, brace/bracket matching and possibly a project managing interface are indispensable.


    PHP manual | JavaScript reference
    Last edited by bdl; 03-26-2009 at 02:07 AM. Reason: Added links

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Location
    Dublin, Ireland
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks bdl for your detailed unbiased reply
    ive been floating around some tutorial sites and PHP seems pretty appealing to me, but javascript on the other hand seems pretty handy with its built in functions around forms ect.

    i didnt say my work is generally online photosharing, and interaction between users (comments, profiles..ect), as this may have led to people giving me back php only answers...

    yeah your right there about how easy javascript is to test and deploy in comparison to php, which requires the use of a server interpreter which sucks

    yeah i have Dreamweaver on my side so im okay there

    so basically Javascript is a user-interfacing language while php is more content handling and retrieving database info sort of thing?
    if thats remotely correct i definitly will be using both of these!

  • #4
    Regular Coder
    Join Date
    Mar 2009
    Location
    Portland Oregon
    Posts
    690
    Thanks
    44
    Thanked 63 Times in 62 Posts
    I have a few questions about php. Can I use an old laptop with windows ME on it? I know, but it was a cheapie flea market purchase about 5 years and it's just collecting dust.

    If not, I have a desktop with windows 2000 on it, would I be able to create a php platform?

    I'm not sure what to do. Should I learn linux? I've never even seen it, but someone at craigslist said I should get a LAMP. I've also seen a tutorial where the guy recommended getting xampp. His site is rascal999 and he makes easy to follow php tuts. Which option would you recommend? I've only used windows and pcs. never even seen a mac or linux working on a computer. I'm totally self trained, and I use that term loosely, but I think I'm ready to give it a shot.

  • #5
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Hi TinyScript. Although this is not the PHP forum, and it's bad netiquette to hijack someone else's thread, I'll bite. You should, however, consult the PHP forum for PHP specific questions.

    Quote Originally Posted by TinyScript View Post
    I have a few questions about php. Can I use an old laptop with windows ME on it? I know, but it was a cheapie flea market purchase about 5 years and it's just collecting dust.
    No laptop is ideal for a web server. I'd probably wipe the drive and install a lightweight linux distribution on it just for fun (getting ahead of myself here). Whatever you do, perform the WinME exorcism promptly.

    Quote Originally Posted by TinyScript View Post
    If not, I have a desktop with windows 2000 on it, would I be able to create a php platform?
    Absolutely. Although Win 2000 is a bit outdated, it makes a nice server platform. Unless you're dead set on using Win IIS server (which may or may not be installed on that machine anyway), I'd grab the Windows version of Apache, MySQL, PHP and whatever else you want to install. Most open source software can run on Windows, you just have to know where to look and how to follow the (usually very basic) instructions.

    There's also the XAMPP suite, but I've never used it (also getting ahead of myself).


    Quote Originally Posted by TinyScript View Post
    I'm not sure what to do. Should I learn linux? I've never even seen it, but someone at craigslist said I should get a LAMP. I've also seen a tutorial where the guy recommended getting xampp. His site is rascal999 and he makes easy to follow php tuts. Which option would you recommend? I've only used windows and pcs. never even seen a mac or linux working on a computer. I'm totally self trained, and I use that term loosely, but I think I'm ready to give it a shot.
    I've run Linux for 10+ years, and BSD as long (although I tend to run Linux only now), and I'm a big open source advocate (ironically I'm posting this from my wife's WinXP desktop). LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is an excellent server platform, and it's totally free (as in speech and beer). BAPP (with BSD and Postgresql) is probably the most stable platform you can run.

    So yes, I recommend learning Linux or BSD, it can't hurt anything, and a good live CD of Ubuntu or whatever other user-friendly distro can be downloaded just for the price of your internet connection.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,688
    Thanks
    80
    Thanked 4,650 Times in 4,612 Posts
    When people have asked me a question such as this, I've usually said that you need to learn a MINIMUM of *FOUR* languages to be successful in web development:

    -- HTML (remember, that stands for Hyper-Text Markup Language....YES, it IS a language!)
    -- JavaScript (you can't produce any decent sites without it, nowadays)
    -- SQL (don't forget this one! If you aren't competent in the SQL dialect of your chosen database, you will SURELY be working way to hard in the 4th language)
    -- PHP or VBScript or JScript or VB.NET or Java or C# (finally, you get your choice!)

    I'm pretty language neutral, but I do have my druthers as to platform. And I have to be honest and say I'm not very enamored of the PHP platform. It's just too barebones. ASP isn't much better, if any, than PHP. JSP, especially with the aid of something like Tapestry or Spring or Struts, does a pretty decent job. ASP.NET is by far the most powerful platform out there, but you have to pay a pretty steep price for the learning curve AND the hardware/software to run it, so it's easy to see why many avoid it.

    All and all, I think JSP with one of the open source platforms I noted is my pick. But that's only until and unless you start asking all the other questions. And you should be asking at least a couple of dozen, if not more.

    One minor point here: I dunno if you noticed, but I *did* list JScript as a server side language! Many people tend to ignore the fact that you can use JScript--which is really just Microsoft's brand of ECMAScript just as JavaScript is Netscape's brand--as a server side language if you use the ASP platform. And since ASP is a cheap platform (didn't used to be, but nowadays you can buy hosting with ASP for same price as hosting with Linux, from such providers as GoDaddy) this *does* give you the opportunity to learn only 3 languages, using JavaScript for both server and client. You still need to learn the ASP platform, but that's true for any of the other server languages: You have to learn the relevant platform. (In the case of PHP, the languge and the platform are so tightly tied together it's hard to see them as separate entities, but really they are.)

  • #7
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by Old Pedant View Post
    When people have asked me a question such as this, I've usually said that you need to learn a MINIMUM of *FOUR* languages to be successful in web development
    Agreed. The OP didn't ask about HTML or SQL, however.

    Quote Originally Posted by Old Pedant View Post
    One minor point here: I dunno if you noticed, but I *did* list JScript as a server side language! Many people tend to ignore the fact that you can use JScript--which is really just Microsoft's brand of ECMAScript just as JavaScript is Netscape's brand--as a server side language if you use the ASP platform
    Well, based on this one post it's not hard to see where your loyalties lie!

    At one point in time, Microsoft reverse engineered what was known at the time as "JavaScript", and put their own label on it. I don't know that I would call it "a different brand" (if BrandX takes a Sony, strips it down and makes a crappier copy, is it just a different "brand" of Sony?). It wasn't known as ECMAScript until after this nonsense took place and ECMA became involved in helping establish a standard for the language. Unfortunately despite this, IE still uses their own crappy non-standard implementation.

    It's true though, JavaScript, ECMAScript or JScript if you prefer can be a server-side language. In fact there is / was actually a server platform based on JS.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,688
    Thanks
    80
    Thanked 4,650 Times in 4,612 Posts
    Ummm...I think you missed the part where I said that, overall, I'd choose JSP.

    Mind you, I've had a lot more experience with ASP, but it is a pretty primitive platform compared to JSP or ASP.NET. Of course, the original JSP was a pretty primitive platform, too. But it has been greatly improved upon both by companies such as IBM and BEA and by the addition of frameworks such as I noted. MS chose to go the other way and toss ASP and created ASP.NET. Can't say that was a bad decision, as ASP.NET is clearly the most advanced platform out there today. BUT... But ASP.NET is such a closed culture and the learning curve is so steep that I have a hard time pushing it on people. So... JSP.

    As for JavaScript: Ahh, come on! Even Netscape didn't call it "JAVA"script until Java started gaining popularity and they jumped on the naming bandwagon! They even had to ask Sun for permission to use the name, but it's been so long ago, who cares? So what's in the silly name, anyway?? No argument that JScript was a johnny-come-lately, but it *did* result in the creation of a real standard, which in the end was I think an advantage to all.

    Oh, and yes, at one time Netscape had a server product based on JavaScript. [It's been a time, but I kind of recall it was called "LiveServer" and came from the days when JS was still called "LiveScript." But I wasn't involved in it back then, so the details are fuzzy.]

    FINALLY... In actuality, the server-side use of JScript with ASP is and has always been poorly supported by MS. There are many of the ActiveX components used with ASP that don't "play" as well with JScript as they do with VBScript. So it would NOT be my first choice in any event. I only pointed out the possibility out of a sense of completeness.

  • #9
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by Old Pedant View Post
    Ummm...I think you missed the part where I said that, overall, I'd choose JSP.
    I didn't, I was just kidding around.

    Quote Originally Posted by Old Pedant View Post
    As for JavaScript: Ahh, come on! Even Netscape didn't call it "JAVA"script until Java started gaining popularity and they jumped on the naming bandwagon! They even had to ask Sun for permission to use the name, but it's been so long ago, who cares? So what's in the silly name, anyway?? No argument that JScript was a johnny-come-lately, but it *did* result in the creation of a real standard, which in the end was I think an advantage to all.
    Still have to agree to disagree, but in the grand scheme of things, it doesn't make a bit of difference to me either.

    Quote Originally Posted by Old Pedant View Post
    I only pointed out the possibility out of a sense of completeness.
    I understand that, I know where you're coming from.

    Thanks for the better than usual discussion! Have a good one!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •