110 likes | 135 Views
CIS 451: N-Tier Applications. Dr. Ralph D. Westfall January, 2009. 2-Tier and 3-Tier Applications. 2-tier application is also known as a client-server or "fat client" architecture user interface and business logic at top data access logic in lower (2 nd tier)
E N D
CIS 451: N-Tier Applications Dr. Ralph D. Westfall January, 2009
2-Tier and 3-Tier Applications • 2-tier application is also known as a client-server or "fat client" architecture • user interface and business logic at top • data access logic in lower (2nd tier) • harder to migrate to different front end e.g., Windows form to web interface • diagrams
3-Tier Applications • also known as n-tier applications • user interface at top • data access at bottom • business logic in between • easier to migrate and maintain e.g., switch to a different user interface or data source
3-Tier: Start with Design • identify what each of the (typically three) tiers will do (example) • user interface tier: interacts with the user, and also with the business tier • data tier: gets (or sets) specific source data (from files, databases, etc.) to send to business rules tier • business rules tier: does complicated processing and communicates with other 2 tiers
User Interface (Presentation) Tier • contains user interface components • communicates with users: e.g., Labels, MessageBoxes • receives user inputs: TextBoxes, Buttons • often displays outputs via TextBoxes, Labels, etc.
Data Tier • gets data, [possibly pre-formats it,] and sends it up to the business rules tier • via SQL calls, stored procedures, etc. • data may come from a • database: SQL Server .mdf file, Access .mdb file, etc. • XML file • text or binary file, etc.
Business Rules Tier • manipulates data from the data tier (other than formatting or simple filtering) such as by • validating input data • calculating totals, averages, ratios, etc. • performing complex filtering, assigning to categories (e.g., bad credit risk), etc.
Visual Studio and Web Tiers • creates Default.aspx page for new projects • holds user interface components: Buttons, Labels, TextBoxes, ListBoxes, etc. coded in HTML and ASP • also creates a second tier • Default.aspx.vb "code behind" file contains processing logic: data validation and event handlers for page loading, button clicks, etc.
Business Tiers for Other Pages • Previous versions of Visual Studio used to default to single-tier pages added after Default.aspx • could check Place code in a separate file when using File>New File to add page • ASP and HTML UI code went into the .aspx file itself rather than into an .aspx.vb code behind file
Data Tier • in ASP.NET the data tier consists of the items shown in the Server Explorer (some of which come from the Data section of the Toolbox) • DataConnections • SQLDataSource, AccessDataSource • Tables, Stored Procedures, etc.
Summary • 3-tier applications are recommended • easier to maintain, update, migrate, etc. • top tier works with user • bottom tier handles data from data source • middle tier handles complex processing