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 09-07-2007, 08:41 PM   #1 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default What design pattern?

The purpose of the site will be a simple ajax based search engine. You type in AL select 'Counter strike' and it tells you that AL means 'A Long in de_dust2 map'.

Any ideas what design pattern you would adopt for this kind of simple script or I should use simple non-OOP pattern?
Haris is offline  
Reply With Quote
Old 09-07-2007, 09:36 PM   #2 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

How do you mean "design plan"? You need to be a little bit more specific so i can help you :)

AL doesnt define that much, do you want an abbreviation?
bluesaga is offline  
Reply With Quote
Old 09-07-2007, 09:49 PM   #3 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

Quote:
Originally Posted by bluesaga View Post
How do you mean "design plan"? You need to be a little bit more specific so i can help you :)

AL doesnt define that much, do you want an abbreviation?
Yes, 'AL' is the short form for 'A LONG'. As for the design plan, I want to know if I should go for OOP approach or simple PHP approach?
Haris is offline  
Reply With Quote
Old 09-07-2007, 09:57 PM   #4 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

Well it depends what you want to do, you can go the OOP route or the procedural route with any application. For some applications OOP would be better, but it depends what you prefer!
bluesaga is offline  
Reply With Quote
Old 09-07-2007, 10:05 PM   #5 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Hi Haris, I think you're getting a little confused. Design Patterns are basically a tried and tested method for solving common problems, an example of such is a singleton. Whereas OOP and procedural programming are two different methods (or styles) of programming.

As for your question, OOP should almost always be used over procedural programming. The only exception I can think of is when you're developing a small standalone script, i.e a cron job, but even then, I tend to use classes because it allows things to be organised better.
Karl is offline  
Reply With Quote
Old 09-07-2007, 10:11 PM   #6 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

Thanks Karl and bluesaga for the help. I'll be going through OOP style since procedural programming is dirty.
Haris is offline  
Reply With Quote
Old 09-07-2007, 11:54 PM   #7 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Coding procedurally is only 'dirty' if you choose to see it that way. As Karl eluded to, there are times when it would be better to approach a problem with procedural code rather than OOP. As a programmer I try to choose the best tools for a particular problem, sometimes the best tool is a short procedural script.

Then again, oftentimes OOP is much better suited. ;)
Salathe is offline  
Reply With Quote
Old 09-08-2007, 11:09 AM   #8 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

Well, after many years of programming procedural scripts, i moved onto OOP programming around a year and a half ago. From then on, Procedural scripts are only ever extremely short scripts, and even then usually open OOP classes from within them.

OOP programming is my choice, and if you are starting to learn then i would recommend you start straight with OOP rather than procedural, its extremely hard to get used to a change especially when you have been doing procedural for a few years believe me!
bluesaga is offline  
Reply With Quote
Old 09-08-2007, 03:12 PM   #9 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

Quote:
Originally Posted by bluesaga View Post
Well, after many years of programming procedural scripts, i moved onto OOP programming around a year and a half ago. From then on, Procedural scripts are only ever extremely short scripts, and even then usually open OOP classes from within them.

OOP programming is my choice, and if you are starting to learn then i would recommend you start straight with OOP rather than procedural, its extremely hard to get used to a change especially when you have been doing procedural for a few years believe me!
To support that, WildHoney even uses OOP to code email scripts.

http://talkphp.com/showthread.php?goto=newpost&t=1052 :)
Haris is offline  
Reply With Quote
Old 10-02-2007, 01:14 AM   #10 (permalink)
The Visitor
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
themulhaq is on a distinguished road
Default

What software you uses for scripting problem man ??
themulhaq 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


All times are GMT. The time now is 09:06 PM.

 
     

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