ICT 5 Web Development - Chapter 7: MVC & PHP Frameworks Overview of Design Patterns, What is MVC architecture? PHP Frameworks, Why do we need Patterns? Structure of a design pattern, Class Diagram for the Observer Pattern. | Everything shoved into one file. Vietnam and Japan Joint ICT HRD Program Not Good! Add User / / My HTML code blah blah Name: ”> Typical PHP Code ICT 5 Web Development Chapter 07. MVC & PHP Frameworks Nguyen Thi Thu Trang trangntttrangntt-fit@ query($sql); dbh->query($sql); } else { $result = $dbh->query(“SELECT * FROM my_table”); $dbhmy_table”); $userArray = $dbh->fetchRow($result); $dbh- fetchRow($result); } printHeader();?> printHeader();?> My HTML code blah blah blah Name: ”> value=“”> printFooter(); 1. Overview of Design Patterns 2. What is MVC architecture? 3. PHP Frameworks 3 4 1 Patterns in Architecture Does this room makes you feel happy? Why? What is a Design Pattern? A description of a recurrent problem p p and of the core of possible solutions. In Short a solution Short, for a typical problem – Light (direction) – Proportions – Symmetry – Furniture – Why do we need Patterns? Reusing design knowledge – Problems are not always unique Reusing unique. existing experience might be useful. – Patterns give us hints to “where to look for problems”. Establish common terminology – Easier to say, "We need a Façade here“. y, ç Provide a higher level prospective History of Design Patterns Christopher Alexander The Timeless Way of Building A Pattern Language: Towns, Buildings, Construction Gang of Four (GoF) Design Patterns: Elements of Reusable Object-Oriented Software Object- Many A th M Authors Architecture Object Oriented Software Design 1970 1970’ 1995’ Other Areas: HCI, Organizational Behavior, Education, Concurent Programming 2007’ – Frees us from dealing with the details too early In short, it’s a “reference” GoF: Gamma et al ( Gamma, R. Helm, R. Johnson, J. Vlissides) (E. 2 Structure of a design pattern* Pattern Name and Classification Intent I t t – a Short statement about what the pattern does Motivation – A scenario that illustrates where the pattern would be useful Structure .