PHP -OO or Functional for speed/ knowledge demonstration?

Click For Summary
SUMMARY

The discussion centers on the choice between Object-Oriented Programming (OOP) and procedural programming in PHP for a competition project. The consensus is that while OOP can enhance code organization and demonstrate knowledge of the language, it may not be necessary for a small application with fewer than 200 lines of code. The participants emphasize that OOP features like polymorphism and inheritance should only be utilized when they provide tangible benefits, such as code clarity or reusability. For this specific project, procedural programming is recommended for its simplicity and efficiency.

PREREQUISITES
  • Understanding of PHP syntax and basic programming concepts
  • Familiarity with Object-Oriented Programming principles in PHP
  • Knowledge of form validation techniques in PHP
  • Experience with regular expressions for data validation
NEXT STEPS
  • Explore PHP OOP features such as classes, inheritance, and polymorphism
  • Research best practices for procedural programming in PHP
  • Learn about efficient form validation techniques in PHP
  • Study the use of regular expressions for data validation in PHP
USEFUL FOR

PHP developers, software engineers, and students preparing for programming competitions who seek to optimize their coding practices and understand the implications of using OOP versus procedural programming.

jgg
Messages
40
Reaction score
0
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.
 
Technology news on Phys.org
...allow me to add the program will barely reach 200 lines (counting comments, not counting HTML code), if even that.
 
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.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 15 ·
Replies
15
Views
7K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 95 ·
4
Replies
95
Views
7K
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K