views:

133

answers:

5

hi actually i m new in programming and i have developed two projects one in osdate and other is my own code >and i am just 6 months older in PHP as developer >i am not happy with my code standard i want to improve that plz anyone can suggest me about standard and how to organized your project before starting ??i know its funny but i don't have any senior in my office I have to make myself

A: 

In relation to organising your php project, I would probably aim to

  1. Sit down with some paper and a pen and design your whole project on paper. It's always going to be easier to see potential problems before they arise if you know ahead of schedule what might go wrong.
  2. Regarding 1, this will involve what data types are going to be used, and where and how in your front end UI you will be asking for data and what it should look like - that'll help with writing your php. All fairly standard approach really.
  3. Regarding coding standard, try here for one.
  4. Create a decent test plan. I prefer to do this towards the end of development as things are bound to change during your development cycle. Every area of your php code must be tested so you're satisfied it all works as expected - including boundary exceptions. Again, fairly standard stuff really.
Mark Lewis
A: 

A great way to improve yourself as a developer is to read other peoples code.

There are plenty of open source projects out there that you can poke through to see how other people approach things.

Whilst other peoples code may not always represent the 'right' way, it's important to see different approaches and have a mark against which to judge your own code.

RSlaughter
A: 

A good example of coding standards is:

Zend Framework Coding Standard for PHP

AlexV
+1  A: 

Have a long hard look at php codesniffer and phpmd (note there is some overlap between these but they do cover different aspects)- pick a coding standard and use these programs to check your code.

Do use a version control system. Do use a code documenter (like PHPXRef, PHPDoc) and comment your code accordingly. Plan Unit tests and set up continious integration testing.

Plan how you are going to manage / test your code before it is released to Live, (i.e. keep live and test code separated).

In fact, plan everything - but be prepared to change your plans as the need arises.

Take the time to record the bugs you find before you fix them - then periodically review what kind of bugs keep occurring in your code and what you can do to avoid them in future. See also PSP

There are lots of Open Source projects out there looking for developers - this is a great opportunity to get your code reviewed by other people (hopefully whom know what they are talking about) and see how a large project works.

HTH

C.

symcbean
+1  A: 

One of the best ways to improve PHP code is to use an MVC Framework, that will force you to split your data models from your HTML pages and your Controllers.

A good MVC frameworks for PHP Beginners is Codeigniter. It will only take you a few hours to get used to the methods they use, and they have some good video tutorials on it that will get you going in no time.

Tilo Mitra