views:

90

answers:

3

Hi there,

I have two years worth of PHP experience however I have never worked with design patterns. I have recently been given a task at work that has made me question the wisdom of that decision.

I have been asked to create a system that:

  1. Insert orders into a database. These orders can have a multitude of attributes and control logic that needs to be applied. The system will not be directly responsible for a front end, it will receive commands via an API.

  2. Write the scripts that extracts orders from the database, decide which supplier to send with and create the associated files for uploading to a provider. File formates vary (XML, CSV).

  3. Process incoming files from suppliers in the various formates (XML, CVS) and update the databases. Also FTP will have to be utilised to gather the files from the remote host.

I would like a central control class that can service each of the required functions, one point of access so to speak. This would then extend into the various specific functionality as required.

I am wondering if it is worth learning a design pattern to facilitate this system, if so could someone point me in a direction as there are many. Any advise on my issue would be very helpful.

Thanks in advance

+1  A: 

Keep in mind that a design pattern won't solve your problem, rather it's a reusable abstract method of a solving a problem (or given set of problems.)

Based on your description and idea, it sounds like you already have a grasp of the situation and how you would like to handle it.

I'm not one to get caught up in design patterns too much, I'd probably just run with what you have if I were you.

$0.02

Ian P
+1  A: 

Yes it's a worthwhile effort, however as it will not solve your problem. If you have been coding without them you sometimes use them in a mixture of patterns and thing are not always clear. Having names and template may make your code clearer and easier to maintain.

In the last 2 year I have been brushing up on design patterns and how to better model solution, and I believe it has payed off.

I personally read used these books for my studies:

I do think studying design design patterns can help you improve your design. Having clear names will aid people that coming on later.

Thomas
A: 

No, no , no!

Design patterns are useful as teaching tools, and a way of describing what code is. If you treat them as a sort of code template then this will determine the way the code works before you've even thought about it properly.

...and other than FrontController (which is too generic), most patterns address much more specific behaviours than you describe here.

C.

symcbean
Well, i understand how to do the actual programs and classes.. I'm just trying to understand a method that would allow me to tie all the various parts of the system together
Joe