Jump to content

Love PHP but hate speghetti code


luke101

Recommended Posts

Hello,

Just wanted to know if there is anything out there or any technique that prevents speghetti code in php? I am really considering .NET because the maintainence is so much easier. But i am really trying to find a reason to use PHP because I know the support is much better. So do you guys know anything or way to prevent speghetti code?

Link to comment
Share on other sites

By speghetti code I guess you mean code appearing all over the page for different reasons?

 

In that case OO techniques would reduce this or alternatively look at smarty templates. These templates abstract the PHP  code giving a clear definition between the business layer and the user interface.

Link to comment
Share on other sites

use a program called HAPedit. it colour codes things, and i tend to find it very useful

 

i also comment on EVERY line so i can look back on it if need be. keep inner-code indented for IF's etc

 

php supports functions, which is just the same as goto?

 

 

Link to comment
Share on other sites

php supports functions, which is just the same as goto?

Not quite. As I recall goto will skip any code inbetween. A function call in PHP will continue code execution from where the function was called after it has finished doing the function.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.