Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PHP -OO or Functional for speed/ knowledge demonstration?

  1. Jan 24, 2009 #1

    jgg

    User Avatar

    My second PHP question this week....:smile:

    I'm writing a PHP app which includes things such as form validation and database interaction. So far, almost everything has been written procedurally. However, I started playing around with PHP's OO stuff, and it's cool. Problem is, this app is being submitted for a competition, and it's graded both on speed and how well I know the language. It would make me seem more 'knowledgeable' (I think) if I broke everything up into object, but on the other hand it requires more lines of code than doing it procedurally. So which should I go with? I hear that OO is slower (and thinking about it this makes sense), however I wanted verification.
     
  2. jcsd
  3. Jan 24, 2009 #2

    jgg

    User Avatar

    ...allow me to add the program will barely reach 200 lines (counting comments, not counting HTML code), if even that.
     
  4. Jan 31, 2009 #3
    You're project doesn't seem like it need the to be OOP, because design wise you don't have anything to gain from using OOP. Don't get me wrong OOP is nice, but it is a waste if it doesn't clean up your code, or use OOP features like polymorphism or inheritance. If you are trying to make you code tight the best way to do that it to avoid clauses on validation and use regular expressions instead.

    I programmed in PHP for a few years, there was only one case that it was really convient to use classes.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: PHP -OO or Functional for speed/ knowledge demonstration?
  1. PHP Help ? (Replies: 16)

  2. PHP eregi function (Replies: 2)

  3. Php or c++ ? (Replies: 40)

Loading...