are these required to make a very crude forum?

General discussions related to php

Moderators: macek, egami, gesf

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

are these required to make a very crude forum?

Postby Virtuoso » Wed Jul 30, 2003 9:02 am

objects and classes
templates?

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Wed Jul 30, 2003 10:09 am

No, neither are required to make a "very crude forum". In fact, neither are required for anything at all. One of the principles of object-oriented programming that every OOP-centric class teaches is that there's nothing you can do with objects that you couldn't otherwise do without them. They just make some things easier. I've never made a forum, but right now I can imagine making one with objects and one without objects, and I'm not sure which would be more difficult. If it's just going to be, as you say, "crude", you can probably do without templates and without OOP. But I do recommend that you take extra pains to keep logic and presentation separate, and this is perhaps the most direct advantage of template systems.

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Postby pootergeist » Wed Jul 30, 2003 11:25 am

as far as the php learning curve goes...

you will learn procedural code
you will tinker
you will conceptualize how to code a forum
you will tinker
you will understand that a templated and OOP forum will help extensability in many regions
you will tinker
you will realize that very few php applications require OOP and templates and that they basically only facilitate removing presentation from logic
you will tinker...

yes object programming can help, yes template parsing can help - whether or not either are necessary for an application is truely dependent upon the application. Most forums use OOP and templating just so the backend programmers don't have to bother with clientside stuff and so the html programmers don't have to understand the logic.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Wed Jul 30, 2003 11:46 am

Also it makes for coding and maintaining easier there is a disadvantage to using OOP and templates, it's slower.

The only thing is the advantages greatly outweigh the disadvantages so you can almost disreguard my comment. Just wanted you to know.

If you just want to make a crude forum and don't plan on distributing or adding much to it there would be no need for OOP or templates. The only thing is if you want to change anything say 3 months down the road. Unless you get comment happy it would be difficult to remember what you were thinking when you made the code.

OOP not only makes code easier to read and understand it gives you a better opportunity to reuse code.

If you make a class that allows users to login, signup, change preferences and what not you could then take that class out of your forum and add it to a something else.

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Wed Jul 30, 2003 12:08 pm

If you want to know the many wonders of that OOP, just get a book on or take a course in Java. In Java, everything is an object. Even though I rarely use it for actual application development, Java produces perhaps the most effortlessly beautiful code in the animal kingdom of programming languages. I do love PHP and use it because it's a great language, but Java.. well, Java is something else entirely.

In any event, I recommend that eventually you familiarize yourself with OOP, as even if you rarely use it (I don't use it very often in PHP), it will very much come in handy when you need it.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Wed Jul 30, 2003 12:19 pm

well I grew up with java so not using OOP in php is hard not to do :) I only wish it wasn't such a performance hit. maybe I should get a zend compiler..

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Wed Jul 30, 2003 12:45 pm

Is it really that much of a performance hit? I mean, I know PHP doesn't do OOP superfast, as it's not so integrated into the core of the language as in Java or Python, but is it really that terrible? Do you know of any benchmarks of this? And presumably it'll get a lot better in PHP 5, as they've put quite a lot of serious effort into making it better.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Wed Jul 30, 2003 1:23 pm

it's noticeable but not that great. PHP 5 is supposed to be more OOP orientated so hopefully it solves some problems. I haven't personally done benchmarks but made scripts where I can tell the difference.

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

Postby Virtuoso » Thu Jul 31, 2003 5:40 am

so i don't really need it unless i want to develope my forum over time?

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Thu Jul 31, 2003 11:15 pm

correct

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

Postby Virtuoso » Fri Aug 01, 2003 8:11 am

oh well, i guess i better start learning it.

User avatar
Virtuoso
php-forum Active User
php-forum Active User
Posts: 268
Joined: Mon Jul 21, 2003 7:05 am
Contact:

Postby Virtuoso » Fri Aug 01, 2003 8:50 am

oh yeah, should i use sessions or cookies? i haven't learn anything about sessions yet.

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Fri Aug 01, 2003 11:47 pm

Virtuoso wrote:oh yeah, should i use sessions or cookies? i haven't learn anything about sessions yet.

session it's very poverful thing's in PHP.......
by the way, to all what say before by swirlee and Redcircle, i may say:
in some situation than you have a very beauty code for example somthing like DataBaseEngine, with wery good processing of querys, you may use it's code againe and againe. And you may modernize it in any time.
Than you will create new project no matter what is it, forum, news, CRM, you may create at the mach more time faster, cause half of code you still have.

Sorry for my English..... :oops:


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest