COMP3207 - Cloud Application Development


Cloud Computing Overview

Cloud Computing: the delivery of on-demand system resources, particularly data storage and computing power, without direct management by the user

A Cloud Service Provider is a third-party company offering a cloud-based platform, infrastructure, application, or storage service. Examples of CSPs are Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform.

Type

Method

Examples

On-Premises

Data stored locally

Home PC

IaaS (Infrastructure as a Service)

- Allows management of computers, networking, and storage over a network

- Allows full system management

- Allows low-level control

Amazon Cloud, Magento, VMware, VirtualBox

PaaS (Platform as a Service)

- Provides software and applications over the internet

- Allows users to develop, run, and manage applications

- Networks, servers, storage, and middleware are provided

Google App Engine, Windows Azure, SQL Azure

SaaS (Software as a Service)

- Utilises the internet to deliver applications, often runs through a web browser
-
Managed from a central location

- Hosted on a remote server

- Accessible over the internet

- User does not control hardware or software

Google Apps, Dropbox, Office 365



 On-Premises 
Applications 
Data 
Runtime 
Middleware 
Servers 
Storage 
Network in g 
O 
laaS 
Applications 
Runtime 
Middleware 
o/s 
Vi int ion 
Servers 
Storage 
Networki n g 
O 
PaaS 
Applications 
Data 
Runtime 
Middleware 
Virtualization 
Servers 
SaaS 
Applications 
Runtime 
Middleware 
o/s 
Virtualization 
Servers

Serverless Architectures

Serverless: cloud computing execution model where the cloud provider runs the server and dynamically manages resource allocation

Serverless means that code runs only on-demand and on a per-request basis.

Frontend: frontend infrastructure includes everything the end user interacts with, and makes up the user interface. This includes components such as local networks, web browsers, and web applications

Backend: backend architecture is comprised of hardware and storage located on servers, and powers the frontend architecture

Type

Method

Examples

BaaS (Backend as a Service)

- Provides backend functions in a mobile or web application

Common features such as:

- social network integration

- user management

- notifications

- Each service has its own API which can be incorporated into an app

- This creates a reusable backend which improves accessibility and performance

Firebase, Heroku, PythonAnywhere, Rackspace, BaasBox, UserGrid

FaaS (Function as a Service)

- Allows users to develop, run, and manage applications without maintaining infrastructure

- Abstracts servers from the user

- Associated with on-demand functionality

- The user only pays for execution time

AWS Lambda, Google Cloud, Apache OpenWhisk



Amazon Web Services

AWS Lambda: event-driven, serverless platform provided by Amazon as part of Amazon Web Services

 Complexity 
Handle 
load 
Monolith 
Reduce 
cost 
Microservices 
code 
m," Ing 
paaS

 

 Web Browser 
Dynamic API calls 
o•uer HTTP 
HTML, CSS, JavaScript, etc. 
Authenticate 
Amazon API Gateway 
Amazon S3 
Amazon Cognito 
User Pool 
AWS Lambda 
Amazon DynamoD3

 

 Amazon 
S3 
• Bucket Policies 
Browser 
Amazon Cognito 
Am azon 
CloudFront 
• Origin Access Identity (OAI) 
• Geo-Restriction 
• Signed Cookies 
• Signed URLs 
• DDOS Protection 
Amazon API 
Gateway 
• Throttling 
• Caching 
• Usage Plans 
• ACM 
• ACLs 
AVVS 
Lambda 
Amazon 
DynamoD

 

 Microsoft Azure

Microsoft Azure: cloud computing service for developing, testing, deploying, and managing web applications through Microsoft servers


 Azure Functions 
Service bus 
Cognitive services 
Machine learning 
SharePoint 
Logic Apps 
On-premises data 
gateway 
SQL 
O Office 365 
Docu*me

 

 APP 
Service 
Dynamic 
Runtime 
WebJobs 
core SDK 
WebJobs 
Script 
Runtime 
WebJobs 
Extensions 
Triggers 
Inputs/ 
Outputs 
Language 
Abstraction 
Code 
Config

 

 1) Trigger 
Azure Seruices 
2) Input Binding 
Azure Services 
3) Deploy 
4) Execute 
App Services 
Hosting Plans 
5) Output Binding 
atfiJ 
Azure Services 
7) Develop Locally 
6) Monitor and Improve

 
 Google App Engine

Google App Engine (GAE): cloud computing platform for developing and hosting web applications in Google data centers


 Development Life Cycle:

JavaScript

Node.js: open-source, cross-platform, backend JavaScript runtime environment built on Chrome's JavaScript engine which executes JavaScript code locally.

Variables

JS has three kinds of variable declarations:


 Data Types

 JS uses the following eight data types:

Type

Values

Object

superclass of other data types

Boolean

true, false

Number

integer, floating point number

BigInt

integer with arbitrary precision

String

sequence of characters

Symbol

unique immutable character

null

null value

undefined

variable which has been declared but is unassigned

JS is dynamically typed - values are typed but variables are not


 Conditional Statements

Loops & Iteration

==, !=

equal, not equal

===, !==

strict equal, not equal

>, <, >=, <=

comparative

+, -, *, /, %, **

mathematical

++, --

increment, decrement

&&, ||, !

logical

Collections


 concat() joins two or more arrays and returns a new array. 
join() joins all elements of an array into a string. 
push() adds one or more elements to the end of an array and 
returns the resulting length of the array. 
pop() removes the last element from an array and returns that 
element. 
shift() removes the first element from an array and returns 
that element. 
unshift() adds one or more elements to the front of an array 
and returns the new length of the array. 
slice() extracts a section of an array and returns a new array. 
splice() removes elements from an array and optionally 
replaces them. It returns the items which were removed from 
the array. 
reverse() transposes the elements of an array, in place: the 
first array element becomes the last and the last becomes the 
first. It returns a reference to the array. 
indexOf() searches the array for searchEIement and returns 
the index of the first match.


Functions

 
 function square(number) {

 return number*number;

 }

Higher Order Functions

 Higher Order Functions 
sort() sorts the elements of an array in place, and returns a 
reference to the array. It takes a function to determine how array 
elements are compared. 
forEach() executes function on every array item and returns 
undefined 
map() returns a new array that maps a function on every array 
item 
filter() returns a new array containing the items for which a 
function returns true 
every() returns true if a function returns true for every item in 
the array 
some() returns true if a function returns true for at least one 
item in the array 
reduce() a generalised aggregator higher order-function

 Object Functions
 Object.create() is used to create a new object 
and link it to the prototype of an existing 
object. 
Object.keys() creates an array containing the 
keys of an object. 
Object.values() creates an array containing the 
values of an object. 
Object.entries() creates a nested array of the 
key/value pairs of an object. 
Object.assign() is used to copy values from 
one object to another. 
Object.freeze() prevents modification to 
properties and values of an object, and 
prevents properties from being added or 
removed from an object. 
Object.isFrozen() is available to determine 
whether an object has been frozen or not, and 
returns a Boolean. 
Object.seal() prevents new properties from 
being added to an object, but allows the 
modification of existing properties. This 
method is similar to Object.freeze(). Refresh 
your console before implementing the code 
below to avoid an error. 
• NB All of these are static methods from 
JavaScript's Object class

 JavaScript in Web Pages

Document Object Model (DOM): formal API which abstracts the elements of HTML into a hierarchical structure consisting of nodes accessed by standard methods

document.querySelectorAll("p")

allA = document.querySelectorAll("a")

allURLs = Array.from(allA).map(a => a.getAttribute("href"))

allHTTPURLs = allURLs.filter(u => u.startsWith("http"))
 BROWSER VIEW 
Welcome to DOM 
A HTML CSS 
DOM STRUCTURE 
HTML FILE 
to 
A Web of HTML el—ts, 
CSS sty/ i ng md 
ale-tCTfE fist • +

 

Asynchronous Programming

Asynchronous Programming: method of parallel programming where tasks can run separately to the main application thread and communicate their completion, failure, or progress

<p class="credits"> <date>2013</date>

document.querySelector("date").textContent

new Date().getFullYear()

function checkdate() {

 if (document.querySelector("date").textContent == new Date().getFullYear())

 alert("correct");

else alert("incorrect");

 }

window.onload = checkdate
  
 Callbacks & Promises
  
 Callback: function which executes after another function is complete


Callback declaration:

 function addOne(number, callback) {

 alert(number +1);

 callback();

 }

 addOne(1, callback);


 Promise: alternative to a callback which represents the result of an asynchronous operation

 A promise can be pending, fulfilled, or rejected:

Promise declaration:


 new Promise(executor) 
state: 
result: 
"pending" 
undefined 
state: 
result: 
state: 
result: 
"fulfilled" 
value 
" rej ected" 
error

Promises can be connected to consuming functions such as then and catch:

Software Development Practices and Tips
 
 Practices for Software Development

 What are the barriers to writing good code?

Technical Debt: implied cost of additional work caused by choosing an limited solution rather than a more complex approach

Maintainability: ease with which a software system or component can be modified to correct faults, improve performance, or adapt to a changed environment

Top Tips for Software Development