Title: Creating an e:commerce Application with ASP'NET
1Creating an ecommerce Application with ASP.NET
2After working through the first Tutorial
- You should have created a basic ecommerce site
with the - following functionality
- A User and Log On system
- A Simple Search Page
- A Page Displaying Choices
- A Page for making Payments
- Website Administration Pages for Site Security
3Useful Video Tutorials
These tutorials can be found here
4More Video Tutorials
These tutorials can be found here
5A Few Words about OOP
- We have developed programs in
- JavaScript
- Visual Basic
- PHP
- Without using Object Oriented Programming
- Techniques
6What is Object Oriented Programming?
7Program Variables
- A program variable is a named area of computer
memory used to store data
Think of a variable as a box in which data is
stored
8Program Variables
29
9Best Practice
- A webpage is used to supply data to program
variables - The program statements then process the data
within the variables - The results of the processing are then sent from
the program variables to the webpage
10GUI, Variables Processing (1)
11GUI, Variables Processing (2)
The user Clicks the button and a copy of the data
is transferred to program variables
12GUI, Variables Processing (3)
20
40
Arithmetic and Logic Unit (ALU)
Add
The ALU adds the content of two variables storing
the result in a third variable
Program variable
13GUI, Variables Processing (4)
Program variable
60
The result of the addition is transferred from
the program variable to the GUI
14Tutorial Topics
- Creating a new project to add a class to
- Adding a class module to the project
- Adding class code to a module
- Writing code to create class instances
- Testing code in classes and in Sub Main
15(No Transcript)
16Add the following statements to the Investment
class code
17Class methods
- A method to calculate the amount that will be
returned given a specific set of investment
parameters (Capital, PIR and Duration) - A method to format and print the details of an
investment
18(No Transcript)
19Using the class in a short program
20(No Transcript)
21(No Transcript)
22(No Transcript)
23Add new investment to my portfolio
Investor
Investment
n
Web Page
Investor
Investment
24What about Encapsulation?
- Stop users from
- Investing more than 1000 pounds
- Investing for more than 10 years
- Investing at interest rates greater than 5
25Public Properties
To protect attributes make them private
Now your programs cant see them
26Create Public Properties for each Attribute
27(No Transcript)
28(No Transcript)
29Now add the business rules
30(No Transcript)
31(No Transcript)
32Interesting Development
- Visual Studio encourages us to use the same
programming language - VB, C or whatever
- Whether we are developing windows applications,
console applications or web applications.
33Why Bother with OOP?
34Northwind Tables
35A Closer Look at One Table
36A VB Front-End to Northwind DB
-
- Someone has developed a VB
- application to support this Use Case
-
Create an Invoice
37A VB Front-End to Northwind DB
- The Use Case involves the following
- three steps
- Take an order that's already been processed.
- Work out the value of everything in the order
- Print it out on a sheet of paper labelled invoice
38A VB form for the Use Case
39Possible Design Problems
- This form looks ok but the programmer has created
some serious maintenance problems - The problems relate to limitations of two-tier
client server applications
40What problems?
- The behind-the-scenes code gets an order number,
then goes out to the database (still implemented
in Access), grabs the order information, and
works out the financial details.
The code to do all of this is in the click event
of this button
41Another Use Case
Review Cash Flow
This allows the user to enter a couple of dates
and then get a complete list of all the
invoices/orders between those two dates.
42The Review Cash Flow Form
43Guess what?
All the code is in the click event for this button
44The Problem
- When you pull up an invoice in the Create Invoice
form, the total is usually different from the one
that appears in the Review Cashflow form. - If only we had an Invoice class
45Invoice
Date etc
Calculate Total
46No Duplication of Logic!
- The code for calculating totals appears in one
place only - The click events on both buttons simply call up
the Total method on the appropriate Invoice class - So theyre bound to be consistent!
47Sensible Location for Business Logic
- Future programmers will look for an invoice class
if they need to update the logic for calculating
the total value of an invoice - Just as they would look for a Customer table in
the database if they had to change the way we
store addresses.