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.

PHP OOP (how often you use it?)

Discussion in 'PHP' started by tdd1984, Mar 27, 2008.

  1. #1
    You know I been working with php for quite some time now and I still don't use OOP which don't take me wrong I do ,but I only use it for maybe things such as paginations and similar items such as that, but most of my code is procedural..

    so my question is how often do you guys use OOP I've talked to some guys thats been working with PHP since the beginning of time and some of them hardly even use it.
     
    tdd1984, Mar 27, 2008 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not near as much as I should, I guess. But after all these years procedural just comes naturally to me. Though I am improving lately :)
     
    CreativeClans, Mar 27, 2008 IP
  3. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #3
    What do you think of MVC's?

    Like Zend Frame Work and etc?
     
    tdd1984, Mar 27, 2008 IP
  4. pfek

    pfek Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #4
    I personally believe it should always be used if you plan to re-use your code. It is always a little more efforts, but the benefits will be worth it. Procedural can be a good solution for small programs or websites without a lot of dynamic content.

    This has always been a good debate, but look at the biggest Frameworks, CMS, CRM most of them are using OOP as their programming paradigm.
     
    pfek, Mar 27, 2008 IP
  5. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #5
    True...

    I just feel more comfortable working with my own code which don't take me wrong I use other peoples code, but I've never really got into using Frameworks I mainly just use all my won classes such as my pagination, e-mail class, admin class, and etc.
     
    tdd1984, Mar 27, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #6
    It really depends on the type of work you do. I tend to use OOP when it is required to scrape external data, such as backlinks (i.e. $yahooBacklinks = $Class::YahooBacklinks('domain.com') ), as its a clean way of modifying specific code. It also allows for easy extension.
     
    jayshah, Mar 27, 2008 IP
  7. SimThePhpCoder

    SimThePhpCoder Well-Known Member

    Messages:
    949
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #7
    I only use it when working with other code that uses OOP. when writing my own code. I don't use it. ;\
     
    SimThePhpCoder, Mar 27, 2008 IP
  8. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #8
    I prefer coding functions than objects, but in a team environment, classes must be used because it is a requirement.
     
    Kaizoku, Mar 27, 2008 IP
  9. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #9
    What do you mean in a team environment are you referring to working with other people?
     
    tdd1984, Mar 27, 2008 IP
  10. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #10
    Yes, team = more than 1 person, does it not? lol
     
    Kaizoku, Mar 27, 2008 IP
  11. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #11
    What would you do for classes?

    I mean the whole website like the user login, and etc?
     
    tdd1984, Mar 27, 2008 IP
  12. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #12
    A website like that is small, and classes won't be needed. In a team environment (5 or more people), project is big, classes will be needed to manage the framework.
     
    Kaizoku, Mar 27, 2008 IP
  13. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #13
    Damn how large of a project would you be working on that needs 5 people?

    When you say framework are you referring to numerous classes or something like zendframework such as MVC and etc?
     
    tdd1984, Mar 27, 2008 IP
  14. soumya.b

    soumya.b Guest

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I'm using the OOP concept in PHP. It's Gr8
     
    soumya.b, Mar 27, 2008 IP
  15. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #15
    The only time that I don't use OOP is when I am just throwing in quick tests to verify something or making a simple helper function. If you don't use OOP, you're either only working on small projects or missing out on its value. Even when working with just one other, it is very useful (hell, it's very useful when flying solo), but it's practically necessary when you maintain several apps with a team of developers.
     
    Gordaen, Mar 28, 2008 IP
  16. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Any PHP script that takes more than an hour to complete which is pretty much every time. When you start dealing with large projects you can really appreciate how much OOP makes things easier to manage.
     
    InFloW, Mar 28, 2008 IP
  17. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #17
    My more serious programming projects are almost purely done in object orientated programming. There are a few things that aren't done in such a way such as the sites entry point (eg. index.php) as well as things like the config and global files (base info needed for the site to work), a basic function library and the language sources and templates. The templates are of course done in php using php itself as the parser rather than smarty or something a like. Rebuilding it that way from the previous way significantly increased the page render times.

    The way that it's coded with all the oop makes it so easy to add features with minimal editing and alot of code is reused so the files tend to be smaller (basing on my projects observations).

    MVC style works really well, i've tried it on occasions and I really like using that pattern.
     
    chopsticks, Mar 28, 2008 IP
  18. Morishani

    Morishani Peon

    Messages:
    239
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #18
    I love OOP but seems like PHP is not going to the direction of 'high level' programming, type hinting, variable types etc',

    Lately I'm thinking about abandoning PHP for ASP.net (c# syntax of course) becouse of this.
     
    Morishani, Mar 29, 2008 IP
  19. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #19
    I stick with whatever conventions already exist in what I'm working on.
    Most of my work consists of adding functionality & improving performance.

    When I'm done, I want the owner to say "works great !" and their programmer(s) to say "what did you do ?"
     
    joebert, Mar 29, 2008 IP
  20. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #20
    This thread drew major attention :)
     
    tdd1984, Mar 30, 2008 IP