5 ms·
PHP Design Patterns Reference and Examples
- Sujan 18y agonice one!
- deleted 18y ago[deleted]
- jrockway 18y agoI like how they call this MVC: http://www.fluffycat.com/PHP-Design-Patterns/Non-OO-MVC/ http://www.fluffycat.com/PHP-Design-Patterns/Non-OO-MVC/ No. That is called "calling functions". As an aside, I really hope that nobody who reads this site uses PHP or goes out in search of design patterns to add to their application.
- trezor 18y agoI'm afraid the comments so far proves youu wrong. There are people here who use PHP. As for this, er, "MVC-code"... People say OO, MVC and design patterns and all that is overengineering things. This is was 62 lines of PHP to implement a simple switch statement for 2 options. That's pretty hardcore.
- jrockway 18y agoWell, that is mostly a combination of PHP's total lack of anything resembling sane syntax and a plain bad example :) However... if you have a bunch of functions with names like: get_foo_data get_bar_data process_foo_data process_bar_data display_foo_data display_bar_data The phrase "I AM DOING SOMETHING WRONG" should immediately appear in your mind, even if you've never heard of OOP.
- danielrhodes 18y agoPHP is very fast.. OO deficiencies have mostly been solved by 5.3. Your blanket generalizations will not get you anywhere.
- jrockway 18y agoPHP is very fast.. If by very fast you mean the second-slowest: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=all http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... I agree that it doesn't matter much. But why use a slow language with poor syntax when you could be using a fast language with beautiful syntax? (I won't go in to detail about how horrible PHP's object model is, or how it doesn't have lexically-scoped variables, or how it doesn't have closures or even anonymous functions, ... or a host of other features that most programmers have been enjoying for the last 30 years.)
- danielrhodes 18y agoNo question PHP is weak in some areas, although trying to compare languages is sometimes like trying to compare cats and dogs. Also, second slowest? Compared to what? And in what scope, and trying to solve what problem? Last I checked, there were more than 25 languages, and only a few of the ones listed there are suitable for the web.
- jrockway 18y agoWhich ones aren't suitable for the web? Maybe Fortran, but I know of people with successful production web apps in most of those languages; Perl, Ruby, Python, CL, OCaml, Haskell, Lua, C++, and Java.