Professional Documents
Culture Documents
Development
Lecture 02
Planning Our Framework
Framework
• Definition
• a basic structure underlying a system, concept, or text.
• In general, a framework is a real or conceptual structure intended to serve as
a support or guide for the building of something that expands the structure
into something useful.
Patterns
• Definition
• a design pattern is a general repeatable solution to a commonly occurring
problem in software design.
• A design pattern isn't a finished design that can be transformed directly into
code
• Uses of Design Patterns
• speed up the development process
• providing tested, proven development paradigms
Patterns
Which patterns will be used?
• Model-View-Controller (MVC)
• Registry
• Singleton
Model-View-Controller (MVC)
• Model
• Represents an object. It can also have logic to update controller if its data
changes.
• View
• Represents the visualization of the data that model contains.
• Controller
• Acts on both model and view. It controls the data flow into model object and
updates the view whenever data changes. It keeps view and model separate.
Model-View-Controller (MVC)
Model-View-Controller (MVC)
Model-View-Controller (MVC)
• Needs
• It needs to have a method to create certain objects and store them with a key.
• It needs another method, which when passed with a key as a parameter,
returns the object in question.
• working
• Processing the incoming URL, so our “index.php” file can route the request
correctly
• Building URLs based on a series of parameters, a query string, and the
URLdisplay/generation method we use
• Pagination
Pattern Implementation: Registry
• The code in the book makes up the basics of our registry, with two
arrays:
• One for objects
• One for settings
Pattern Implementation: Singleton