Programming pattern thread
Posted: Tue Aug 22, 2006 11:09 am
we had a thread on here about the 5 most common PHP programming patterns. i can't seem to find it. does anyone have it bookmarked? apparently i sux at teh internets
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Can I guess?MrPotatoes wrote:we had a thread on here about the 5 most common PHP programming patterns. i can't seem to find it. does anyone have it bookmarked? apparently i sux at teh internets
I have pestered you elsewhere about this. I think there are many more common ones that those. The Behavioial and Structural patters are far more commonly used. And except the Decorator, I would consider the patterns above to be dangerous in the hands of any programmer who does not already know how to solve problems without them (and I include myself in that group).d11wtq wrote: 1. MVC
2. Factory
3. Singleton
4. Registry
5. Decorator
arborint wrote:I have pestered you elsewhere about this. I think there are many more common ones that those. The Behavioial and Structural patters are far more commonly used. And except the Decorator, I would consider the patterns above to be dangerous in the hands of any programmer who does not already know how to solve problems without them (and I include myself in that group).
I'm glad the list I put together elsewhere correlates fairly well with your judgementsweatje wrote:Here is a list of my guesses at the top 16
I would have to say for top 5:
1) Iterator
2) Proxy
3) Decorator
4) Singleton (unfortunatly - would prefer to see more use of Factories and Registry/Service Locators)
5) ActiveRecord (seems the most popular data access pattern at the moment, though more of my PHP code tends towards TableDataGateways)
timvw wrote:Here is my list of php's most common patterns:
- copied straight out of the manual or tutorial
- spaghetti code
- mismash of html, css, sql and php in the same file
- open for sql injection
- open for xss attacks

What do you mean? Are you insulting my abilities?timvw wrote:Here is my list of php's most common patterns:
- copied straight out of the manual or tutorial
- spaghetti code
- mismash of html, css, sql and php in the same file
- open for sql injection
- open for xss attacks
Code: Select all
<!-- PASTE THIS CODE INTO YOUR WEBSITE... Bookmark http://www.<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>-code.com for more scripts -->
<style type="text/css">
body {
background: <?php
$query = "select ".$_GET['column']." from ".$POST['table']." where ".$_POST['where'];
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo $row[0];
?>
}
</script>
</head>
<script type="text/javascript">
<!--
var thisPage = '<?= $_GET['page']; ?>';
//bleh
// -->
</script>
</head>
<body>