Jump to content
JackClarke

Class Based PHP Programming?

Recommended Posts

Hey,

 

I'm quite new to PHP and have only just started to learn it but I've come across several things that have thrown up some questions. Usercake is something that introduced me to classes in PHP but I don't know why they're used.

 

Could somebody tell me when and why you should use classes in PHP? Somebody over at MyBB suggested that the plugins system should change to use classes to prevent conflict, how would it do this? Why not just use standard functions?

 

Thanks to anyone who can explain this!

 

Jack

Share this post


Link to post
Share on other sites

It sounds like you are new to programming.

 

I assume by "classes based" you actually mean Object-Oriented Programming (OOP).

Function based would be called procedural programming.

 

Long story short, if you want less headaches, use OOP paradigm

http://www.linuxjournal.com/content/programmer%E2%80%99s-discussion-procedural-vs-oo

http://www.chrispian.com/php-oop-or-procedural/

Share this post


Link to post
Share on other sites

Ah I see thanks for explaining the correct terminology to me. I now understand it a little better although I still need to get my head around OOP with PHP because I found PP far easier when I built my first CMS. Over at MyBB someone suggested the plugin system should use classes, would you agree with that or not?

Share this post


Link to post
Share on other sites

Ah I see thanks for explaining the correct terminology to me. I now understand it a little better although I still need to get my head around OOP with PHP because I found PP far easier when I built my first CMS. Over at MyBB someone suggested the plugin system should use classes, would you agree with that or not?

Yes, if you want yourself, as well as other potential developers to be able to add to your code in the future, you should use classes

Share this post


Link to post
Share on other sites

Making the jump from Procedural programming to OOP is very important.

 

Generally in my view, this is the journey that programmers should aspire to go (in terms of mastering programming):

  • Procedural (Level 1)
  • Object Oriented Programming (Level 2)
  • Event Based Programming (Level 3)
  • Set Based Programming (Level 4)
  • Concurrent based Programming (Level 5)
  • Functional Programming (Level 6)
  • Metaprogramming (Level 7)

 

Along the way you will need to pick up a lot of different programming languages as no one language covers all the above paradigms.

 

If you have any specific questions on OOP please do ask.

Share this post


Link to post
Share on other sites
 
 
 
 
 
 
5
 
 
 
On 5/23/2012 at 4:16 PM, __Darknite said:

Making the jump from Procedural programming to OOP is very important.

Generally in my view, this is the journey that programmers should aspire to go (in terms of mastering programming):

  • Procedural (Level 1)
  • Object Oriented Programming (Level 2)
  • Event Based Programming (Level 3)
  • Set Based Programming (Level 4)
  • Concurrent based Programming (Level 5)
  • Functional Programming (Level 6)
  • Metaprogramming (Level 7)

Along the way you will need to pick up a lot of different programming languages as no one language covers all the above paradigms.

 

If you have any specific questions on OOP please do ask.

Thanks for the great information to me. It will help me keep sharing it.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...