Jump to content

Recommended Posts

Hi, I have some questions about using class and framework.

 

I do understand PHP and I can make a simple php application such as guestbook with database connection, and I also understand about functions. However, I do not understand about how to create objects, class nor framework.

 

Some day I need to make a complete CMS for a client. So I made it myself on my php level. It works fine, but there is no class or framework structure in my CMS. As long as it's work, in my opinion, client would like it. However, I am not really confident if a programmer looks at my codes.

 

My questions are, do I need to learn making class and framework? I always had a problem to add or develop someone else's codes, if I used free CMS or framework. Is it bad if I keep my coding style (without class) instead using class or frameworks? Sometimes i see class is more complicated than just functions.

 

Rgds,

ayok

Link to comment
https://forums.phpfreaks.com/topic/173156-no-class-no-framework/
Share on other sites

OOP is not just using "classes". OOP is about objects and how these naturally interact with each other. Each object has a state represented by it's internal properties, and they can be manipulated using the public methods they expose (also called the interface). You need to think about objects not classes. A class is merely a blueprint for an object, so to speak.

 

You needn't use OOP if you don't want to. You can use procedural programming. You just need to know that OOP and procedural are not the same thing even though they're both part of the imperative paradigm.

Thank you Daniel0. Your reply make me more confident. But how a good php programmer will think if he/she looks at a CMS with procedural programming? Will they think that I'd better use OOP or it's okay? Are the most php programmers using OOP or just a procedural programming?

Personally, I prefer OOP over procedural any time. I simply think it's much better suited for especially larger applications. It's much easier to structure your code, encapsulate things and extend things. In PHP I virtually never write procedurally unless it's a small test snippet I'm writing.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.