Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
Reading
PHP notes
1
found
auth
Name:
Category: Reading
Body:
(1) Go through the Table of Contents * http://www.php.net/manual/en/language.oop5.php (2) Create your own basic PHP class. It does not have to be fancy * Just make your own, toy with it, change "public to private to protected" to experiment what will happen/understand the effects, etc. (3) Design Patterns - Try each of these out - Or at least read about it. * https://github.com/domnikl/DesignPatternsPHP#designpatternsphp * SINGLETON IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION! (4) http://nikic.github.io/2011/12/27/Dont-be-STUPID-GRASP-SOLID.html * Seriously, do not write STUPID code. * http://lostechies.com/derickbailey/2009/02/11/solid-development-principles-in-motivational-pictures/ * http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29 * http://blog.ircmaxell.com/2013/01/dependency-injection-programming-with.html * http://richardmiller.co.uk/2011/05/19/when-dependency-injection-goes-wrong/ * Hint: Question yourself whenever you feel the need to use the "new" keyword inside a class. * https://jtreminio.com/2012/10/an-introduction-to-pimple-and-service-containers/ * http://pimple.sensiolabs.org/ <-- Dependency injection container. * Dependency injection container. It can be used for good, it can be used for evil. * Evil - Service locater * Good - Injecting only the necessities, the object class/function actually needs. DO NOT INJECT THE ENTIRE CONTAINER. (5) OOP vs Procedural: http://blog.ircmaxell.com/2012/07/oop-vs-procedural-code.html * Just because a code uses a class, that doesn't automatically make it "OOP". * It is possible to use the OO paradigm, without actually using a class (and that is not procedural.) (6) Law of Demeter * https://www.youtube.com/watch?v=RlfLCWKxHJ0 * Law of Demeter: Asking for something you don't need directly, only to get what you really want. * Imagine you are in a store and the item you are purchasing is $25. * Do you give the clerk $25? * Or do you give the clerk your wallet, and let him/her retrieve the $25? (7) Architectural Patterns and templating * Stefan Priebsch - Why MVC is not an application architecture - phpday2011 * http://vimeo.com/40968850 * http://r.je/ * Get to know about the common misconception surrounding "Model-view-confusion". * Increased flexibility with MVVM, no need for controllers when theres no real user interaction! * Some anti-patterns that's overlooked. * http://chadminick.com/articles/simple-php-template-engine.html * http://css-tricks.com/fighting-the-space-between-inline-block-elements/ <-- HTML/CSS - Not to do with php, but thisis highly critical to know about. * http://blog.fedecarg.com/2008/06/28/a-modular-approach-to-web-development/ * http://stackoverflow.com/questions/18872991/mvc-should-view-talk-with-model-directly * In my opinion - Doesn't exactly-always matter which you are doing: MVP, MVC MVVP, PAC, Three-tier architecture, etc -- Just focus on the goal: Separation of Concern (8) Catalog of Patterns of Enterprise Application Architecture * http://martinfowler.com/eaaCatalog/ (9) Domain Driven Design * http://en.wikipedia.org/wiki/Domain-driven_design * http://blog.fedecarg.com/2009/03/11/domain-driven-design-and-mvc-architectures/ * Very good, gives an idea on setting up the layers (Entities, Business, Service, Data access layer and etc.) * http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2012/02/service_diagram.png (10) Models and Service Layers; Hemoglobin and Hobgoblins * http://www.youtube.com/watch?v=3uV3ngl1Z8g * Service layer * Repository * Domain Model (part of DDD) Anti-Patterns: * Singletons - Just. No. Please. * Service locator - Breaks the Law of Demeter. Hides what your class really needs (Dependencies/APIs.) * PHP Global keyword * Active Record - Breaks the "S" in SOLID (Single Responsibility Principle) Read about Domain Driven Design, Service layer, Entities, Value Objects, etc.
Footer