IT Unit 3
IT Unit 3
• API
• Data formats
• JSON: JavaScript Object Notation is quickly becoming the most popular data format.
• XML: The main data format in the earlier days of the Web, eXtensible Markup
Language was predominantly used by Microsoft systems.
• CSV: Comma-Separated Values is data formatted by commas. Excel data is typically
formatted this way.
Cont..
• GitHub: Referred to as a developer’s collaborative platform, GitHub is
now the largest online storage space of collaborative works that exist
in the world.
• In reality, GitHub itself is simply a social network like Facebook or
Instagram where you build a profile, upload projects to share, and
connect with other users by following their accounts.
• Web hosting- WAMP (Windows, Apache, MySQL, and PHP) LAMP
(Linux, Apache, MySQL, and PHP
Client-Side and Server-Side Scripting
• The scripts may be created in two ways: on the client side or
the server side, where the server-side scripts are processed on a
server.
• In contrast, client-side scripting needs browsers to execute scripts on
the client system but doesn't connect with the server executing the
client-side scripts.
Cont..
Model-View-Controller Architecture for Web
Application Development
• Model-View-Controller (or MVC, as it is popularly called) is a software
design pattern for developing web-based, desktop, and mobile
applications.
• It has been a widely adopted web development framework written to
split up the business logic, database access, and presentation layers,
thus separating the input, processing, and output of an application.
• The framework has three interconnected components:
• the model,
• the view, and
• the controller.
Cont..
• Model: The lowest level of the pattern, which is responsible for
maintaining data.
• It concerns the data structure/database schema used.
• It responds to the request from the view and also responds to
instructions from the controller to update itself.
• View: This is about “what a user sees.”
• It is responsible for displaying all or a portion of the data to the user.
• It presents the data in a particular format triggered by a controller’s
decision.
Cont..
• Controller: The code that controls the interactions between the
model and the view.
• The controller is responsible for responding to user input and
performs interactions on the data model objects.
• The controller
• receives the input,
• it validates the input,
• and then it performs the business operation that modify the state of the data
model.
Cont..
Disadvantages:
• It is difficult to read, change, test, and reuse this model
• It is not suitable for building small applications.
• The inefficiency of data access in view.
• The framework navigation can be complex as it introduces new
layers of abstraction which requires users to adapt to the
decomposition criteria of MVC.
• Increased complexity and Inefficiency of data
Client-Side Technologies
HTML: Hypertext Markup Language
• Hypertext Markup Language (HTML) is a simple text formatting
language for annotating a document in a way that is syntactically
distinguishable from the text, thus creating hypertext documents.
• A hypertext document is viewed in a web Browser, such as Internet
Explorer or Netscape Navigator.
• The browser is a program that understands the document written in
HTML and displays it by interpreting the document contents.
• A unique feature of this versatile language is that it allows the
creation of links, also known as hyperlinks.
Cont..
Creating an Hypertext Markup Language Document
• Every HTML document corresponds to a single page.
• An HTML document consists of HTML elements.
• HTML is a tag-oriented language (most HTML elements consist of a
Start Tag and an End Tag).
• HTML is not case sensitive (HeAD and hEAd mean the same thing).
• A file containing HTML elements can only be saved with the file
extension as .HTM or .HTML.
Cont..
• Tags
• Tags are control text used to denote various elements in an HTML
document.
• A tag in HTML comprises a left angular bracket (<), followed by a tag
name, and closed by a right angular bracket (>).
• For example: <html>, <body>, and <title>. The tags described here are
examples of start tags.
• Every start tag must have an end tag, which is similar to the start tag
but with a forward slash sign before the tag name: </html>, </body>,
and </title>.
Cont..
Hypertext Markup Language Element
• HTML elements are fundamental blocks of a web page. Here is an
overview of HTML elements:
• Container elements: All container elements are paired (i.e., they have
start and end tags).
• The start tag consists of the tag name enclosed in left and right angular
brackets (for instance, <body>).
• The end tag is identical to the start tag except for a slash (/) that
preceeds the text within angular brackets of the end tag (e.g., </body>).
• Container elements contain parameters and parameters of an element
are given between the start tag and the end tag.
Cont..
• Empty elements: Empty elements have only
a start tag and no end tag.
• Hence, an empty element has no
parameters, but can take attributes given
within the angular brackets of the start tag.
• HTML attributes: Attributes are used to
define an HTML element’s characteristics
and are placed inside the element’s opening
tag.
• All attributes are made up of two parts: a
name (the property that you want to set)
and a value (the value of the named
property).
• The value is always put in quotes. Attribute
names and values are not case sensitive, but
lowercase is recommended. Basic structure of an HTML page.
CSS: Cascading Style Sheets
• CSS stands for Cascading Style Sheets
• It is a style sheet language used for describing the look and
formatting of a document written in HTML (Hypertext Markup
Language).
• CSS separates the presentation of a web page from its structure,
allowing web designers to control the visual appearance and
layout of multiple web pages at once.
Types of CSS
There are three ways of inserting a style sheet:
body {
background-color: lightblue;
}
h1 {
color: purple;
margin-left: 20px;
}
Cont..
Linking your document to your
stylesheet <!DOCTYPE html>
<html>
• Create another text file; this file will <head>
be your HTML document. Name it <link rel="stylesheet" href="style1.css">
whatever you like. </head>
<body>
• In your HTML file, copy and paste hypertext reference
the following lines; the <link...> line <h1>This is a heading</h1>
references your style sheet: <p>This is a paragraph.</p>
</body>
</html>
JavaScript
• JavaScript (js) is a light-weight object-oriented programming language
which is used by several websites for scripting the webpages.
• It was introduced in the year 1995 for adding programs to the
webpages in the Netscape Navigator browser.
• Since then, it has been adopted by all other graphical web browsers.
• With JavaScript, users can build modern web applications to interact
directly without reloading the page every time.
• The traditional website uses js to provide several forms of interactivity
and simplicity.
Cont..
Features of JavaScript
1.All popular web browsers support JavaScript as they provide built-in
execution environments.
2.JavaScript follows the syntax and structure of the C programming
language. Thus, it is a structured programming language.
3.JavaScript is an object-oriented programming language that uses
prototypes rather than using classes for inheritance.
4.It is a light-weighted and interpreted language.
5.It is a case-sensitive language.
6.JavaScript is supportable in several operating systems including,
Windows, macOS, etc.
Cont..
<html>
• JavaScript Example <body>
<h2>JavaScript Sample Program</h2>
<script>
document.write(“Welcome 4th BCA");
</script>
</body>
</html>
<!DOCTYPE html>
One of many JavaScript <html>
<body>
HTML methods
is getElementById() <h2>JavaScript in Body</h2>
<p id="demo"></p>
<script>document.getElementById("demo").innerHTML = "My First JavaScript";
</script>
</body>
</html>
Cont..
<!DOCTYPE html>
<html>
Button onclick <body>
</body>
</html>
<!DOCTYPE html>
<html>
Writing into the HTML output using <body>
document.write() by using button
<h2>Add 2 numbers</h2>
<button type="button" onclick="document.write(5 + 6)">Try it</button>
</body>
</html>
Cont..
<!DOCTYPE html>
<html>
The function is <head>
invoked (called) <script>
when a button is function myFunction() {
clicked document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
a JavaScript </head>
function is placed <body>
in the <head>
section of an HTML <h2>Demo JavaScript in Head</h2>
page.
<p id="demo">A Paragraph.</p>
<button type="button" onclick="myFunction()">Try it</button>
</body>
</html>
Cont..
<!DOCTYPE html>
• Bulb-off and Bulb- <html>
On Program using JS <body>
<h2>On/OFF Blub</h2>
<button
onclick="document.getElementById('myimage').src='pic_bulbon.gif'
">Turn on the light</button>
<img id="myimage" src="pic_bulboff.gif">
<button
onclick="document.getElementById('myimage').src='pic_bulboff.gif'
">Turn off the light</button>
</body>
</html>
Bootstrap Framework
• Bootstrap is the most popular open source front-end (HTML,
CSS, and JavaScript) framework for developing responsive,
mobile-first projects on the Web.
• It includes HTML- and CSS-based design templates for
typography, forms, buttons, tables, navigation, modals,
image carousels, and more, as well as optional JavaScript
plug-ins.
• Bootstrap was developed by Jacob Thornton and Mark Otto
at Twitter and was released as an open source product in
August 2011 on GitHub
Bootstrap framework.
Cont..
Bootstrap has three main files:
• bootstrap.css: A CSS framework
• bootstrap.js: A JavaScript/jQuery
framework
• glyphicons: A font (an icon font set)
• Additionally, Bootstrap requires
jQuery to function.
• jQuery is an extremely popular and
widely used JavaScript library, which
simplifies and adds cross-browser
compatibility to JavaScript.
Cont..
Thus, the Bootstrap package includes:
• Scaffolding: A basic structure with Grid System, link styles, and
background
• CSS: Global CSS settings, fundamental HTML elements styled and
enhanced with extensible classes, and an advanced grid system.
• Components: Over a dozen reusable components built to provide
iconography, dropdowns, navigation, alerts, pop-overs, and much more.
• JavaScript plug-ins: One can easily include all of them at once or one at a
time
• Customization: The ability to customize Bootstrap’s components, LESS
variables. The biggest advantage of using Bootstrap is that it consists of
tools for creating flexible and responsive web layouts, as well as common
interface components.
Cont..
Key features
• Responsive features: Bootstrap gives you the ability to easily create
responsive designs. The responsive features make your web pages
appear correctly on different devices and screen resolutions without
any change in markup.
• Consistent design: All Bootstrap components share the same design
templates and styles through a central library so the designs and
layouts of your web pages are consistent.
• Compatible with browsers: Bootstrap is created with modern
browsers in mind and it is compatible with all modern browsers, such
as Mozilla Firefox, Google Chrome, Safari, edge, and Opera.
• Open source: It is completely free to download and use.
AngularJS Framework
• AngularJS is an open-source web application framework.
• It was originally developed in 2009 by Misko Hevery and
Adam Abrons. It is now maintained by Google. Its latest
version is 1.2.21.
• AngularJS is a structural framework for dynamic web
applications.
• It lets you use HTML as your template language and lets you
extend HTML's syntax to express your application components
clearly and succinctly.
Cont..
General Features
• AngularJS is an efficient framework that can create Rich Internet Applications
(RIA).
• AngularJS provides developers an option to write client-side applications
using JavaScript in a clean Model View Controller (MVC) way.
• Applications written in AngularJS are cross-browser compliant. AngularJS
automatically handles JavaScript code suitable for each browser.
• AngularJS is open source, completely free, and used by thousands of
developers around the world. It is licensed under the Apache license version
2.0.
• Overall, AngularJS is a framework to build large-scale, high-performance,
and easy to-maintain web applications.
Cont..
Core Features
• Data-binding − It is the automatic synchronization of data between model
and view components.
• Scope − These are objects that refer to the model. They act as a glue
between controller and view.
• Controller − These are JavaScript functions bound to a particular scope.
• Services − AngularJS comes with several built-in services such as $http to
make a XMLHttpRequests. These are singleton objects which are
instantiated only once in app.
• Filters − These select a subset of items from an array and returns a new
array.
• Directives − Directives are markers on DOM elements such as elements,
attributes, css, and more. These can be used to create custom HTML tags
that serve as new, custom widgets. AngularJS has built-in directives such
as ngBind, ngModel, etc.
Cont..
• Templates − These are the rendered view with information
from the controller and model. These can be a single file (such
as index.html) or multiple views in one page using partials.
• Routing − It is concept of switching views.
• Model View Whatever − MVW is a design pattern for dividing
an application into different parts called Model, View, and
Controller, each with distinct responsibilities. AngularJS does
not implement MVC in the traditional sense, but rather
something closer to MVVM (Model-View-ViewModel). The
Angular JS team refers it humorously as Model View
Whatever.
Cont..
• Deep Linking − Deep linking
allows to encode the state
of application in the URL so
that it can be bookmarked.
The application can then be
restored from the URL to
the same state.
• Dependency Injection −
AngularJS has a built-in
dependency injection
subsystem that helps the
developer to create,
understand, and test the
applications easily.
Cont..
<!DOCTYPE html>
• The ng-app <html ng-app>
<script
directive tells src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/ang
AngularJS that this ular.min.js"></script>
is the root <body>
</body>
</html>
Cont..
Disadvantages of AngularJS
• Though AngularJS comes with a lot of merits, here are some
points of concern −
• Not Secure − Being JavaScript only framework, application
written in AngularJS are not safe. Server side authentication
and authorization is must to keep an application secure.
• Not degradable − If the user of your application disables
JavaScript, then nothing would be visible, except the basic
page.
Server-Side Scripting
All server-side technologies share a common set of features: Read data
submitted by the user.
• Generate HTML dynamically based on user input.
• Determine information about the client browser.
• Access database systems.
• Exploit the HTTP protocol.