Meeting 4
Understanding The Architecture
π Space in CIS Team – Web Development
1
Meeting Agenda
π Space in CIS Team – Web Development
2
Entry Level – 2 Months
π Space in CIS Team – Web Development
3
Beginner Level - 2 Months
π Space in CIS Team – Web Development
4
Intermediate Level - 4 Months
π Space in CIS Team – Web Development
5
DON’T START CODING WITHOUT THINKING FIRST!
π Space in CIS Team – Web Development
6
System Design
Modeling:
π Space in CIS Team – Web Development
7
System Architecture
CLIENT-SERVER Model
π Space in CIS Team – Web Development
8
CLIENT-SERVER-Model
π Space in CIS Team – Web Development
9
π Space in CIS Team – Web Development
10
Case Study: Me & Supermarket
"I’m asked to buy something from the supermarket, to buy some stuff..
But I’m really lazy, I want to stay home and just call delivery.
So I called the supermarket for delivery"
Mm, can you describe that simple process?
π Space in CIS Team – Web Development
11
Me & Supermarket Cont.
1- I call the number of the Supermarket عشان اعرف اوصله واكلمه
2- the Supermarket pick up the phone هيرد عليا
3- I REQUEST to buy somethings from the seller. اقوله انا
عايز ايه
4- the Supermarket RESPOND to Me
π Space in CIS Team – Web Development
12
Me & Supermarket Cont.
5- The Supermarket will tell me: If they have what I asked for or not
6- Send and deliver the response of what I asked for.
7- Then I took the things by a “BAG”
π Space in CIS Team – Web Development
13
What happened there?
“I (The Client) Requested (Made Request) Something (surely I want some resource) over the phone (Communication channel) From the Supermarket (The Server) who responded (made a RESPONSE) with what I wanted (The resource) and serve me and send it to the bag.”
π Space in CIS Team – Web Development
14
Components
π Space in CIS Team – Web Development
15
Client – Server Model.
π Space in CIS Team – Web Development
16
Client – Server Model.
π Space in CIS Team – Web Development
17
Communication Language
Do You speak English?
Sprechen Sie Deutsch?
لا الحوار كده صعب، لازم الاتنين يفهموا نفس اللغة عشان يقدروا يكلموا بعض.
π Space in CIS Team – Web Development
18
HTTP
π Space in CIS Team – Web Development
19
Full Example
π Space in CIS Team – Web Development
20
Full Example
1- You open your browser, the Client, and type in a web address like https://cisteam.org and hit enter.
2- The browser takes this address and builds an HTTP Request. It addresses it to the Server located at https://cisteam.org .
3- The Request is handed off to your Internet Service Provider (ISP) (like TEDATA) and they send it through the Internet, mostly a series of wires and fiber optic cables, to the Server.
π Space in CIS Team – Web Development
21
Full Example Cont.
4- The Server reads the Request. It knows how to read it because it is formatted as an HTTP Request.
5- The Server generates an HTTP Response to that Request.
π Space in CIS Team – Web Development
22
Full Example Cont.
6- The server hands the Response off to their ISP and it goes through the internet to arrive at your computer.
7- Your browser reads the Response. It knows how to read it because it is formatted as an HTTP Response.
8- Your browser displays the data on your machine
π Space in CIS Team – Web Development
23
Alert: Web Application?
Web Application: application software that runs on a web server.
Web Application is run by server side language: PHP
Web application is a client-side and server-side software application in which the client runs and can request service via web browser
π Space in CIS Team – Web Development
24
Backend vs Frontend
π Space in CIS Team – Web Development
25
PIC
π Space in CIS Team – Web Development
26
Backend vs Frontend
Backend: What you never see as a client
Frontend: Everything you see as a client
π Space in CIS Team – Web Development
27
Backend vs Frontend Cont.
Backend:
Frontend:
π Space in CIS Team – Web Development
28
Static Sites
static site “Only the files you want!”
π Space in CIS Team – Web Development
29
The Static Nightmare
Static vs Dynamic
π Space in CIS Team – Web Development
30
But what if you have a million user?��You will serve a million page!!
π Space in CIS Team – Web Development
31
OH NO!
π Space in CIS Team – Web Development
32
The Static Nightmare
Why not make everything Dynamic?
π Space in CIS Team – Web Development
33
More Intelligent Solution
π Space in CIS Team – Web Development
34
Dynamic sites
π Space in CIS Team – Web Development
35
Dynamic sites
π Space in CIS Team – Web Development
36
Dynamic Sites Cycle .
1. The server determines the product ID
/best?team=my_team_name&show=11
or
/best/my_team_name/11/
2. The Web Server detects that the request is "dynamic" and forwards it to the “Web Application” for processing.
π Space in CIS Team – Web Development
37
Dynamic Sites Cycle
3. Fetches the data from the database based on the id given.
4. Constructs the HTML page for the response by inserting the data into an HTML template.
5. Send the template to the client.
π Space in CIS Team – Web Development
38
An Updated Client – Server Model…
π Space in CIS Team – Web Development
39
Frontend
π Space in CIS Team – Web Development
40
I Can See That!
π Space in CIS Team – Web Development
41
HTML Intro
π Space in CIS Team – Web Development
42
HTML Cont.
HTML?
π Space in CIS Team – Web Development
43
HTML Element
What is an HTML Element?
<tagname>Content goes here...</tagname>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
π Space in CIS Team – Web Development
44
HTML Element attributes
Example:
<a href="http://www.example.com/">Visit this great website!</a>
- href here is an attribute
π Space in CIS Team – Web Development
45
HTML Example
π Space in CIS Team – Web Development
46
Life with HTML Only!
π Space in CIS Team – Web Development
47
The skeleton is now a human being with flesh and beauty!
π Space in CIS Team – Web Development
48
CSS To the Rescue
π Space in CIS Team – Web Development
49
CSS Syntax
π Space in CIS Team – Web Development
50
JavaScript
π Space in CIS Team – Web Development
51
You Don’t know JavaScript
π Space in CIS Team – Web Development
52
Backend
π Space in CIS Team – Web Development
53
You Can’t See Me!
π Space in CIS Team – Web Development
54
Server Side
π Space in CIS Team – Web Development
55
Consider it: The Car Engine!
π Space in CIS Team – Web Development
56
What is PHP
π Space in CIS Team – Web Development
57
Where is PHP?
Server Side
The Code that exists on the server only, never sent to the client.
You can write html inside php files.
Wait but why?
Because we want to create dynamic pages!
π Space in CIS Team – Web Development
58
PHP at Server Side
PHP is a server side language, which means what happens:
1- The web server processes PHP files first and figure out the data that needs to be displayed inside the html
2- Render the data inside the html page
3- Send the page to the browser with the new dynamic data
π Space in CIS Team – Web Development
59
π Space in CIS Team – Web Development
60
You already met PHP!
π Space in CIS Team – Web Development
61
Meet PHP on Steroids
π Space in CIS Team – Web Development
62
Laravel Framework
π Space in CIS Team – Web Development
63
π Space in CIS Team – Web Development
64
IMPORTANT NOTE!
Laravel is Easy!
Easy is dangerous!
π Space in CIS Team – Web Development
65
Meeting 5 & 6
Where are we?
π Space in CIS Team – Web Development
66
Recap:
π Space in CIS Team – Web Development
67
Client-Server & Dynamic Sites
π Space in CIS Team – Web Development
68
Client-Server Model with Dynamic Sites
π Space in CIS Team – Web Development
69
The Software Architecture
We knew the High Level System Architecture.
“Client – Server Model”
It’s Time To Know the design of our Web Application
Where to Start!
π Space in CIS Team – Web Development
70
Into The Web Application
π Space in CIS Team – Web Development
71
Meet Design Patterns.
“A Pattern is a solution to a problem in a context”.
The context:
is the situation in which the pattern applies. This should be a recurring situation.
The problem:
refers to the goal you are trying to achieve in this context, but it also refers to any constraints that occur in the context.
The solution:
is what you’re after: a general design that anyone can apply that resolves the goal and set of constraints.
π Space in CIS Team – Web Development
72
What is a compound Design Pattern?
“A Compound Pattern combines two or more patterns into a solution that solves a recurring or general problem.”
NOW INTERDUCING THE KING OF COMPOUND DESIGN PATTERNS:
MVC
π Space in CIS Team – Web Development
73
The King of Compound Patterns: MVC
Context: Building Web Application.
Problem: Separate the Functionalities of the Web Application.
Solution: We will use A certain organization of classes.
π Space in CIS Team – Web Development
74
HAHA, KING HA?
Other Design Patterns used to Bully MVC ☹
“You are just an Oreo!”
They Even created a song for him
π Space in CIS Team – Web Development
75
Oreo?
π Space in CIS Team – Web Development
76
π Space in CIS Team – Web Development
77
Head First Design Patterns 2nd Edition
Listen.
π Space in CIS Team – Web Development
78
Walkthrough
1-You’re the user—you interact with the view.
2- The controller asks the model to change its state.
3- The controller may also ask the view to change.
π Space in CIS Team – Web Development
79
Walkthrough Cont.
4- The model notifies the view when its state has changed.
5- The view asks the model for state..
π Space in CIS Team – Web Development
80
Recap For The Design Phase
Overall Architecture: Client – Server Model
Software Architecture: MVC
π Space in CIS Team – Web Development
81
Roadmap Alert!
1- Head First Object Oriented Analysis And Design
2- Head First Design Patterns 2nd edition
π Space in CIS Team – Web Development
82
Into The Communication Protocol��HTTP
π Space in CIS Team – Web Development
83
HTTP Request
π Space in CIS Team – Web Development
84
HTTP Verb and Path��Every request needs to be able to tell a server what information is requested and how that information is being requested.
π Space in CIS Team – Web Development
85
The What: “Path”
Examples of a path:
/tasks
/tasks/4
/items/6/reviews
π Space in CIS Team – Web Development
86
The How: “Verb”
π Space in CIS Team – Web Development
87
HTTP verbs:
π Space in CIS Team – Web Development
88
Request Vs Response
π Space in CIS Team – Web Development
89
Inside the Web Application:��MVC & Routing
π Space in CIS Team – Web Development
90
MVC & Routing
π Space in CIS Team – Web Development
91
Homework 1
π Space in CIS Team – Web Development
92
Thank You
π Space in CIS Team – Web Development
93