SlideShare a Scribd company logo
Enterprise Systems & Frameworks
CS25010 - Web Programming
Connor Goddard
5th November 2015
Aberystwyth University
1
INTRODUCTION
In today’s session, we will aim to cover the following:
• Multi-tier Architectural Patterns
• Enterprise Systems
• Web Frameworks
2
INTRODUCTION
If you’re on Twitter, jump on your phones!
During the presentation, look out for tweets from @cgddrd with
the hashtag #cs25010.
These tweets will contain links to other material you may find
useful.
Feel free to tweet back with any questions.
3
A LITTLE BIT ABOUT ME
I’m a fifth-(and final!)-year MEng Software Engineering student.
Previous web modules include: CS15020, CS25010, CS25210, SE31520 &
SEM5640 (so pretty much them all…)
I spent my IY working at Renishaw plc, developing advanced web and
mobile applications (Android, iOS & hybrid)
I’ve played around with most web-related technologies including:
• PHP, ASP.NET, Node.js, Ruby-on-Rails, Python & OO-Javascript
4
WEB APPLICATIONS
• What do we mean by a “web application”?
• What makes a web application different to other
applications?
• Where does “the cloud” fit into it all?
5
WEB APPLICATIONS
To a typical consumer, web applications can appear… mystical.
Most do not appreciate all that has to go on “under the hood”.
What problems could this present on development projects?
6
[1]
[1] http://imgflip.com
ENTERPRISE SYSTEMS
When designing non-trivial web applications, we typically will
want to decompose the system into smaller parts.
• Separate presentation from business logic and data sources.
• Possibly delegate across multiple servers.
These are known as “multi-tier/n-tier” or “enterprise” systems.
As a consequence, interconnectivity between separate systems
and their servers becomes essential.
7
MULTI-TIER ARCHITECTURES
8
Web
Server
Application
Server
Database
Server
[1] https://en.wikipedia.org/wiki/Multitier_architecture
MULTI-TIER ARCHITECTURES
9
Web
Server
Application
Server
Database
Server
Model View Controller
e.g. HTML, ASP.NET, PHP, JSP, XML, JSON
e.g. PHP, JavaBeans,
C#, Ruby
Business Logic
Business Objects
Business Objects
RDBMS File StoresOO-DMS
e.g. MySQL, PostgreSQL, MongoDB, XML
Presentation Tier
Logic Tier
Data Tier
MULTI-TIER ARCHITECTURES
10
Example: Online Store
Presentation
Layer
Logic Layer Data Layer
MULTI-TIER ARCHITECTURES
There is a distinction between tiers and layers.
What is the difference between the two terms?
11
MULTI-TIER ARCHITECTURES
There is a clear distinction between tiers and layers.
What is the difference between the two terms?
‣ Layer: Logical organisation/separation of code (e.g. separating code
associated with presentation from that of business logic)
‣ Tier: Physical deployment of layers (e.g. across multiple servers)
12
MULTI-TIER ARCHITECTURES
Why would we want to use multi-tier systems?
• What would be the advantages?
• What would be the disadvantages?
13
MULTI-TIER ARCHITECTURES
Why would we want to use multi-tier systems?
Advantages:
• Separation of concerns
• Improved scalability
• Help to avoid single point of failure
• Improved problem solving/bug tracking (isolation of issues to specific part of system)
• Easier mapping of system entities to developer workload
Disadvantages:
• Could prove to be ‘overkill’ for very small projects
• Likely increase in code size and complexity
• Steeper learning curve - greater potential for bugs to be introduced
• Use of M-TA introduces greater risk for poor design choices - these can become expensive to fix later
• Easier mapping of system entities to developer workload - “Too many cooks spoil the broth.”
14
WEB FRAMEWORKS
15
WEB FRAMEWORKS
What frameworks do people know about?
Has anyone got any preferred frameworks?
16
WEB FRAMEWORKS
17
PHP
C# / VB / F#
Adobe Coldfusion
Javascript
PHP
Javascript
Ruby
WEB FRAMEWORKS
18
Good community
support
High feature
set
Long history
Fast and easy
to scale
Simple to set-up
Lightweight +
good community
support
Many tools ‘out
of the box’
WEB FRAMEWORKS
Frameworks aim to assist in the development of web
applications by alleviating some of the overhead associated
with common tasks:
• Database access, ORM, templates, authorisation, web services,
scaffolding, testing, caching, session management etc.
Web frameworks are not the same as CMS software (e.g.
Wordpress or Drupal)
• Frameworks provide general solutions to developing web applications.
• CMS software builds on top of underlying frameworks.
19
SCAFFOLDING
Scaffolding refers to a process whereby the ‘skeleton’ of an
application is automatically generated by the web framework.
20
Typically the reference to a database
is given, from which the code
relating to standard CRUD operations
is enacted without input from the
developer.
Scaffolded systems provide a good
starting point from which the main
application can be built upon.
[1] https://scaffoldinginsouthwest.wordpress.com/
[1]
SCAFFOLDING - RoR
One of the first ‘mainstream’ frameworks to support scaffolding
was Ruby-on-Rails.
Generating a new web application in RoR takes 3 lines of code:
21
1 # Step 1: Generate new web application.
2 rails new mywebapp && cd mywebapp
3
4 # Step 2: Create new model entity and scaffold
5 CRUD operations (controller and views).
6 rails generate scaffold User surname firstname
7 age:integer is_student:boolean
8
9 # Step 3: Migrate the new model into SQLite
10 database (pre-created)
11 rake db:migrate
12
13 # Step 4: Start the server (navigate to http://<url>/users)
14 rails server
SCAFFOLDING - ASP.NET
ASP.NET is another framework that provides automatic creation
of web controllers and views from a pre-existing data model.
This is particularly useful within MVC projects where we are also
utilising object-relational mapping.
22
OBJECT-RELATIONAL MAPPING
Object-relational mapping (ORM) provides a mechanism for
representing and querying relational entities using an object-
based paradigm.
In other words: ORM allows us to map data stored in a
relational/tabular format into an OO format for use in
applications.
ORM helps to address an issue known as ‘Object-Relational
Impedance Mismatch’.
23
OBJECT-RELATIONAL MAPPING
Relational - Object mapping:
With ORM, it doesn’t matter what persistent storage mechanism we are
using (e.g. MySQL, NoSQL, XML data files etc.)
The framework handles this all for us.
24
Relational Model ORM
Table Class
Row Instance
Field Property
FRAMEWORKS, ORM & MVC
Many frameworks adopt an MVC pattern, supported by
mechanisms including scaffolding and ORM.
25
Generated via
ORM
Class for each model
responsible for:
• Handling incoming requests
• Retrieving model data
• Re-directing user to
appropriate view templates
Template files used
to render dynamic
data to end user (e.g.
HTML, XML, JSON)
[1] https://en.wikipedia.org/wiki/Model–view–controller
[1]
MVC - MODEL
26
ASP.NET (C#) PHP
1 namespace HelloMVC.Models
2 {
3 public class BlogPost
4 {
5
6 public virtual int Id
7 {
8 get; set;
9
10 }
11
12 public virtual string Title
13 {
14 get; set;
15
16 }
17
18 }
19 }
1 <?php
2
3 class BlogPost {
4
5 public $id;
6 public $title;
7
8 public function __construct($id, $title) {
9 $this->id = $id;
10 $this->title = $title
11 }
12
13 function save();
14 function setTitle();
15 ...
16
17 } ?>
1 namespace HelloMVC.Controllers
2 {
3 public class BlogPostController : Controller
4 {
5 private HelloMVCContext db = new HelloMVCContext();
6
7 public ActionResult Index()
8 {
9 return View(db.BlogPosts.ToList());
10 }
11
12 public ActionResult Create()
13 {
14 return View();
15 }
16
17 [HttpPost]
18 [ValidateAntiForgeryToken]
19 public ActionResult Create([Bind(Include = "Id,Title")] BlogPost blogPost)
20 {
21 if (ModelState.IsValid)
22 {
23 db.BlogPosts.Add(blogPost);
24 db.SaveChanges();
25 return RedirectToAction("Index");
26 }
27
28 return View(blogPost);
29 }
30 }
31 }
MVC - CONTROLLER
27
ASP.NET (C#) PHP
1 <?php
2
3 class BlogController {
4
5 function indexAction();
6 function createAction();
7
8 ...
9
10 } ?>
GET Request
POST Request
MVC - VIEW
28
1 {% block title %}Blog Posts{% endblock %}
2
3 {% block body %}
4
5 <h2>List of Posts</h2>
6
7 <ul>
8 {% for item in blog_posts %}
9 <li>
10 <a href="{{ path('blog_show', {'id': post.id}) }}">{{ post.title }}</a>
11 </li>
12 {% endfor %}
13 </ul>
14
15 {% endblock %}
1 @model IEnumerable<HelloMVC.Models.BlogPost>
2
3 @{
4 ViewBag.Title = "Blog Posts";
5 }
6
7 <h2>List of Posts</h2>
8
9 <ul>
10 @foreach (var item in Model) {
11
12
13 <li>
14 <a href="@Html.ActionLink("Details", "Details", new { id=item.id })">
15 @Html.DisplayFor(modelItem => item.Title)
16 </a>
17 </li>
18 }
19
20 </ul>
ASP.NET (Razor)
PHP
APPLICATION SERVERS
Of course, once we have developed our web application, we need to be able to
host and run it.
Application Server: Software designed to handle communication between a
front-end website, and a business back-end system.
Features include:
• Performance optimisation (caching, profiling etc.)
• Database management (population, transactions etc.)
• Load Balancing
• Logging/Debugging
• Security
• Data integrity support
• Deployment
• Recovery management (application isolation)
29
APPLICATION SERVERS
Application servers provide services and features appealing for
enterprise systems.
Remember: Enterprise systems imply large volumes of data,
high potential for scalability and co-ordination of business
processes across multi-tier architecture.
30[1] http://maaw.info/ArticleSummaries/ArtSumDavenport98.htm
[1]
APPLICATION SERVERS
31
Glassfish (Oracle)
JavaEE
IIS (Microsoft)
ASP.NET
Wildfly (Red Hat)
Java
Zend Server
PHP
Tomcat (Apache)
Java Servlets & JSP
IDEAS FOR ASSIGNMENT
32
While use of frameworks and multi-tier architectures is not an
explicit requirement for the assignment, you could always
investigate their use for your own learning…
… plus perhaps for some extra marks (cough cough)
Ideas to consider include:
• Database management functions
• Templates/server-side includes
• ORM
33
Many thanks for your time.
Questions?
@cgddrd
clg11@aber.ac.uk
http://cgddrd.me

More Related Content

What's hot

Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Er. Kamal Bhusal
 
Require js training
Require js trainingRequire js training
Require js training
Dr. Awase Khirni Syed
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
Lilia Sfaxi
 
Life above the_service_tier_v1.1
Life above the_service_tier_v1.1Life above the_service_tier_v1.1
Life above the_service_tier_v1.1
Ganesh Prasad
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
Olivier Eeckhoutte
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
MassoudmAlShareef
 
HTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery TrainingHTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery Training
ubshreenath
 
December 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig PresentationDecember 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig Presentation
Jonathan Abrams
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
Rich Helton
 
Php On Windows
Php On WindowsPhp On Windows
Php On Windows
Guy Burstein
 

What's hot (10)

Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Require js training
Require js trainingRequire js training
Require js training
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
 
Life above the_service_tier_v1.1
Life above the_service_tier_v1.1Life above the_service_tier_v1.1
Life above the_service_tier_v1.1
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
Wa html5-pdf
Wa html5-pdfWa html5-pdf
Wa html5-pdf
 
HTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery TrainingHTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery Training
 
December 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig PresentationDecember 4 SDForum Java Sig Presentation
December 4 SDForum Java Sig Presentation
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
Php On Windows
Php On WindowsPhp On Windows
Php On Windows
 

Similar to CG_CS25010_Lecture

Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
Frank La Vigne
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
MVC & backbone.js
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
Mohammed Arif
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
Manoj Sahoo
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
Nitin Sawant
 
Intro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUGIntro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUG
Ortus Solutions, Corp
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
TIB Academy
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
Prashant Kumar
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
Karthik Reddy
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
Karthik Reddy
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
Victor Porof
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
MaslowB
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!
 
ASP.NET 8 Developer Roadmap By ScholarHat PDF
ASP.NET 8 Developer Roadmap By ScholarHat PDFASP.NET 8 Developer Roadmap By ScholarHat PDF
ASP.NET 8 Developer Roadmap By ScholarHat PDF
Scholarhat
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
cNguyn506241
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
Hatem Hamad
 

Similar to CG_CS25010_Lecture (20)

Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
MVC & backbone.js
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
Intro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUGIntro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUG
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
 
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net DeveloperActively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
ASP.NET 8 Developer Roadmap By ScholarHat PDF
ASP.NET 8 Developer Roadmap By ScholarHat PDFASP.NET 8 Developer Roadmap By ScholarHat PDF
ASP.NET 8 Developer Roadmap By ScholarHat PDF
 
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
 

CG_CS25010_Lecture

  • 1. Enterprise Systems & Frameworks CS25010 - Web Programming Connor Goddard 5th November 2015 Aberystwyth University 1
  • 2. INTRODUCTION In today’s session, we will aim to cover the following: • Multi-tier Architectural Patterns • Enterprise Systems • Web Frameworks 2
  • 3. INTRODUCTION If you’re on Twitter, jump on your phones! During the presentation, look out for tweets from @cgddrd with the hashtag #cs25010. These tweets will contain links to other material you may find useful. Feel free to tweet back with any questions. 3
  • 4. A LITTLE BIT ABOUT ME I’m a fifth-(and final!)-year MEng Software Engineering student. Previous web modules include: CS15020, CS25010, CS25210, SE31520 & SEM5640 (so pretty much them all…) I spent my IY working at Renishaw plc, developing advanced web and mobile applications (Android, iOS & hybrid) I’ve played around with most web-related technologies including: • PHP, ASP.NET, Node.js, Ruby-on-Rails, Python & OO-Javascript 4
  • 5. WEB APPLICATIONS • What do we mean by a “web application”? • What makes a web application different to other applications? • Where does “the cloud” fit into it all? 5
  • 6. WEB APPLICATIONS To a typical consumer, web applications can appear… mystical. Most do not appreciate all that has to go on “under the hood”. What problems could this present on development projects? 6 [1] [1] http://imgflip.com
  • 7. ENTERPRISE SYSTEMS When designing non-trivial web applications, we typically will want to decompose the system into smaller parts. • Separate presentation from business logic and data sources. • Possibly delegate across multiple servers. These are known as “multi-tier/n-tier” or “enterprise” systems. As a consequence, interconnectivity between separate systems and their servers becomes essential. 7
  • 9. MULTI-TIER ARCHITECTURES 9 Web Server Application Server Database Server Model View Controller e.g. HTML, ASP.NET, PHP, JSP, XML, JSON e.g. PHP, JavaBeans, C#, Ruby Business Logic Business Objects Business Objects RDBMS File StoresOO-DMS e.g. MySQL, PostgreSQL, MongoDB, XML Presentation Tier Logic Tier Data Tier
  • 10. MULTI-TIER ARCHITECTURES 10 Example: Online Store Presentation Layer Logic Layer Data Layer
  • 11. MULTI-TIER ARCHITECTURES There is a distinction between tiers and layers. What is the difference between the two terms? 11
  • 12. MULTI-TIER ARCHITECTURES There is a clear distinction between tiers and layers. What is the difference between the two terms? ‣ Layer: Logical organisation/separation of code (e.g. separating code associated with presentation from that of business logic) ‣ Tier: Physical deployment of layers (e.g. across multiple servers) 12
  • 13. MULTI-TIER ARCHITECTURES Why would we want to use multi-tier systems? • What would be the advantages? • What would be the disadvantages? 13
  • 14. MULTI-TIER ARCHITECTURES Why would we want to use multi-tier systems? Advantages: • Separation of concerns • Improved scalability • Help to avoid single point of failure • Improved problem solving/bug tracking (isolation of issues to specific part of system) • Easier mapping of system entities to developer workload Disadvantages: • Could prove to be ‘overkill’ for very small projects • Likely increase in code size and complexity • Steeper learning curve - greater potential for bugs to be introduced • Use of M-TA introduces greater risk for poor design choices - these can become expensive to fix later • Easier mapping of system entities to developer workload - “Too many cooks spoil the broth.” 14
  • 16. WEB FRAMEWORKS What frameworks do people know about? Has anyone got any preferred frameworks? 16
  • 17. WEB FRAMEWORKS 17 PHP C# / VB / F# Adobe Coldfusion Javascript PHP Javascript Ruby
  • 18. WEB FRAMEWORKS 18 Good community support High feature set Long history Fast and easy to scale Simple to set-up Lightweight + good community support Many tools ‘out of the box’
  • 19. WEB FRAMEWORKS Frameworks aim to assist in the development of web applications by alleviating some of the overhead associated with common tasks: • Database access, ORM, templates, authorisation, web services, scaffolding, testing, caching, session management etc. Web frameworks are not the same as CMS software (e.g. Wordpress or Drupal) • Frameworks provide general solutions to developing web applications. • CMS software builds on top of underlying frameworks. 19
  • 20. SCAFFOLDING Scaffolding refers to a process whereby the ‘skeleton’ of an application is automatically generated by the web framework. 20 Typically the reference to a database is given, from which the code relating to standard CRUD operations is enacted without input from the developer. Scaffolded systems provide a good starting point from which the main application can be built upon. [1] https://scaffoldinginsouthwest.wordpress.com/ [1]
  • 21. SCAFFOLDING - RoR One of the first ‘mainstream’ frameworks to support scaffolding was Ruby-on-Rails. Generating a new web application in RoR takes 3 lines of code: 21 1 # Step 1: Generate new web application. 2 rails new mywebapp && cd mywebapp 3 4 # Step 2: Create new model entity and scaffold 5 CRUD operations (controller and views). 6 rails generate scaffold User surname firstname 7 age:integer is_student:boolean 8 9 # Step 3: Migrate the new model into SQLite 10 database (pre-created) 11 rake db:migrate 12 13 # Step 4: Start the server (navigate to http://<url>/users) 14 rails server
  • 22. SCAFFOLDING - ASP.NET ASP.NET is another framework that provides automatic creation of web controllers and views from a pre-existing data model. This is particularly useful within MVC projects where we are also utilising object-relational mapping. 22
  • 23. OBJECT-RELATIONAL MAPPING Object-relational mapping (ORM) provides a mechanism for representing and querying relational entities using an object- based paradigm. In other words: ORM allows us to map data stored in a relational/tabular format into an OO format for use in applications. ORM helps to address an issue known as ‘Object-Relational Impedance Mismatch’. 23
  • 24. OBJECT-RELATIONAL MAPPING Relational - Object mapping: With ORM, it doesn’t matter what persistent storage mechanism we are using (e.g. MySQL, NoSQL, XML data files etc.) The framework handles this all for us. 24 Relational Model ORM Table Class Row Instance Field Property
  • 25. FRAMEWORKS, ORM & MVC Many frameworks adopt an MVC pattern, supported by mechanisms including scaffolding and ORM. 25 Generated via ORM Class for each model responsible for: • Handling incoming requests • Retrieving model data • Re-directing user to appropriate view templates Template files used to render dynamic data to end user (e.g. HTML, XML, JSON) [1] https://en.wikipedia.org/wiki/Model–view–controller [1]
  • 26. MVC - MODEL 26 ASP.NET (C#) PHP 1 namespace HelloMVC.Models 2 { 3 public class BlogPost 4 { 5 6 public virtual int Id 7 { 8 get; set; 9 10 } 11 12 public virtual string Title 13 { 14 get; set; 15 16 } 17 18 } 19 } 1 <?php 2 3 class BlogPost { 4 5 public $id; 6 public $title; 7 8 public function __construct($id, $title) { 9 $this->id = $id; 10 $this->title = $title 11 } 12 13 function save(); 14 function setTitle(); 15 ... 16 17 } ?>
  • 27. 1 namespace HelloMVC.Controllers 2 { 3 public class BlogPostController : Controller 4 { 5 private HelloMVCContext db = new HelloMVCContext(); 6 7 public ActionResult Index() 8 { 9 return View(db.BlogPosts.ToList()); 10 } 11 12 public ActionResult Create() 13 { 14 return View(); 15 } 16 17 [HttpPost] 18 [ValidateAntiForgeryToken] 19 public ActionResult Create([Bind(Include = "Id,Title")] BlogPost blogPost) 20 { 21 if (ModelState.IsValid) 22 { 23 db.BlogPosts.Add(blogPost); 24 db.SaveChanges(); 25 return RedirectToAction("Index"); 26 } 27 28 return View(blogPost); 29 } 30 } 31 } MVC - CONTROLLER 27 ASP.NET (C#) PHP 1 <?php 2 3 class BlogController { 4 5 function indexAction(); 6 function createAction(); 7 8 ... 9 10 } ?> GET Request POST Request
  • 28. MVC - VIEW 28 1 {% block title %}Blog Posts{% endblock %} 2 3 {% block body %} 4 5 <h2>List of Posts</h2> 6 7 <ul> 8 {% for item in blog_posts %} 9 <li> 10 <a href="{{ path('blog_show', {'id': post.id}) }}">{{ post.title }}</a> 11 </li> 12 {% endfor %} 13 </ul> 14 15 {% endblock %} 1 @model IEnumerable<HelloMVC.Models.BlogPost> 2 3 @{ 4 ViewBag.Title = "Blog Posts"; 5 } 6 7 <h2>List of Posts</h2> 8 9 <ul> 10 @foreach (var item in Model) { 11 12 13 <li> 14 <a href="@Html.ActionLink("Details", "Details", new { id=item.id })"> 15 @Html.DisplayFor(modelItem => item.Title) 16 </a> 17 </li> 18 } 19 20 </ul> ASP.NET (Razor) PHP
  • 29. APPLICATION SERVERS Of course, once we have developed our web application, we need to be able to host and run it. Application Server: Software designed to handle communication between a front-end website, and a business back-end system. Features include: • Performance optimisation (caching, profiling etc.) • Database management (population, transactions etc.) • Load Balancing • Logging/Debugging • Security • Data integrity support • Deployment • Recovery management (application isolation) 29
  • 30. APPLICATION SERVERS Application servers provide services and features appealing for enterprise systems. Remember: Enterprise systems imply large volumes of data, high potential for scalability and co-ordination of business processes across multi-tier architecture. 30[1] http://maaw.info/ArticleSummaries/ArtSumDavenport98.htm [1]
  • 31. APPLICATION SERVERS 31 Glassfish (Oracle) JavaEE IIS (Microsoft) ASP.NET Wildfly (Red Hat) Java Zend Server PHP Tomcat (Apache) Java Servlets & JSP
  • 32. IDEAS FOR ASSIGNMENT 32 While use of frameworks and multi-tier architectures is not an explicit requirement for the assignment, you could always investigate their use for your own learning… … plus perhaps for some extra marks (cough cough) Ideas to consider include: • Database management functions • Templates/server-side includes • ORM
  • 33. 33 Many thanks for your time. Questions? @cgddrd clg11@aber.ac.uk http://cgddrd.me