OOP vs Procedural
View Single Post
05-18-2012, 01:51 PM
Ivan Ivković, Croatia
Join Date: May 2012
"What are the advantages of using OOP over procedural?"
-OOP has features you can never use with procedural work. Magic methods (example : __get class function (method)is called every time you try to access a variable from object (attribute) that does not exist), so you can do all sorts of tricks with magic methods.
-You split your program in chunks all having their purpose.
-Less code, more functionality. Smart code, in general. In procedural you have to include or copy bunch of stuff over and over again.
-You change a class method, you change it in the whole program.
-I can continue on, but you just have to try it. :P
Take the following function, and if I were to make this into a class (which I have no idea how to yet!) what would I gain ?
-It's not so much in your particular piece of code that would change, your application structure would change, probably resulting in less code.
View Public Profile
Send a private message to ivanivkovich
Find More Posts by ivanivkovich