View Single Post
Old 05-18-2012, 01:51 PM   #4 (permalink)
ivanivkovich
Ivan Ivković, Croatia
 
ivanivkovich's Avatar
 
Join Date: May 2012
Posts: 7
Thanks: 0
ivanivkovich is on a distinguished road
Default

"What are the advantages of using OOP over procedural?"
-Code reusability.
-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.
Send a message via Skype™ to ivanivkovich
ivanivkovich is offline  
Reply With Quote