ASP versus PHP

Discussion in 'Webmaster Discussion' started by daviddoran, Dec 22, 2006.

  1. daviddoran

    daviddoran New Member

    David (Behan) do you use VBscript with ASP pages?

    I've been going over VBscript and I can't fathom why the language was designed as it was.
    Why does it have to be so verbose? "dim","sub","end if". I don't know why they had to rewrite the book on how to declare functions, and why not use good old braces?

    Also, the worst thing I believe is that they use single quotes ' for comments! How ridiculous!
     
  2. louie

    louie New Member

    asp is different from php by those things mentioned by you above.
    they do make sense outlined below
    dim in asp is setting a variable in php $str=NULL; or a value otherwise you get a php error

    sub is similar with functions
    end if is equal to closing } bracket.
    It makes sense.
    Now in asp you don't have to close every line with ; where in php you get an error if you don't.

    I thing those things makes the 2 languages different.
    The principles are the same.
     
  3. daviddoran

    daviddoran New Member

    I understand the language perfectly, and what their purpose is.
    What I'm questioning is the actual theory behind using these things as opposed to more standard language conventions.

    Why shoud you need to use dim if you are not type-setting?
    It makes sense in C/C++ to use
    Code:
    int myint;string s("init");
    because you are initialising the variable with a type, but with dim it's simply a redundant keyword.

    As for using the single-quote as a comment I don't know why a language designer would go against all standard language conventions and choose that.
     
  4. louie

    louie New Member

    They are trying to be different and make the two of them distinct in their own way.
     
  5. TheMenace

    TheMenace New Member

    I've seen more subtle hijackings in The Middle East to be honest.
     
  6. daviddoran

    daviddoran New Member

    Thanks for moving the thread, whoever did. For the record it's not a PHP vs ASP question, I was having a look into ASP(VBscript) to see about learning another web language but some of the design choices seem counter-intuitive.
    Not just compared to PHP, but compared to C/C++/Javascript etc.
     
  7. louie

    louie New Member

    I moved it.
    About the name was the first thing that came into my mind.
     
  8. grandad

    grandad Moderator

    It wasn't designed as such AFAIK. It just evolved.

    First there was BASIC [God bless it!]. Then Microsft produced their own version - QBasic which was included in DOS. That became Quick Basic which was a standalone product. That in turn became Visual Basic, when Windows became more widespread.

    Microsoft then modified Visual Basic to run as the programming language for Office, and it became known as VBasic.

    This in turn was modified into VBscript for use as a serverside language,

    Hence, you will find a LOT of old BASICy things in the language.

    There again, I might be wrong!

    Anyone still able to program in BASIC? :rolleyes:
     
  9. TheMenace

    TheMenace New Member

    I use ASP as I needed to learn it in my first job with an e-learning company. Even though I know PHP is better and more versatile, I can't quite bring myself to learn it for the want to learn something a little more powerful like Ruby on Rails or Java. Mind you, I haven't made much of a dent in either of them.
     
  10. daviddoran

    daviddoran New Member

    I'm looking to expand into another language. PHP is great and because it's almost universally supported there's no problem pitching a project in PHP.
    However, I'd still like to have JSP or ASP or the like for "corporate" jobs.

    Python seems to be on the up at the moment. Despite its unconventional style, the lack of braces does actually improve readability.

    PHP is very easy to use though, it's very easy to pick up if you had to modify a script or add to it etc.
     
  11. louie

    louie New Member

    Having a background in both of them for few years I could say the same thing about ASP.
     
  12. daviddoran

    daviddoran New Member

    I wasn't saying ASP isn't.
     
  13. kbannon

    kbannon New Member

    VBScript only has one datatype - type variant (but has several sub-datatypes). Even still, how would you declare a variable without 'Dim'?
    var1 = new Variant?
    I guess it could have been do-able but I like the fact that there is something there to help declare variables.
     
  14. daviddoran

    daviddoran New Member

    I suppose I would rather:
    - No keyword at all.
    - or something more representative of its function like var varName = 'value';
     
  15. Sparks

    Sparks New Member

    PHP is the better language - on a boring day, I'd go so far as to say it's the only one that deserves the title "language". Problem is that that really only goes for PHP5; PHP3 and PHP4 were really just the unix equivalent to ASP, and as to the pre-PHP3 stuff, it was pretty much just m4.

    Put it this way - I took this job to get away from ASP, .NET and VBscript. Yes, you can write maintainable code in both, but VBscript is like Perl without the positive points; it's too damn easy to write bad and unmaintainable code in it. On top of which are all the automated tools that just lump huge blots of computer-written (and damn near computer-readable-only) code into projects.

    And on top of that there's the point that ASP usually goes along with MSSQL...
     
  16. rsynnott

    rsynnott New Member

    Neither, please. :)

    Both are impressively unpleasant. ASP.NET isn't so bad, but classic ASP is really dreadful, as is PHP.
     
  17. gary.b

    gary.b New Member

  18. TheMenace

    TheMenace New Member

    I'm enjoying doing a bit of Ruby at the moment but I'm serious thinking of dumping it all and learning J2EE.
     
  19. daviddoran

    daviddoran New Member

    Ah, it was only a matter of time before someone brought up Ruby (on rails).
    What I'd be worried about is spending time learning a language that I wouldn't use much or that was hard to deploy because hosting environments didn't support it. Though more and more hosting services support Python/Ruby now :)
     
  20. Sparks

    Sparks New Member

    Meh. If you're heading towards J2EE, you're heading towards a whole other realm outside scripting languages anyway.



    ps. Java sucks. So does C++. Why we're not all using objective-C I'll never fully understand...
     

Share This Page