Jump to content

Recommended Posts

Hi,

 

i m trying to code my own-blog. i m familiar with how to create classes etc. But the problem is i can't decide about the classes i will use. How do you decide about it ? Is there any modeling program/or a program/or a way that you decide about classes ?

 

For example:

for my own blog i did something like this for now;

pageClass ( header, buttons, content, rightmenu,footer )

postsql ( insert, delete, update )

blog( post, comments )

 

i know probably its completely wrong, so as i m a newbie i would be glad if you can help.

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/144549-cant-decide-the-classes/
Share on other sites

Your question is pretty hard to answer definitively as it really depends on you. However, objects should describe things. These things should be concise and to the point. eg; There's no point in having a massive page object that is responsible for everything, what makes up your page? A menu, threads, comments? These could all be broken down.

 

Your blogs object for instance could return multiple article objects which in turn could return multiple comment objects. This may (especially in the case of something as simple as a blog) be overkill however, breaking your application down into smaller components should give you more of an indication as to what objects (and therefore classes) you will need.

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.