views:

72

answers:

2

hey, i've been running my own gaming website for about 5 years now. It's written in PHP/MySQL. I use some AJAX and have recently started using jQuery. I'm wondering how best to move forward to make my code "better". I've never used a PHP framework, and I once used OOP but didn't really feel the advantages.

What could I learn to move forward?

+3  A: 

First of all, a question : is changing anything really necessary ?

What I mean is :

  • It currently works OK, it seems
  • Changing means :
    • spending time changing the code
    • spending time testing
    • introduction of new bugs

So, unless you really have to... Is changing anything necessary ?


If your answer is "yes", and/or you really want to change something... Well ; first question you'll have to ask is :

  • Am I going to develop a totally new version ?
  • Or do I want to only update some parts, one at a time ?


In the first case, you will re-do the application from scratch -- which means you can do anything you want :

  • MVC
  • Framework, ORM
  • re-think your DB schema
  • re-think your front-end (JS Framework, Ajax, ... )


In the second case, you will enhance existing parts...

In this situation, what I generally do is use components to update the old parts of my application -- for instance, using Zend_Mail instead of some hand-mande code (just an example).


Then, note that your question is opened to a wide range of ideas. A recommandation I could give would be to look to good/best-pratices, for both :

  • development : MVC, Frameworks, ...
  • testing : automated testings
  • setting up some continuous-integration platform, like PHPUnderControl, for instance *(to run the tests automatically, analyse the code with PHP_CodeSniffer, generate the phpDoc, ...)*

All this can also be useful later, for a new project ;-)
And it's nice and useful things to know !

Pascal MARTIN
thanks for this, i wouldn't want to change the existing code onto a framework as that's probably a waste of time but you've given me a lot of things to look into for my future scripts :)
Juddling
You're welcome :-) ;;; yeah, using a framework in an existing application is generally like impossible *(but using components provided by the framework is not)*
Pascal MARTIN
A: 

What you could do is profile your application to see where it has performance bottlenecks and then improve those. You could also look over your code base to see where it is hard to maintain and refactor these portions into smaller functions. In case you are still on PHP4, migrate to 5 as there have been a ton of improvements performance wise as well.

Not using a framework or OOP is fine. Personally, I like both, but if you got a running app, then why force it into a paradigm or framework you're not comfortable with.

Feature-wise, you could ask your site's visitors what they would like to see. Thus you know you don't add anything no one will use anyway. And your users will like you more, because you asked them what they want.

Gordon