Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: OOP

  1. #1
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default OOP

    I am starting to work alot with OOP (Object oriented programming).

    I am not sure exactly what to make to extend my knowledge of PHP.

    If you have any ideas of things you may want tell me.

    I still don't know THAT much about OOP but I am hoping to learn.

    Caleb.

  2. #2
    Join Date
    Jul 2007
    Posts
    26
    Tokens
    0

    Default

    Are you hoping to learn OOP theory? If so PHP is not the language to do it in, its OOP support sucks. If you're only wanting to learn OOP in practice you should at the very least study its (dis)advantages.

    Sometimes choosing a paradigm over another can be a good design choice, or not.
    (define (reduce f)((lambda (value) (if (equal? value f) f (reduce value))) (let r ((f f) (g ())) (cond ((not (pair? f)) (if (null? g) f (if (eq? f (car g)) (cadr g) (r f (caddr g))))) ((and (pair? (car f)) (= 2 (length f)) (eq? 'lambda (caar f))) (r (caddar f) (list (cadar f) (r (cadr f) g) g))) ((and (not (null? g)) (= 3 (length f)) (eq? 'lambda (car f))) (cons 'lambda (r (cdr f) (list (cadr f) (delay (cadr f)) g)))) (else (map (lambda (x) (r x g)) f))))))

  3. #3
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    No, I am wanting to continue my knowledge of PHP with OOP.

    C# i have heard is a good language for what you said

  4. #4
    Join Date
    Jul 2007
    Posts
    26
    Tokens
    0

    Default

    Quote Originally Posted by Dentafrice, View Post
    No, I am wanting to continue my knowledge of PHP with OOP.

    C# i have heard is a good language for what you said
    If PHP's OOP support is as terrible as everyone says it is, there may not be a point to writing that way.

    C# isn't bad for OOP. I wouldn't use it to learn theory, though.
    (define (reduce f)((lambda (value) (if (equal? value f) f (reduce value))) (let r ((f f) (g ())) (cond ((not (pair? f)) (if (null? g) f (if (eq? f (car g)) (cadr g) (r f (caddr g))))) ((and (pair? (car f)) (= 2 (length f)) (eq? 'lambda (caar f))) (r (caddar f) (list (cadar f) (r (cadr f) g) g))) ((and (not (null? g)) (= 3 (length f)) (eq? 'lambda (car f))) (cons 'lambda (r (cdr f) (list (cadr f) (delay (cadr f)) g)))) (else (map (lambda (x) (r x g)) f))))))

  5. #5
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Tbh, I have only been working with the basics.

    I like it, I find it way easier and cuts down loads on work.

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    OOP in PHP is great.. what the hell are you talking about? PHP4 has OOP support, but you really need to use PHP5 to get full OOP support.

    Also just using classes does not make your project OO. Your classes should be designed in such a way that it can do its stuff transparently to the script using it, you should learn about polymorphism. The main advantage to using OO is that your objects should become independent of your project (As long as you use loose coupling).

    Example of polymorphism (Language independant):

    You want to read a file containing some sort of data but that data could be in more than one file type. Lets say we want to be able to parse XML and some other format (.myconfig for this example). The program creates a new "reader" object and give it the file (XML or .myconfig), then the reader object, using polymorphism, makes a desision on if the file is XML or .myconfig and returns the appropriate class (XMLReader and ConfigReader). Both classes have the same functions and as far as the program is concerned it just loaded a reader class. This is an example of polymorphism. Not only does this make you script loosely coupled you can easily add other readers for different file types without extensive modification.

  7. #7
    Join Date
    Jul 2007
    Posts
    26
    Tokens
    0

    Default

    OOP in PHP is great, yet it was included as an afterthought? I'm sorry, you may think it's great, but considering you're coding in PHP I'm not going to take your word over the thousands of others who study computer science and languages and call PHP meager.

    Your game is web development, mine is computer science and programming.
    Last edited by Lambda; 07-09-2007 at 12:19 PM.
    (define (reduce f)((lambda (value) (if (equal? value f) f (reduce value))) (let r ((f f) (g ())) (cond ((not (pair? f)) (if (null? g) f (if (eq? f (car g)) (cadr g) (r f (caddr g))))) ((and (pair? (car f)) (= 2 (length f)) (eq? 'lambda (caar f))) (r (caddar f) (list (cadar f) (r (cadr f) g) g))) ((and (not (null? g)) (= 3 (length f)) (eq? 'lambda (car f))) (cons 'lambda (r (cdr f) (list (cadr f) (delay (cadr f)) g)))) (else (map (lambda (x) (r x g)) f))))))

  8. #8
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Jesus, you are really starting to annoy me. If PHP is meager why is it used by companys such as Yahoo over coding a custom C++ system? PHP was included as an afterthought in PHP4 but in PHP5 one of its main elements was OOP. The OOP in PHP4 was okay but the OOP support in PHP5 is a vast improvement. Sure it may no compare to OOP languages such as Java where there is total focus on OOP, but then again PHP is not a pure OO language.

    Plus PHP is a web-language, its not support to be used for creating desktop applications so its not going to have all the power of C# or C++ is it? PHP is, as far as I am concerned, the best web programming language (That is designed to execute on web servers for the purpose of serving webpages with dynamic content). For the following reasons:
    • Opensource, so its free and has a large community that will help you.
    • Cross-Platform/Web Server, unlike ASP or ASP.net that will only run on IIS servers running Windows Server 2003 (Exception of ASP that has a 3rd party module for Apache)
    • Large extension repository
    • PHP is becoming used more and more by enterprise organizations because of the power of the language and the fact it's opensource and free.
    Plus my "game" is not web development, sure I do web development but I also do development for desktop applications and I also "do" computer science.

    Lets take ASP.Net as a competitor. Why would I pick PHP over ASP.Net (Note: I have worked with ASP.Net before)? Well to start with, I would be limiting the server to a Windows platform. PHP (In my mind) is easier than ASP.Net and gets the job done faster. Lets say I wanted to setup a big website that would span multiple servers, I would have to buy licenses for each server - cost allot of money.

    Plus whom are these thousands of others who call PHP meager that you refer to?

    PHP currently has over 20,000,000 (Yes, 20 million) sites currently using it, so I guess that they all must be doing something wrong?

    Also do a google search for PHP script then try another language such as ASP.Net or ColdFusion (Have a guess what you might think you'll find).

    Got my point?

    Thanks,

    Tom

    Quote Originally Posted by Lambda View Post
    OOP in PHP is great, yet it was included as an afterthought? I'm sorry, you may think it's great, but considering you're coding in PHP I'm not going to take your word over the thousands of others who study computer science and languages and call PHP meager.

    Your game is web development, mine is computer science and programming.

  9. #9
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Wow Tom, owned +REP

  10. #10
    Join Date
    Jul 2007
    Posts
    26
    Tokens
    0

    Default

    Quote Originally Posted by Tomm View Post
    Jesus, you are really starting to annoy me. If PHP is meager why is it used by companys such as Yahoo over coding a custom C++ system? PHP was included as an afterthought in PHP4 but in PHP5 one of its main elements was OOP. The OOP in PHP4 was okay but the OOP support in PHP5 is a vast improvement. Sure it may no compare to OOP languages such as Java where there is total focus on OOP, but then again PHP is not a pure OO language.

    Plus PHP is a web-language, its not support to be used for creating desktop applications so its not going to have all the power of C# or C++ is it? PHP is, as far as I am concerned, the best web programming language (That is designed to execute on web servers for the purpose of serving webpages with dynamic content). For the following reasons:
    • Opensource, so its free and has a large community that will help you.
    • Cross-Platform/Web Server, unlike ASP or ASP.net that will only run on IIS servers running Windows Server 2003 (Exception of ASP that has a 3rd party module for Apache)
    • Large extension repository
    • PHP is becoming used more and more by enterprise organizations because of the power of the language and the fact it's opensource and free.
    Plus my "game" is not web development, sure I do web development but I also do development for desktop applications and I also "do" computer science.

    Lets take ASP.Net as a competitor. Why would I pick PHP over ASP.Net (Note: I have worked with ASP.Net before)? Well to start with, I would be limiting the server to a Windows platform. PHP (In my mind) is easier than ASP.Net and gets the job done faster. Lets say I wanted to setup a big website that would span multiple servers, I would have to buy licenses for each server - cost allot of money.

    Plus whom are these thousands of others who call PHP meager that you refer to?

    PHP currently has over 20,000,000 (Yes, 20 million) sites currently using it, so I guess that they all must be doing something wrong?

    Also do a google search for PHP script then try another language such as ASP.Net or ColdFusion (Have a guess what you might think you'll find).

    Got my point?

    Thanks,

    Tom
    Ever so pointless, I didn't deny any of that. PHP is one of the best rounded solutions to web development, which I have not denied, although I prefer other languages to PHP for a backend. I have not argued against anything you have mentioned; what you have neglected to mention and what I have argued against is PHP's value from the perspective of semantics and design. As it stands PHP is not as well designed as many solutions that fill the same niche and other.

    I apologize for any misunderstandings here, because that is evidently what has happened. I am not criticizing PHP in real practice, just in the study of theory, where your points have no merit.
    (define (reduce f)((lambda (value) (if (equal? value f) f (reduce value))) (let r ((f f) (g ())) (cond ((not (pair? f)) (if (null? g) f (if (eq? f (car g)) (cadr g) (r f (caddr g))))) ((and (pair? (car f)) (= 2 (length f)) (eq? 'lambda (caar f))) (r (caddar f) (list (cadar f) (r (cadr f) g) g))) ((and (not (null? g)) (= 3 (length f)) (eq? 'lambda (car f))) (cons 'lambda (r (cdr f) (list (cadr f) (delay (cadr f)) g)))) (else (map (lambda (x) (r x g)) f))))))

Page 1 of 2 12 LastLast

Posting Permissions

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