TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   What design pattern? (http://www.talkphp.com/absolute-beginners/1048-what-design-pattern.html)

Haris 09-07-2007 08:41 PM

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?

bluesaga 09-07-2007 09:36 PM

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?

Haris 09-07-2007 09:49 PM

Quote:

Originally Posted by bluesaga (Post 1906)
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?

bluesaga 09-07-2007 09:57 PM

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!

Karl 09-07-2007 10:05 PM

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.

Haris 09-07-2007 10:11 PM

Thanks Karl and bluesaga for the help. I'll be going through OOP style since procedural programming is dirty.

Salathe 09-07-2007 11:54 PM

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

bluesaga 09-08-2007 11:09 AM

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!

Haris 09-08-2007 03:12 PM

Quote:

Originally Posted by bluesaga (Post 1932)
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 :)

themulhaq 10-02-2007 01:14 AM

What software you uses for scripting problem man ??


All times are GMT. The time now is 10:02 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0