views:

49

answers:

2

Hello All.

So we are this company with currently 3 browser based games. We are just 4-5 coders employed and would really like to improve the synergy from our coding.

So we are considering making a more generic framework. Currently our games consists of one big mix of html, php, javascript, css & flash (+databases).

So basically I would like to have only one forum code, one message system code, payment gateway etc, instead of all the pages we got now thats 'almost' identical and yet so far. What technologies and structure would you guys recommend for making this mess more module based and generic.

The sites in question are http://trophymanager.com http://trophyhockey.org http://bigbuckcity.com

A: 

I'm not exactly sure what you are looking for...something like the Zend Framework?

There are lots of PHP frameworks out there, each with their own strengths and weaknesses. Doing some research will be well worth your time.

Icode4food
I should maybe say we want to program it ourselves. So it would basically be something like the structure, whether templates or xml was worth using etc.
Android Noob
If you want to program it yourselves what exactly are you asking for?
AntonioCS
+2  A: 

The basic idea is to search for duplicate code, put that in a separate module/class/file and reuse it where possible. This is how you could do that:

Split the code of each application into these often used chunks:

  1. a view layer, the user interface. (HTML, JavaScript, CSS, Flash)
  2. a business logic layer, the validation checks, workflow etc. (PHP)
  3. a data layer, the storage and retrieval of data. (PHP, Database)

Investigate if each layer really is different from the others or can be shared. Strive for shared business logic and data layers. Ideally you create applications that basically work the same but only have a different user interface (skin).

Merge the duplicated layers into single implementations and combine them with the specific skins. So for 3 forums you have 1 data layer, 1 business logic layer and 3 UI's.

A second way of combining code might be done if each application uses different techniques for a specific layer.

You should look for ways to use the same frameworks for a layer across applications. For example you could decide to always use PDO for the data layer. That reduces the time to build the next application because you don't have to learn new techniques for each application.

You might discover that parts of the code for a layer in one application are the same in that layer in a second application. Put this code in a separate module you share across all applications.

One last suggestion, if you haven't done so yet, decide on a set of coding standards for each technique, with naming conventions, file layout, used patterns etc. That makes it easier for a developer to read and understand code written by a colleague and increases the change of finding code to reuse.

Kwebble
thanks a lot, great answer together with my newfound knowledge of namespaces i know where to start :)
Android Noob