1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is better PHP or ASP?????

Discussion in 'Programming' started by keral82, Dec 5, 2005.

  1. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #21
    Price does not equal quality (this has been pointed out before), don't make stupid assumptions :p

    This has already been mentioned, so I'll just quote the guy:
    Exactly. How can you not understand dot-notation. What's wrong with you? :p

    Whilest I havent taught anyone is an "official" capacity (ie, paid lecturer, etc), I have taught ASP to close to 100 people from all walks of life, including teaching vb 6 (which ASP is based one). Trust me, everyone says that ASP is easier to learn

    I see what your problem is: you aren't able to understand the principles of the syntax because you seem to be too used to having brackets seperating everything. Not my problem, then. But don't go claiming a 'universal truth' because you can't grasp the syntax.

    Why would I? That's logical, and i've already sort of mentioned that.

    First of all we learnt ASP after html, that's how it should alway work. Secondly, we had guys with previous programming experience come to learn ASP, as at the time, all the vacancies where for ASP coders. They all found ASP easier (although, the guys with other experience obviously had difficulty adjusting to the syntax). So yeah, you've just agreed to one of my previous points:

    Now then, I assume this argument has been resolved?
     
    relixx, Dec 7, 2005 IP
  2. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #22
    ...
    "Just cuz its an expensive book doesnt mean its good"
    I am not saying that, im telling you its a good book, by an author who does many books, its why its expensive. So please don't make assumptions that its a bad book. It was long and detailed, and got me confused all the time.

    "ASP learners learned ASP before HTML"
    WOW, WTF, who the hell learns a serverside before they learn the basics of the web, such as HTML. You can't do ASP without knowing HTML, if what you say is true, i pitty you. And now understand why you find ASP easier.

    im not use to the brackets. Trust me, its confusing to use
    if something then
    something
    end if
    i cant tell if its end, and then start another if??? or if its the end of if. I dont know whether to put then on the first line or the second line, or together with the second line. But this is a simplified analogy, obviously i know how to write an if else statement in ASP, but what i'm talking about is when it gets more complex. My friend knows ASP and PHP, he said PHP was much easier to learn, so does all of my other friends who've tried both.

    obviously dot notation doesnt make me go "wtf"... ok ? Sorry, if you can't understand my analogy, its the fact that i have to write more. I have lengthy experience in Javascript which uses dots all the time. The fact that i have to write more just to get my point accross makes it difficult, and in big codes, you might get more confused, as PHP is clearer and more organized looking. I can scan through a complex class of XSL and XML and understand whats going on, while if i went through a complex DOM library like DOJO i get confused most of the time even if i understand it; it takes time. Because its a poorly written language (its a fact).

    Javascript is probably one of the hardest languages out there, because everything about it is vague, and every browser reacts differently, and it is poorly documented. And everyone writes it wrong most of the time. VBscript and ASP is the same story. But then again i guess you guys find ASP easier, then fine let it be that way.

    Fact boils down to this: Preference.
    Try both, and see which one comes easier.
     
    execute, Dec 8, 2005 IP
  3. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #23
    Whoops, didn't notice that error. Corrected it. I had lots on my mind at the time :p

    Tip for the future: it's all in the syntax structure. generally, every line means a new line of code, thus 'end if' signifies the end of an if statement. That's how they work around the lack of brackets :)

    all the beginners I know find ASP easier :p (ok, I'll stop stirring the pot :D)
     
    relixx, Dec 8, 2005 IP
  4. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #24
    I don't trust you, because it's not confusing.
    if ([i]condition[/i]) {
            [i]statement(s);[/i]
    }
    
    If [i]condition[/i] Then
            [i]statement(s)[/i]
    End If
    Code (markup):
    Both are just as simple. There are, however, other languages such as Lisp that does get a bit tricky. Like I said before, if mere syntax is enough to confuse you then you should consider a different profession.
    Apparently you don't know what an analogy is either, because you didn't make one. You made a statement of fact: "Dot notation is frickin hard to understand."
    If you understood it then you wouldn't be confused. That's what it means to understand. Besides, I don't think anyone could use your confusion as a basis to judge a language. After all, you did say you got confused by the best book there is.
    Not even close.
    Vague? How do you mean?
    Browsers react differently? Yes, however, if you're programming in C or C++ or any other compiled language then you have to worry about different compilers on different platforms interpreting your code in different ways. This is something you'll simply have to get used to.
    Poorly document? Not a chance. The documentation is very specific and very detailed.
     
    FeelLikeANut, Dec 8, 2005 IP
  5. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #25
    wow, feellikeanut or whatever, you need to stop trying to piss people off.
    "i dont trust you, because its not confusing"
    How old are you?

    "Both are just as simple. There are, however, other languages such as Lisp that does get a bit tricky. Like I said before, if mere syntax is enough to confuse you then you should consider a different profession."
    Now you're just being an ass. I told you its not the syntax, it's how the code turns out when you write a big code, you loose your logical track on where things are, yet in PHP you can know variables by $, as some people might get confused by functions and variables (Like in javascript).

    "Apparently you don't know what an analogy is either, because you didn't make one. You made a statement of fact: "Dot notation is frickin hard to understand.""
    Again, grow up. You know what i meant, if you don't i pitty your intelligence. As i said before, obviously response.write is easy, but when it gets a bit more complex (and yes it can) most people will completely become confused. When i say its hard, its hard for someone with no experience. Obviously its not hard for me, because i been doing javascript for many years.

    "If you understood it then you wouldn't be confused. That's what it means to understand. Besides, I don't think anyone could use your confusion as a basis to judge a language. After all, you did say you got confused by the best book there is."
    If you notice im not trying to write an essay here, obviously im not gonna waste my time writing for 10 minutes so people like you can understand what i mean. Let me explain and rephrase: I understood the DOJO DOM code, but it still took me a while since i was confused most of the time, BUT i understood what was going on.
    Is that clearer for you? Or would you like me to get a transalator?

    "Not even close."
    For a programmer, you sure don't know what you're talking about. Javascript is easy to learn, but i can test you on it and still fail you, because the DOM and the large library of functions and methods will eventually make you forget. However in a server side language, you will probably know 90% of the functions and methods, because they are usually better written languages. As javascript is known to be written poorly.

    What i mean by vague is the fact that its hard to understand sometimes (when it gets complex). But together with DOM, JSON, AJAX, and everything else in JS, JS becomes one of the hardest languages. I'm not that familiar with C++/C/C#, but yeah they are probably harder. As i said "one of" the hardest languages. Not because its hard to do stuff with it, but in the long run with all the functions and methods.

    Have i been clear enough for you? I'm gonna assume i am, if i'm still not clear to you, please reread my post, or stop posting because it will go on forever, as you seem to attempt to find every little mistake i did.

    BTW: Relixx thx for making it clearer. (*is thankful you and your friends learned HTML first*)
     
    execute, Dec 8, 2005 IP
  6. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #26
    There are many, many languages that do not use a special character to mark a variable. These arguments you come up with don't just say ASP is harder, they say everything is harder than PHP.
    More confusing? At best I can guess you mean something like 'list.first.item.data'. So would this be easier? '$list->first->item->data'? The latter example is PHP. So is PHP actually easier? Or maybe it's object oriented programming that you actually think is difficult. (Just trying to figure out what it is that you actually find difficult.)
    This is blatant ignorance. I see you don't realize how many functions are built in to PHP. (PHP has at least 5,000 library functions, and possibly as many as 10,000.) PHP's library of functions is easily many times larger than the DOM and the JS library. So if the size of the library is your basis of judging difficulty then PHP is by far harder than JavaScript.
    Actually, it's PHP that is often cited as being a poor language. <http://www.ukuug.org/events/linux2002/papers/html/php/>
    JavaScript, on the other hand, is not "known" for being poorly written. That may be your opinion but there is certainly no consensus on that conclusion.
     
    FeelLikeANut, Dec 8, 2005 IP
  7. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #27
    OK, I promised myself I wouldn't get into another one of these discussions. jimrthy will have to go iron his ears after this. ;)

    I'm quoting different people from different posts, and I'm being sloppy about it. I apologize in advance; it's been a long day.

    I started playing with it this morning. It's sick. Think Visual Basic on crack. Point, click, you have a web app. <Yawn>. Now, what shall I cook for breakfast?

    I'm going to guess that also means that, like VB, if you want to do something the developers didn't plan, you're going to lose a lot of sleep.

    Someone else earlier in the thread mentioned something about "classic ASP syntax." As far as I can tell, this version abandons the idea completely. When you're creating something new to add to your site, it asks whether you want to do the programming in vb.net or c#.

    In general, I absolutely agree with you. Not in this particular instance. I think "echo" (or "print") is perfectly straightforward and doesn't really clutter up the global namespace.

    Well, that can sort of depend on the language. Yes, it is. But, if you're dealing with some sort of nasty low level language (like, say, Whitespace), most non-gurus will be so overwhelmed by the syntax and details that they forget to worry about the logic.

    This is the main reason I advise people to do as much work as they possibly can in the highest level language available.

    I can't even find the source for this quote, but I saw it all over the thread.

    Dot notation probably is a new curve to a beginning programmer. I've been using it so long that it just seems natural now. Maybe when I was first learning to program, it would have been a bit much to take in. After a couple months experience...it makes life so much simpler in the long run that I wonder how people did without it.

    Besides, PHP uses the -> notation. Personally, I find that uglier and less intuitive. Then again, I consider a lot of PHP ugly.

    Okay, I think javascript has a lot of problems. But it also has a lot going for it. It's a (fairly) high level language without much functionality built into the core. The syntax is ugly, though I don't think it's as ugly as PHP or perl.

    Still, using the phrase "its a fact" in a religious discussion like this one is really just trolling. It's your opinion. I happen to agree with this opinion, but, then, I think most programming languages are poorly written. That's still just my opinion.

    If it were a fact, and I had the time/talent to fix all the problems, I'd write my own perfect proprietary language and sell it to developers to make a ton of money.

    I have to wonder about this. PHP, as a language, is probably simpler than ASP. If someone is familiar with VB (or even basic), ASP would probably be easier to learn. PHP has a much larger core library, which provides its own set of challenges. Esp since (IMO) that core library is written fairly poorly.

    Then again, I haven't had the chance to try teaching either one to a beginner.

    To an experienced programmer, they're both really fluff languages that one can "learn" (at least enough to get by on) in an afternoon. Which is about how long I spent "learning" python (at least well enough to use it professionally). Unlike php, I'm still running across bits in python, 4 years later, that suddenly make sense and make the language that much more delightful.

    But this isn't a python-advocacy thread. I'll get back on-topic now...

    This next quote concerns syntax:
    Actually, I'll argue this one to no end. Lisp is a very difficult language to understand and use. You have to be a damn good programmer to handle Lisp. Thousands of pages worth of documentation about the core library (at least for Common Lisp). Incredible power at your fingertips. A lot of things that are nearly impossible to do in other languages.

    But the syntax? It doesn't have much more syntax than assembly. (function operand1 operand2 ... operandN). Now everyone reading this post knows lisp syntax.

    Use a decent editor that also knows lisp syntax (I'm a vim fan, but for lisp, it's gotta be emacs). Follow the indentation guidelines that editor gives you. That covers all your difficulties.

    I have a friend who absolutely hates lisp/scheme because of all the parantheses. But he has no problem at all with marking off blocks with if/endif or {}. The professor who taught his scheme class must have been really awful.

    That is a completely valid opinion. I think the opposite opinion is also valid. Core javascript is easy because it's so simple. It's worth learning because there are so many "extras" like JSON and AJAX (I consider the DOM part of the core, at least in modern browsers...and I refuse to support the old crap unless I'm getting paid by the truckload for it) and because it's really the only worthwhile client-side web scripting language (IMO).

    Personally, I've found javascript much easier than, say, perl (though I freely admit that I'm very biased). But a lot of things that should be easy are difficult because the development environments suck (IMO...or maybe it's just that I haven't found a decent development platform for it).

    Then again, "hard" completely depends on your goals. I imagine it would be extremely difficult (if not impossible) to write a device driver for a sound card in PHP. Doing web page login validation is trivial in PHP, even simpler with the new asp.net, and a PITA in C.

    As far as I can tell, the next quote is about asp:
    To a degree, this is a problem with the language. I think I mentioned this issue up above. When a newb is working with asm, it's easy to get focused on which register contains what and forget about the actual point to the program.

    With a higher level language, this problem mostly goes away. At least in most that I can think of. A newb might still get lost in the syntax. (Actually, this is to be expected). Which is another (or maybe the same) reason I recommend people start out with HLL's. Focus on what you're doing. Not on how it gets done.

    Anyway, with a decent programmer, this should not be an issue. In any language. If you're having problems with it, that means the code was written by someone who didn't really understand what he was doing. (I know this is harsh. I imagine most of us have had those overnight deadline projects when we start doing for(i=gibberish();i<283;i+=moregibberish()) {foo();i-=bar();})

    Or (just possibly) it's doing something insanely complicated, and you need a few more years' experience before you start dabbling.

    But the actual topic to this thread is "What is better PHP or ASP?????"

    The answer is: it depends on the job. Learn them both. Actually, learn lots of languages. Learn how to program well. I've had lots of arguments with non-programmers about how a programmer should stick to just one language and learn it really well.

    Actually, I haven't. Once someone pulls that card, I add an ignore flag and let it go. It's not worth trying to educate someone like that. They have their opinion, and nothing I can say will change their minds.

    But. To someone who wants to learn how to program (a few years of javascript is a good start, grasshopper). Plan on learning at least 1 new language a year. Make that one of your main goals in life. I see this bit of advice over and over on the 'net. There's a reason for it: it's excellent advice, and people don't listen.

    You may wind up learning some obscure language that you never get a chance to use in the Real World. Doesn't matter. That language will expand the way you think about things and approach problems. (Hey, I could do this if I were writing the program in ThaiKungFu. Why don't I add a class that does this and saves me a lot of trouble?)

    Here again, I'm wandering off-topic. ASP vs PHP. Depends on what you want to do.

    If you're wanting to create websites for yourself, on relatively low-budget hosts, plan on PHP. You (as individual) will probably get more mileage out of it.

    If you want to get a job with a company that will pay you insane amounts of money for very little real work, learn ASP.

    If you want to develop a serious web app that handles some really hard-core problems, look into plone. There's probably something similar based on perl. Personally, I'd rather work with assembly. But that's just my opinion.

    Regards,
    James
     
    jimrthy, Dec 8, 2005 IP
    MattBeard likes this.
  8. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Very good and clever post Jimrthy!

    Javascript:
    It's not that the syntax is that hard. It's just the big picture of it. For example, PHP is written one way, if you make a mistake, you get an error, and can even display exactly what the error is, what line, and why.
    It's very easy to find your mistakes, as the debugging is done quite well.
    I say it's written well because it has many functions that help you solve problems, and it seems like PHP was thought out throughly with lots of things in mind.

    But Basically ASP vs PHP. It's preference, however, depends on your situation. If you are going to be a professional learn both, as some companies demand ASP, or PHP! I prefer PHP because i believe it is well written and more fun to work with than ASP. It was harder for me to learn ASP, and harder for many other people, which explains PARTLY why PHP is fastest growing language in the web.

    It is documented well. How many websites are there with ASP tutorials compared to PHP? What about PHP.net with a such well documented manual to PHP where everything is right there, and you can search it. I can probably go to microsoft.com and look at it's ASP help, but i wouldn't learn much.

    Javascript, is very difficult, just try looking for propper DOM XML tutorials, there are only 5-6 good ones, and w3schools. JavaScript is known as one of the hardest languages and is thought of as poorly written. If you don't believe me do some research please. Don't just give a bias article about it. Maybe not fact, but an opinion of a lot of experts.

    Javascript is very fun, and has a lot of things to do with it. But how many times have you spent hours trying to work on JavaScript and solving problems in it? It's almost impossible with IE, obviously Firefox is the only way to get some actual debugging to work. Sure you could use some try and Catch functions, but it just takes way longer to code. I was building an XML Javascript Parser one day and it took me about 2-4 hours. Yet I could have done that in PHP for probably 1 hour. (I needed to do it in javascript so dont ask why i didnt do it in PHP).

    Hmm...
    WTF is this: '$list->first->item->data'
    I don't think you know PHP buddy.

    And when you said PHP has more than 10,000 functions. Don't exagerate, and im not talking about libraries, because those things are basically optional. The only one worth knowing is CURL. PEAR and all that crap is just extra, and basically for lazy programmers. So please don't tell me that there is more PHP functions than Javascript functions, or else i'll have to count them >_>. Sure JSON is not a requirement you're write, but things like DOM are, for your purpose. And trust me there is a really a lot of words
     
    execute, Dec 8, 2005 IP
  9. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #29
    The same is true for JavaScript.
    I didn't realize that JavaScript's functions were useless. You're not making very convincing arguments here.
    Lots of things in mind, yes, but I don't know about the thoroughly part. If they thought it out thoroughly then many of the issues presented in the article I linked to earlier wouldn't exist. They also would not have been adding OOP features years later.
    The W3C's DOM Level 1 Specification should be all you need, just like PHP.net is all you need for PHP.
    I have talked and worked with some people very knowledgeable in JavaScript, and you are the only person I have ever encountered to have such opinions. So you're going to expound much more here. Describe how JavaScript is poorly written, or reference an article that already discusses the topic.
    This says far more about how accustomed you are to each language rather than anything about the languages themselves.
    Apparently you've never been introduced to the OOP features of PHP.
    http://us3.php.net/manual/en/language.oop.php
    You think PEAR is for lazy programmers?!? Well I guess that explains why you don't know about OOP much. You don't appear to be very big on code reuse. But that's a different discussion. And no, I was not talking about PEAR, I was talking about PHP's function reference. 171 different categories with an average of about 35 functions for each (about double that if you also include the constants). And, of course, the DOM doesn't put everything in the global namespace, as PHP does.
     
    FeelLikeANut, Dec 8, 2005 IP
    cornelius likes this.
  10. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #30
    you said $list->first->item->data.
    That just ruins all your credibility, obviously you know nothing about PHP classes. So please stop making stupid comments and talking as if you know everything.

    And wtf is wrong with you? With what right do you say that i dont know something, when you dont even know how to write classes in PHP.

    PEAR is a function library it makes things easier, makes them simple. It is not a necessity for PHP, i've never had a NEED to use PEAR. And i know what it is. If you think PEAR is so important, than you dont know much PHP or are too lazy to program them yourself.

    And about debugging, JavaScript does not have debugging capabilities, it is client side, it is based on the browser or your editor. IE doesn't help at all, it doesn't even give a correct error about Javascript half the time. Firefox does help, but there can be bugs in many browsers which you have to design for cross compatability, but in PHP none of that is needed because there is only one interpretter.

    "...people very knowledgeable in JavaScript..."
    shut up, all you do is make up stuff, and you dont even know what you're talking about half the time. All you try to do is mark out the simplest mistakes I write about. And try to find loopholes in my argument, you have no counter argument. If you think i'm the only one that thinks javascript is poorly written you need to read more, or find an easier job.

    And i know about the W3C DOM documentation, but can you search for functions? All you can do is use google.

    "I didn't realize that JavaScript's functions were useless. You're not making very convincing arguments here."
    I didn't say that, can't you read?

    "[Why would they have to add OOP functions later to PHP]".
    You can't make classes in Javascript. Its OOP, but yeah it needs improvement and PHP 5, provides that, every language needs improvements.

    Sorry to sound insulting, but you clearly are just argueing for the sake of argueing without any valid reasons other than boredom.
     
    execute, Dec 10, 2005 IP
    cornelius likes this.
  11. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #31
    Feel free to enlighten me then.
    I did not say it was a necessity. You said it was merely for lazy programmers, and I expressed my opinion that this view is entirely misguided. Code reuse is generally considered a good thing. You implied that code reuse is a bad thing because it is the lazy way out.
    The language itself? No. Neither does PHP. You get the errors for code in each respective language from the program that interprets the code. For PHP that is the PHP interpreter; for JavaScript it is the browser. So yes, JavaScript does have debugging capabilities just as much as PHP does.
    I will again resort to my C or C++ example, where you can test for errors in one particular compiler on one particular platform, but that does not guarentee that there will not be errors in others. This is simply how it is. Even for PHP you have to consider how your code will be interpreted in older versions of the interpreter, or with different configurations. There is nothing incredibly special about PHP here, and is why your argument is not a very good one.
    I'm trying to read more. I explicitly asked you for an article that describes what you were trying to say. But I guess you prefer ranting rather than providing convincing evidence.
    Yes. It's called the index. :rolleyes:
    You're right. What you did say is that PHP is written well "because it has many functions that help you solve problems." Well whoopdedoo. Virtually every function in every language will help you solve problems. Your argument applies to every other language just as much as it does PHP. I used sarcasm to point this out before, but the point is still there.
    Yes, you can.
    Since the question here was how well PHP was thought out from the beginning, the amount that they actually have to improve is a significant fact.
    My reason is that most of your arguements are unfounded or too vague to actually apply to anything. Anytime you actually get close to a real point, and I ask for more information, you respond instead with a mindless rant.
     
    FeelLikeANut, Dec 10, 2005 IP
  12. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #32
    I dont have a link to any articles, but i remember reading a lot of them.

    In javascript the only thing even close to a class is
    this.something
    and
    something.something

    It is object usage in javascript, not classes like in PHP.

    "C or C++"
    As i told you before, i said Javascript is one of the hardest languages not the hardest, im not that familiar with C and C++ but im sure its really complicated since i haven't found it easy to learn but then again im not trying to learn it.

    " JavaScript does not have debugging capabilities"
    What i was trying to say is. The Language itself doesn't have set rules on whats right and wrong, as one browser thinks differently from another.

    "Feel free to enlighten me then."
    In PHP you can have
    $this->var;
    $this->$key
    when you're in a class
    And when you're outside
    $somevar =& new Class1('something');
    $somevar->function();

    you cant attach 4 of them at once:
    $this->that->item->data....

    "You implied that code reuse is a bad thing because it is the lazy way out."
    I didnt try to imply it was a bad thing, i prefer coding that stuff myself, as i learn more when doing that. It is for people who do not want to do it themselves, i think its lazy, you may think its efficient, but we're both right.

    and btw... can we end this thread already? :p
     
    execute, Dec 11, 2005 IP
  13. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #33
    Well I've tried looking for these supposed articles and I can't find them. I've worked with JavaScript for a long time and I read plenty, and I have never heard JavaScript described as a difficult or poor language. So it's just your own personal distaste and not a consensus until you can provide some references.
    Objects are instianted classes. JavaScript doesn't use the word "class" (why, I don't know) but it does allow for a kind of class definition. For instance,
    function
    SomeClass
    {
    	var privateVar = 0;
    	this.publicVar = 0;
    
    	function
    	privateMethod()
    	{
    	}
    
    	this.publicMethod = function()
    	{
    	}
    }
    
    // instiante an object from this class definition
    var o = new SomeClass();
    Code (markup):
    Dead wrong. I've told you before the specification is very specific and very detailed.
    http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
    Can I assume you have a reference to the PHP documentation that states this restriction?

    Before you spend too much time looking, here's why it works. Assuming $this->that, when evaluated, represents another object (that is, a variable "that" within the class points to another object). So if $this->that is an object then we can use the arrow notation on this value. (I'll add parentheses to make what's happening more clear.)

    ( $this->that )->item

    And if item also represents an object,

    ( ( $this->that )->item )->data

    The rules for the order of precedence allow us to express the same statement without all the parentheses. Thus,

    $this->that->item->data
    Well, we're not always both right. Many of the libraries I might use (parameter parsing, MIME headers, encryption algorithms, etc.) I know I could implement myself. But I know that any code I spend even a full day writing is not going to be nearly as complete, robust, or bug-free as library code that has been reviewed in the public domain for years (this fact is what makes open source a useful model). I don't always choose to use a library because it is easier; most of the time I choose to use a library because it is, in fact, better.

    Now, if you're writing such code for the sake of learning, I see absolutely no problem with that. But when it comes to production code (that is, developing a real product, not just coding for the sake of learning) it is considered good practice to use well established libraries.
    Why would you ask me to do something you're not even willing to do yourself? You have the choice of not responding too, you know.
     
    FeelLikeANut, Dec 11, 2005 IP
  14. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #34
    i give up you win :/
    Javascript classes, yea they are called objects, but they work sort of like php classes but not quite, thats why i said there is no class, but you're right.

    When i siad there are no set rules, i mean for browsers, just like C and C++.. Differs on every browser. attachEvent doesnt work in firefox for example.

    php classes:
    $this->$key thats why i said this. $key can be a $this->that
    but i never knew you can write it $this->that->data->item
    I have never ever ever seen that. I assumed it would result in a parse error, but ofcourse ($this->that)->data could work. I never tried it.

    Good point, if you're up against a deadline then yes PEAR or other libraries could be required.

    " You have the choice of not responding too, you know."
    Oh i didn't know that ;O
     
    execute, Dec 11, 2005 IP
  15. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #35
    PHP is much better, compatible with linux, and is open source.
     
    profs77, Dec 11, 2005 IP
  16. codeteacher

    codeteacher Peon

    Messages:
    117
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #36
    PHP for sure! Not easier to learn then ASP, but sooooo much more powerful! But if you really want to program, use Perl, more compact, more functions, faster.
     
    codeteacher, Dec 12, 2005 IP
  17. texisman

    texisman Well-Known Member

    Messages:
    305
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    158
    #37
    A poll would've worked great for this thread.:)
     
    texisman, Dec 16, 2005 IP
  18. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #38
    I got burned by this a little while back. I was trying to land a contract, and part of the deal was getting an obscure PHP CMS installed and running (with apache) on my local machine. I'm a programmer, not a sys admin. I *hate* dealing with apache. Let someone else set up that stuff and let me get on with my job.

    Anyway, a big chunk of the CMS' install is it testing various php.ini settings. It's extremely finicky, and won't work if you, basically, restrict things at all. I spent most of an evening trying to get past an error where it was complaining that I had PHP configured to run as CGI rather than mod_php. Turns out the problem was that I'd installed a fresher version of PHP which, by default, disabled doing a remote file open. (It was trying something along the lines of file=open('http://blah.blah.com/test'); and failing there).

    So PHP is definitely not a "Write once, run anywhere" language.
     
    jimrthy, Dec 26, 2005 IP
  19. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #39
    Actually, I think the language specification is pretty clear about what's right/wrong. Just because the major browsers get it mostly wrong...

    Personally, I consider code reuse a very good thing. But you might have a good point that it's really better for those who already know what they're doing. The people who are more concerned with getting things done rather than learning a language.

    But this dead horse is so much fun to beat!
     
    jimrthy, Dec 26, 2005 IP
  20. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #40
    Anymore, I'd have to wonder about that. I'm really just starting to get a grasp on asp.net 2, so I don't have a definite answer. But it feels (so far) to me as though MS has left PHP in the dust.

    Icck. Use python. Much more intuitive, friendlier community, and tons more maintainable. Not to mention a more powerful development environment. Or Ruby on Rails; I've heard a lot of good things about that recently, though I haven't had a chance to really play with it myself. The only thing perl has going for it is CPAN, and that's just because the script kiddies are too lazy to learn real programming languages.
     
    jimrthy, Dec 26, 2005 IP