Three Layer Architecture
Why Bother with the Middle Layer?
Consider Facebook PC Phone Tablet
Without a Middle Layer… Web browser (Add Update etc.) Android device (Add Update etc.) Apple device (Add Update etc.) Presentation LayerMiddle LayerData Layer
Include the Middle Layer… Web browser Android device Apple device Presentation Layers Middle Layer (Add Update Delete Validate Query Results) Data Layer
Designing Classes
The Specification You are required to create a web based application that allows a user to store address details. The user should be able to add, edit and delete addresses. Each address should be validated to capture any errors in the data. A typical address should consist of house no, house name, street, town, post code, county code, date added and a flag for active. All addresses will be stored in a suitable database.
Identify the Nouns Application Address Addresses User Data Database
List the Methods Add Edit Delete Validate
Find the Properties house no house name street town post code county code date added active
Draw the Class Address house no : string house name : string street : string town : string post code : string county code : integer date added : date active : Boolean Add() : Boolean Edit() : Boolean Delete() : Boolean Validate() : String
Now we write the code…