FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Object-oriented programming Vs procedural






Do you use Object-oriented programming concept?
Yes
85%
 85%  [ 12 ]
No
7%
 7%  [ 1 ]
Trying to, but I find it hard to understand
7%
 7%  [ 1 ]
Total Votes : 14

flatliner
Object-oriented programming Vs procedural

Welcome fellow programmers
Only about a week again did i finally get around to using OOP in a PHP 5 project of mine, rewritting most of the code. For months I had put it off, as I couldnt see how it was so much better and even the concept of putting it into real life programming task seem abit hard to get my head around. But I finally did it and for all the better. It has made my code so much more reuseable to the piont that so far in my project recode I have stripped 30kb's of code from the files of the system and still alot more to go.
I only know the basics of it but already it has made my code alot better and I hope to learn more about it in time and implement it in furture projects.Very Happy

Whats your opinion of OOP ?
Do you use it ?

Another question I would like to put to people is... If you do use OOP, have you built a class library for yourself that you would use over and over again in varies projects.

I myself am developing a class Library, which I am using in a large enough project.
The class lib at the moment consists of a range of database methods access MySQL
and also a range upload methods and spam/censor methods. All extremely adaptable to any project.
Very useful indeed
rvec
I don't have many big projects. My biggest one atm is about 300 lines. But I want to learn OOP and I started with reading about it and using as functions when I can to get familiar with those.

I tried using classes a couple of times now but every time I ended in just using functions.
flatliner
yea I know what ya mean, I was inclined to do that myself. yes for small projects functions would probably be more effective, but I have a few personal projects that have big large over the year or so. One project I started when I was just starting to learn PHP and Mysql. It was a away to learn, so I tried to build a User and admin friendly forum application from scratch. Neediness to say the first build of the app wasn't very good. I left the project for 5 months and came back to it and rewrote a lot of it in more function based and more dynamic code. This is the current build of the app, although it looks like I will be completely rewritings it when I get around to it in PHP 5 OOP concept.

The great thing about OOP the classes I have written so far are so reusable they can be just copied and pasted.
Peterssidan
I have not started to use OOP in PHP yet. I know OOP from Java very well so I don't think I should have any big problems to start use it in PHP too but programming for a page feels different from making a program.
I don't feel 100% comfortable in PHP yet but maybe I try it in a project in the future.
Arnie
No, procedural makes much more sense to me. It's kind of analog to mathematical functions / operators.
flatliner
Arnie wrote:
No, procedural makes much more sense to me. It's kind of analog to mathematical functions / operators.


Oh yes I would agree it is easier to understand at first look procedural, but once you get into oop it really opens up your eyes to see how useful oop is.
snowboardalliance
I've only used procedural php (when frihost had php4 because php4 OOP sucks), but I do use OOP in c++ (and java, but that's only OO). However, if I get to making a new php site, I will use OOP.
flatliner
Thanks for the replys everyone, any1 else got an opinion on the subject??
bigt
flatliner wrote:
Thanks for the replys everyone, any1 else got an opinion on the subject??


I've done a pretty good job of using OOP over procedural. Guess I do find myself in a 'procedural rut' sometimes, but anything I start is most likely going to use OOP.
flatliner
Any more opinions on the subject people?

Another question I would like to put to people is... If you do use OOP, have you built a class library for yourself that you would use over and over again in varies projects??
Star Wars Fanatic
I don't have too many projects, mainly just small things, but yes, I am slowly building a class library that I use over and over again.

Right now I'm working on a fairly big project, and I'm recoding from an earlier build that didn't use OOP. It is definitely better in all aspects.

However, I haven't done anything in the order of what you described in your first post, the biggest stuff I'm working with right now is only on the order of 500 lines of code or so.
But once it gets bigger, using OOP is a necessity. Even now, using OOP is quite delightful, and very useful.
Fire Boar
I do use OOP for larger projects, but very basic one-time scripts (which is the vast majority of what I do) are much more practical with procedural programming. However, I have made classes for dealing with RSS, XML parsing, CAPTCHA and templating in my time, and I use them whenever I need them because it saves a lot of work when you can just reuse code from somewhere else.
flatliner
Star Wars Fanatic wrote:
I don't have too many projects, mainly just small things, but yes, I am slowly building a class library that I use over and over again.

Right now I'm working on a fairly big project, and I'm recoding from an earlier build that didn't use OOP. It is definitely better in all aspects.

However, I haven't done anything in the order of what you described in your first post, the biggest stuff I'm working with right now is only on the order of 500 lines of code or so.
But once it gets bigger, using OOP is a necessity. Even now, using OOP is quite delightful, and very useful.


Yes I would agree, you really see how much better it is when you recode a project in OOP, it really reduces the amount of code and the time it takes.

Thanks for your feedback everyone Very Happy
AOP Web Development
For me, i create my own libraries such for intended for mysql class, email class, validator class and etc. for my projects, the very first reason is it makes you very easy to handle and don't need to right over and over again... that is why i really love OOP, and that is very useful specially when using PHP Frameworks...
Related topics
Java
Google in your scripts
Programming links, info, and tutorials
PHP VS ASP
Beginning Programming... Help!
Mainframes versus Object oriented languages
PROLOG programming
I need help with programming...
Object Oriented API Programming in C++ Tutorial needed
My guide to Object Oriented Programming
Everything object oriented - WHY?!
Programming in Java
Introduction to C++ Programming+First Program
what is a good programming language for beginers?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.