advanced web-based programming
Week 11
MVC
APIE
Projects
View
The view in MVC is the presentation layer. This is what the end user of a product will see and interact with. A system can have multiple views of all different types ranging from command line output to rendered HTML. The view doesn’t consist of business logic in most clear designs. The interface is fit for purpose and is the area of interaction. Therefore you could simply output HTML for consumers to interact with or output SOAP/XML for businesses to interact with. Both use the same business logic behind the system otherwise known as the models and controllers.
In the world of property you could think of the view as the interior of a property or the outer layer of a property that the inhabitants interact with. The interior can be customised for purpose and the same property can have many different types of tenants. For example a property of a particular design could contain residential dwellings. The same internal space could easily be used as office space, where although in the same property has a different purpose. However the property structure is the same. Therefore the environment in which the users interact does not interfere with the structure of the building.
Controllers
The controller is where the magic happens and defines the business application logic. This could be where the user has sent a response from the view, then this response is used to process the internal workings of the request and processes the response back to the user. Taking a typical response where a user has requested to buy a book. The controller has the user id, payment details, shipping address and item choice. These elements are then processed through the business logic to complete a purchase. The data is passed through the system into the model layer and eventually after the entire request satisfies the business definitions, the order is constructed and the user receives their item.
If we compare this to a property, we could compare the ordering of a book online to turning on a light switch. A tenant will flick the switch to on just like ordering a book. The switch itself is an element in the view layer which sends the request to the controller just like clicking a checkout button on a web site. The business logic in this case is what the electrician installed and are embedded within the property designs. The switch is flicked, which completes the circuit. Electricity runs through all the wires including the fuse box straight through to the light bulb. Just like the user receiving a book, in this case the tenant receives light. The whole process behind the scenes involving the electricity cabling is not visible to the the tenant. They simply interact with the switch within the space and from there the controller handles the request.
Models
The models in MVC are the bottom most layer and handle the core logic of the system. In most cases this could be seen as the layer that interacts with the data source. In systems using MVC, the controller will pass information to the model in order to store and retrieve data. Following on from the example above controller definition, this is where the order details are stored. Additional data such as stock levels, physical location of product of the book amongst many things are all stored here. If that was the last book in stock ordered, the next request for this item may check if it’s available and disallow the order as the item is no longer available.
Sticking with out example of turning on a light switch, this level in our structure could be the electricity supply. When the tenant flicks the switch, the internal circuit must request electricity to power the request which is similar when the user requested data from the database, as in data is needed to process a request. If the dwelling isn’t connected to an electric supply, it cannot complete the process. Business benefits from using MVC
After you get the message across explaining what MVC is, you will then have to see what benefits can be obtained from it. I’m not going to go into a huge amount of detail here are I’m sure you can apply benefits more accurately which are directly related to you actual situation. To list just some of the common benefits of an MVC based system here are a few examples:
- Different skill levels can work on different system levels. For example designers can work on the interface (View) with very little development knowledge and developers can work on the business logic (Controller) with very little concern for the design level. Then they simply integrate together on completion.
- As a result of the above separation projects can be managed easier and quicker. The designer can start the interfaces before the developer and vice versa. This development process can be parallel as opposed to being sequential therefore reducing development time.
- Easy to have multiple view types using the same business logic.
- Clear route through the system. You clearly know where there different levels of the system are. With a clear route of the system, logic can be shared and improved. This has added security benefits as you clearly know the permitted route from the data to the user and can have clear security checks along the route.
- Each layer is responsible for itself. (Relates to point 1) This means that you can have clean file structure which can be maintained and managed much easier and quicker than a tightly couple system where you may have lots of duplicate logic.
- Having a clear structure means development will be more transparent which should result in reduced development time, maintenance problems and release cycles if applied properly.
Week 10
Curl
Cron
Patterns
Search Scripts
Deeper into OOP
Project Help
Week 9
Midterm Retake Solution
Time
Php & Javascript Communicado
calendar stuffs
Project Help
Week 8
A midterm retake will be offered
Thumbnail homework
Watermarking
Time
Week 7
midterm answers
gdlibrary
thumbnails
watermarking
projects
Week 6
Here's a screencast to help with those nasty arrays
http://screencast-o-matic.com/watch/cljooo7g0
Finishing up our mail segment
Midterm - handout
Week 5
Finish Recursion,
Onto Mail
GDLibrary next week
Take home midterm quiz next week
Week 4
Arrays and more complicated Arrays
Functions
Recursion with CMS
Take home quiz next week
Week 3
Arrays, arrays, arrays
exercises
Homework Answer and review
More Forms
Conditions
Loops
Arrays
Class Expectations
PHP basics.
First and formost...forms
Get and Post Methods
Coding with globals off
Some simple structures
Some simple functions
Super Globals
Integration of jscript with php
Cassandra
Jae
Eric
Eamonn
Adam
Meghan
Carolyn
Dustin
Lani
Gary
Raine
Christopher
Joshua
Reading that mirrors course content:
Week 1 Sams Hours 1-3
These chapter will be mostly review for you...they cover installation, environment and
execution
Week 2 Sams Hours 4-6
These chapters are more vital; Chapter 4 covers data types, operators and expressions. 5 covers conditionals and loops. 6 covers functions. All the materials
presented in class in week 2 extend on these hours
Week 3 Sams Hours 7, 9 and 10
Hour 7 concerns arrays which we've been revisiting every class this quarter as we use our class time for live applications. Hours 9 concerns HTML forms...good for reviewing if you need it. The content from this chapter that I presented in class that is most important is how PHP extracts form data with globals turned off (Super Globals: $_POST, $_GET, $_REQUEST) . Hour 10 deals with current file handling techniques.
Week 4 Sams Hour 10, and page 252 (mail)
Hour 10 is once again the chapter of focus. Php file handling techniques are unique and deserve this level of attention. You can learn more about the mail function used in our mailling list on page 252
Week 5 Sams Hour 8
Hour 8 covers objects. Hour 5 will be revisited as we review loops...
Week 6 Sams Hour 14
Hour 14 Deals with php functions that manipulate images
Week 7 Sams Hour 15
Hour 15 works with the date functions and simulates the calendar creation we'll do in
class
Week 8 see above
Week 9
Saving state is chapter 20 of the Sam's book
Add PNG/GIF support to thumbnails