TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-15-2009, 11:30 PM   #1 (permalink)
The Wanderer
 
Join Date: May 2009
Posts: 14
Thanks: 0
baseballplayr is on a distinguished road
Default Simple Blog Project

Based on feedback for simple projects to learn OOP, I think I will try a blog app. I figure this is a way for me and anyone else who wants to pitch in, to learn OOP php better. For starters, what all do I need for this blog?
Database class
Post class
Login class (maybe a session class to go along with it?)
Validation class
Exception class

Most of this was taken from another post in this section from allworknoplay. Which class should I write first? The database class? Will give it a try this weekend :)
Thanks for all the help in advance!
baseballplayr is offline  
Reply With Quote
Old 05-16-2009, 12:14 AM   #2 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by baseballplayr View Post
Based on feedback for simple projects to learn OOP, I think I will try a blog app. I figure this is a way for me and anyone else who wants to pitch in, to learn OOP php better. For starters, what all do I need for this blog?
Database class
Post class
Login class (maybe a session class to go along with it?)
Validation class
Exception class

Most of this was taken from another post in this section from allworknoplay. Which class should I write first? The database class? Will give it a try this weekend :)
Thanks for all the help in advance!

Sounds good, I will try to join in if I can...

the post class can use methods from the validation class, as well as the login class....

Also, let's go with lazy loading ( autoload ), I think that's the correct terminology...
allworknoplay is offline  
Reply With Quote
Old 05-16-2009, 04:09 AM   #3 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Don't use objects for the sake of using them, objects are only useful if you understand object oriented design (this takes a long time to grasp well). So here's my question: Why do each of those items need to be in a class? What do you gain by using objects opposed to coding them without?

I have found (though both observance and personal experience) that projects made for the sake of using objects are bad. All they teach is how objects work, which is done fine with small useless programs. The nasty side effect that they give is that you get into the thought process of using objects for anything you can manage to create one for. This is not how good design works, objects should only be used when there is a clear advantage to use them.

What I am saying is that you should learn how OOP works with small applications, read up on object oriented design and then start building a larger application. When you build this larger app, use OOP as a tool opposed to the base of the entire project.
__________________

Village Idiot is offline  
Reply With Quote
Old 05-16-2009, 05:09 AM   #4 (permalink)
The Wanderer
 
Join Date: May 2009
Posts: 14
Thanks: 0
baseballplayr is on a distinguished road
Default

So you don't think building a blog would be a beneficial small app?
I know there are times when using OOP isn't the best bet, but merely want to make something OOP from start to finish, just to make sure I have it down. What would you consider a large application?
baseballplayr is offline  
Reply With Quote
Old 05-16-2009, 02:46 PM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I understand your want to complete a project using object oriented concept, but I think it would be far more beneficial to you if you to do smaller projects, learn proper object oriented design then do a larger project.

And there is no solid definition of a large project, especially with lone programmers. I consider large projects (when I am alone) anything over 1,500 lines, but I am used to programming large applications (the ASP one I maintain is about 100k lines). Back when I was a newer programmer, large was over a few hundred lines. A blog would certainly run into this, so I wouldn't consider it a small project for you.
__________________

Village Idiot is offline  
Reply With Quote
Old 05-16-2009, 03:12 PM   #6 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

All I say is I can't wait to have enough hours of OO under my belt. It's going to be great being able to quickly look at a class and get a good idea of what the programmer is trying to do, what design pattern he's following, how it can be better, what flaws are in it...(having the urge to build your own framework out of curiosity)

When you can do that, I'd say you are in a good place in the OO world....
allworknoplay is offline  
Reply With Quote
Old 05-18-2009, 11:40 AM   #7 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Ehh.. you could do a blog app with 1 class. I would however recomend having the database as an own class. Then all you need is a blog class, with functions for post a new entry, post comment on an entry, fetch an entry(along with its comments), fetch all entries(for the blog frontpage - possibly with a limit of 10 so it only displays the 10 latest entries), login as a user, etc.

All of that goes into 1 class. Then in the future you can expand this to have multiple classes handle several things, for example an own login class. The thing is that you mentioned it was supposed to be easy, and making a class for every "function"(basicly) is not needed. Not at this point anyhow.
__________________
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Planning your project Village Idiot Absolute Beginners 13 06-17-2009 02:46 PM
Freelance Suite: Client & Project Management Software CLCook Show Off 2 09-14-2008 10:50 AM
a decision has been made read for an update on the project codefreek TalkPHP Developer Team 9 07-02-2008 09:31 PM
What does a Blog need? Aaron The Lounge 9 04-29-2008 03:00 AM
Project Manager Nor Show Off 7 12-17-2007 08:51 PM


All times are GMT. The time now is 08:04 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design