Ccs332 Unit 01
Ccs332 Unit 01
Two Types
Frontend Development
The part of a website where the user interacts directly is termed as front end. It is also
referred to as the ‘client side’ of the application.
Frontend Roadmap:
HTML: HTML stands for Hyper Text Markup Language. It is used to design the front end
portion of web pages using markup language. It acts as a skeleton for a website since it is
used to make the structure of a website.
CSS: Cascading Style Sheets fondly referred to as CSS is a simply designed language
intended to simplify the process of making web pages presentable. It is used to style our
website.
Bootstrap: Bootstrap is a free and open-source tool collection for creating responsive
websites and web applications. It is the most popular CSS framework for developing
responsive, mobile-first websites. Nowadays, the websites are perfect for all browsers (IE,
Firefox, and Chrome) and for all sizes of screens (Desktop, Tablets, Phablets, and Phones).
Bootstrap 4
Bootstrap 5
Backend Development
Backend is the server side of a website. It is part of the website that users cannot see and interact
with. It is the portion of software that does not come in direct contact with the users. It is used to
store and arrange data.
Backend may be
Gomathi N. Page 1
PHP: PHP is a server-side scripting language designed specifically for web development.
Java: Java is one of the most popular and widely used programming languages. It is highly
scalable.
Front End
Gomathi N. Page 2
Python: Python is a programming language that lets you work quickly and integrate systems
more efficiently.
Node.js: Node.js is an open source and cross-platform runtime environment for executing
JavaScript code outside a browser.
These types of apps normally run in the native devices, that is, it runs only in the OS that it
is specifically designed for it. These apps cannot be used on different devices using a different OS.
The apps that are developed for android are normally coded using Java or Kotlin languages. The
Gomathi N. Page 3
IDE normally used for android app development is Android Studio which provides all features and
the apps that are developed for IOS are generally coded in Swift language or Objective-C. The IDE
suggested for IOS App Development is XCode.
Example,
Here’s an example of a 1st party native app:
A retail company wants to improve the in-store shopping experience for its customers. They
develop a 1st party native app that allows customers to:
In this example, the retail company is the 1st party, and the app is a native app, because it is
developed for the specific platform (iOS or Android) and can take full advantage of the device’s
capabilities and features.
Example,
Here’s an example of a Progressive Web App:
A news website wants to provide its users with a better mobile experience. They develop a
Progressive Web App that:
Allows users to access the website offline by storing content on the user’s device
Sends push notifications to users to alert them of breaking news
Can be installed on the user’s home screen like a native app
Gomathi N. Page 4
3. Cross-Platform Application:
These are frameworks that allow developing total native applications which have access to
all the native features of IOS and Android but with the same code base. These apps run on both
Android and IOS. So normally the development speeds of these apps are very fast and the
maintenance cost is low. The performance speed is comparatively low to 1st party native apps but
faster than PWA.
Example,
Here’s an example of a cross-platform application:
A project management company wants to create a project management tool that can be used by
teams on different platforms. They develop a cross-platform application that:
2. Native App
Gomathi N. Page 5
The term native app refers to platforms such as Mac and PC. The Photos, Mail or Contacts
applications that are preinstalled and configured on every Apple computer is the example for
Native App.
The programming languages and tools required for developing native apps are specific to
each platform. Android app developers would use Java or Kotlin, whereas iOS app
developers would use Objective C or Swift. A native Android application cannot run on the
iOS system, nor can a native iOS app run on the Android system.
For users to access the native applications, they have to download them from the platform-
specific stores, i.e., App Store for iOS and Play Store for Android.
Gomathi N. Page 6
Despite the many wonderful benefits of native apps, they also have some drawbacks
or challenges. Let us see what they are and how they affect native app development.
1. Higher Development Costs
Since you will have to build separate apps for different platforms, the development
will get costly. For each platform, you will need to hire different development teams. Further,
app maintenance also has to be done separately for each platform. This is a major challenge
of native app development.
2. More Development Time
Unlike hybrid apps, native apps cannot use a single codebase for multiple platforms.
Separate codes need to be written for different platforms. That doubles up the time of app
development.
3. Need for Skilled Developers
The development of native apps is somewhat complex, and a skilled team of
developers are needed to create a successful native app. The programming languages used are
more advanced, and it isn’t easy to find developers proficient in those languages.
4. Require Constant Updates
Whenever there is a new update or a bug fix, the users have to update the app to the
latest version from the respective app store. Otherwise, they may experience glitches while
operating the app.
5. Lengthy Downloading Process
Compared to web app development, a major disadvantage of native app development
is that native apps have to be downloaded. The app download is a multi-step process
including going to the app store, finding an app, complying with its terms, downloading, and
installing. This requires users to spend considerable time and effort and may result in user
attrition.
Gomathi N. Page 8
An IDE is a platform for writing and debugging applications. It brings together all the
components needed for programming in one place. An IDE creates a convenient user
interface for developers to make programming easier.
Some SDKs have dedicated IDE included with them, while some don’t. If an SDK
does not include an IDE, developers can download and install any compatible IDE or use a
text editor to write programs.
Native App Development for Android
Native app development for Android uses tools like
Android SDK combined with Android Studio
Firebase
Android Jetpack
Mockplus
Command-line tools for Windows, Mac, and Linux.
The programming language that it uses is Java or Kotlin. Java is a popular
programming language used widely by developers all over the world. A notable aspect of
Java is its “Write once, run anywhere” feature. It means that a compiled Java code can run on
any Java supporting platform without recompilation. Java is an object-oriented programming
language and is secure, robust, and developer-friendly.
Native App Development for iOS
The tools and resources that support the development of mobile apps for iOS are
iOS SDK integrated with Cocoa Touch UI framework
XCode (official IDE)
Swift Playgrounds
TestFlight (for beta testing)
Apart from these, there are also third-party tools like AppCode and CodeRunner.
The programming language Swift is known for its speed, safety, and leading
advancements aimed to provide consistent and powerful performance to developers. Swift is
well recognized for its excellent error detection and handling capabilities.
A hybrid application is a software app that combines elements of both native and web
applications.
Hybrid apps are popular because they allow developers to write code for a mobile app once
and still accommodate multiple platforms. Because hybrid apps add an extra layer between
Gomathi N. Page 9
the source code and the target platform, they may perform slightly slower than native or web
versions of the same app.
Developers build hybrid apps using web technologies such as JavaScript, CSS and HTML.
The code is then wrapped within a native application using open-source hybrid app
development frameworks, like Ionic or React Native. This allows the app to run through each
platform’s embedded browser instead of the web browser, which means they can be installed
on mobile devices and submitted to app stores for sale, just like regular native apps.
Five hybrid mobile apps that is extremely popular among users across the globe:
Instagram is the most popular social media app for sharing images and videos. Going hybrid enables
the app to support tons of media and offline data. The app permits users to access its features and
media, photos, and short videos while also being in the offline mode.
Another great example of hybrid app development in action is the Uber application. With easy
navigation and an intuitive user interface, Uber is easily accessible and convenient, which is why this
hybrid app is probably the most used ridesharing app in the world.
Previously built using HTML, Google has upgraded to HTML 5 to provide users with new,
advanced features and functionalities, thus enhancing the user experience. This is the perfect
example of combining native and web elements to create a high-performance mobile application.
Gomathi N. Page 10
With a beautiful design and its ability to work flawlessly on different devices, this productivity app
stands out for its performance. Something that goes against the premise that hybrid apps are slow
and of low performance.
Twitter is another hybrid app proving that performance is not an issue for this type of app
development. The social media application can handle huge amounts of traffic, and it’s accessed by
millions of users every day.
Easier scalability. Because hybrid apps use a single codebase, they can be deployed across
devices. For example, when you build them for Android, you can quickly launch them on
iOS.
Single codebase to manage. Unlike native app building, where you have to create two apps,
with hybrid software building, you develop only one app, so you only need to manage one
database.
Faster build time. Since there is one database to manage, it takes less time to make a hybrid
than native apps.
Low cost of development. Hybrid mobile apps cost less than native apps. Because developers
write one set of code, the initial costs and the maintenance costs are low.
Offline availability. Hybrid apps will work in an offline mode due to their native
infrastructure. Users can still load the application and see the previously loaded data if they
can't access real-time data.
User experience. Considering that there is one codebase for all platforms, the user experience
might not be positive. We are talking about different operating systems, so it is difficult to
customize an app based on one platform.
Lower performance. Hybrid mobile apps load in a web view that is difficult to reach a native
performance, and that’s one of their biggest drawbacks.
Availability of features. Some new features of the hybrid software are not available for some
platforms. What’s more, some native features may not even exist.
Gomathi N. Page 11
Titanium
React Native
Xamarin
Flutter
Native Script
Ionic
Js
PhoneGap(Cordova)
Each one of these comes with its unique feature and offerings.
The choice of the best solution for near-native or hybrid development depends on multiple factors,
including:
Without taking these factors into consideration, it’s impossible to say which of these tools for near-
native and hybrid mobile application development is the best.
1. Faster development
With cross-platform solutions, developers mostly work with one codebase which handles iOS
and Android and there is no need to build separate Android or iOS projects. Everything is in one
place. Cross-platform applications are built as single projects but support different devices. It is
possible to reuse a big part of an app’s code between platforms, and that’s why development is much
quicker.
2. Lower costs
Gomathi N. Page 12
In comparison to native applications, a cross-platform one can be about 30% cheaper than
building iOSand Android apps separately. We just have one project for both iOS and Android, and
big chunks of code and other assets can be reused between the platforms. In this way, cross-platform
development is faster so, as a result, the overall cost for each platform is less than developing native
mobile apps.
3. Wider audience
Many app owners face a challenge when starting with mobile app development: is it better to
create an Android or an iOS application first? No matter which platform has a bigger market, it is
always a trade-off which can cost a lot of money. Starting with a cross-platform solution we get a
much wider audience at the very beginning – we can target both markets at the same time. We can
also build for one platform first to release the product faster, and then quickly iterate on adding
support for second platform.
iOS and Android have some differences in terms of building navigation and design. In cross-
platform development, most popular UI differences are handled by default. In native development,
even in a team with great communication, there can be some differences in implementing
functions. In cross-platform development, this situation doesn’t occur often, as the platforms share
the same codebase. It also allows you to build a more coherent brand identity in apps on both
platforms with less effort.
4. Reusable code
This is one of the greatest things about cross-platform applications – it’s possible to create
one codebase for Android and iOS at the same time. In native applications it is necessary to write
code separately, which is usually done by two different developers or teams. In custom mobile app
development, the whole codebase is in one place. This saves a lot of time, because one developer can
handle both platforms concurrently.
1. Lower performance
Cross-platform applications have to adapt their design and functionalities not only to specific
devices but also to platforms, which have many differences. As a result, it creates extra work for
developers who have to handle specific exceptions for a variety of devices and platform differences,
especially with more complicated features. These issues don’t occur that often in native apps, so
developers can focus on solving users’ problems.
Gomathi N. Page 13
Every time Google or Apple introduces a new feature for Android or iOS, it takes some time
to update applications to support this new feature. In native apps, new SDKs are provided with the
updates much faster than for cross-platform frameworks.
After the PWA icon of the website is created in the device, all the posts that are open with the
help of the internet, are automatically stored in your device which does not need the internet to read
the second time. It is a methodology where we combine native app experience with the Browser
feature.
Generally, when we have to build applications, we have to develop that application for
different platforms, such as iOS, Android, and Windows. But in the case of PWA, we do not need to
develop separate applications for different platforms. We only need to create HTML 5 based
webpages that can run on any mobile browser.
Characteristics of PWA
1. Progressive: The term progressive means, a PWA application must work on any device and
improve the performance of the user's mobile browser and design.
2. Discoverable: A PWA is a website with some extra features. It can be searched via mobile
searching applications like Google Chrome. App Store or Play Store is not required for this.
3. Responsive: The UI of a progressive web app should fit the form factor and screen size of
the device.
4. App-like: A PWA application should look like a native application. Although the methods
for creating, sharing, launching, and updating of the PWA are completely different from the
original application.
5. Connectivity-independent: It works even when connectivity is very low.
Advantages of PWA
Gomathi N. Page 14
5. It saves money and time compared to creating applications separately for android, iOS, and
other platforms.
6. Post can be read even if there is no internet.
7. Internet data is less used in it.
8. PWA is cheaper than the other applications.
Disadvantages of PWA
1. It supports a limited mobile browser. It does not run on the safari, edge, and IE browser.
2. iPhone users cannot establish connections securely in it.
3. It makes maximum use of the battery of the device.
4. It needs to be hosted on the server because it is a web app.
5. It cannot be downloaded from popular app stores such as Google Play and Apple App Store.
6. PWA does not provide the same level of support for all devices. For example, push
notifications in PWA work on Android, but not on iOS.
7. It supports limited hardware functionality.
Gomathi N. Page 15
Update the app It does not require to update the It requires to update the application.
application.
The web app manifest is the first component of the PWA. It is a simple JSON file that controls a
user's application. Usually, it is named "manifest.json". It is the most important component for the
presence of PWA. When you first connect PWA to a network, a mobile browser reads the
"manifest.json" file and stores it locally in cache memory.
When there is no network access in PWA, the mobile browser uses the application's cache memory
to run the PWA program while offline.
The "manifest.json" file helps the PWA to give a look of a native app. With the help of the
manifest.json file, the PWA developer can control how the application is presented to the user
mobile screen. The PWA developer can also set a theme for the mobile's splash-screen and the
application's address bar.
The "manifest.json" file allows the PWA developer to search for a centralized location for the
metadata of the web application. The JSON file defines the links to icons and icon sizes, the full and
abbreviated name of an app, types, background color, theme, locations, and other visual details that
are required for an app-like experience.
2. Application Shell
The application shell is the third technical component of the PWA. It is specialized to split the static
and dynamic content of the application. The minimal CSS, HTML, JavaScript, and any other
dynamic and static resources offer the structure for your web page. It reduces the actual content that
Gomathi N. Page 16
is unique to the webpage. This component ensures a very critical approach to the development of
progressive web apps.
It permits the PWA to be executed without any connection. The basic design elements of this
component enable it to perform such a task. It drives especially for applications that are based on
JavaScript.
3. Service Worker
A service worker is a web worker. It is a JavaScript file that runs aside from the mobile browser. In
other words, it is another technical component that promotes the functionality of PWA. The service
worker retrieves the resources from the cache memory and delivers the messages.
It is independent of the application to which they are connected, and has many consequences:
o The service worker does not block the synchronized XHR, so it cannot be used in local
storage (It is designed to be completely asynchronous).
o It can receive information from the server even when the application is not running. It shows
notifications in the PWA application without opening in the mobile browser.
o It cannot directly access the DOM. Therefore, the PostMessage and Message Event Listener
method is used to communicate with the webpage. The PostMessage method is used to send
data, and the message event listener is used to receive data.
o It is a programmable-network proxy that helps you monitor how your page handles network
requests.
o It only works on the HTTPS because HTTPS is very secure, and it intercepts network
requests and modifies responses.
The service worker lifecycle is the most complex part of the PWA. There are three stages in the
lifetime of a service worker:
1. Registration
2. Installation
3. Activation
Registration
A service worker is basically a JavaScript file. You need to register it in your crucial JavaScript code
to use a service worker. Registration tells your browser location of the service worker and starts
installing it on the background. One thing that distinguishes a service worker file from a standard
JavaScript file is that a service worker runs in the background away from the mobile's main browser.
This process is the first phase of the service worker's lifecycle.
Gomathi N. Page 17
1. if ("Service-Worker- in navigator.js)
2. {
3. navigator. Service - worker. register ('/service-worker. json')
4. then (function (registration)
5. {
6. console.log ('Registration successful finish, scope is:', registration. scope.);
7. }
8. Catch (function (error)
9. {
10. console.log ('Registration failed, error:', error.js);
11. }
12. }
First, this code checks whether the browser supports the service worker. The service worker is then
registered with navigator.serviceWorker.register when the service worker returns a promise. If the
promise is fulfilled, the registration is successful; otherwise, the registration is failed.
Scope of registration
This scope determines the web pages that are managed by a service worker. The location of the
service worker defines the default scope. Whenever you register a service worker file at the main
folder of the system, it is not important to specify its scope, because it controls all webpages.
Installation
When a new service worker is registered with the help of navigator.serviceWorker.register, the
JavaScript code is downloaded, and the installation state is entered. If the installation succeeds, the
service worker further proceeds to the next state.
Gomathi N. Page 18
Activation
Once the service worker is successfully installed, it converts to the activation phase. If there is an
open page controlled by the previous service worker, the new service worker enters the waiting state.
The new service worker is activated only when no pages are loaded in the old service worker. A
service worker is not activated immediately after installation.
Service-worker.js
1. self.addEventListener('activate', function(event) {
2. // Perform some task
3. });
The service worker can manage network requests rather than caching. It roves around the
latest Internet API.
1. Fetch: The Fetch API is a basic resource of the GUI. It makes it easier to control webpage
requests and responses than older XMLHttprequests, and this often needs extra syntax, and its
example is controlling the redirects. When a resource is requested on the network than the fetal event
is terminated.
1. fetch('ABCs/ABC.json')
2. then (function (response){
3. // response function
4. })
5. catch (function (error)
6. {
7. console.log ('problem section: \n', error);
8. });
Gomathi N. Page 19
2. Cache API: A cache interface has been provided for the service worker API, which allows you to
create a repository of responses as requested. However, this interface was designed for service
workers. It does not update the memory in the cache unless specifically requested.
o Offline: Enabling offline functionality is possibly the most demanding service worker
facility.
o Caching: The control of cache content is the most common feature for service workers.
o Content delivery networks: The CDN and other external material may be difficult to
handle. The PWA developers sometimes select out of publicly hosted software due to same-
origin rules and SSL, but you may still upload scripts from CDNs.
o Push notifications: The feature of push notifications is the best way to interact with users
and visitors. This feature enhances the performance of the PWA application.
o Background synchronization: It is another very important feature of a service worker that
synchronizes tasks in the background.
4. Webpack
The webpack is the fourth component of the PWA. It is used to design the PWA front-end. It allows
the PWA-developers to gather all JavaScript resources and data in one location.
The transport layer security is the fifth component of the PWA. This component is a standard for all
robust and secure data exchange between any two applications. The integrity of the data requires the
website's service through the HTTPS and an SSL certificate installed on the server.
Install a PWA
Step 1: The first thing to do is open google chrome on your mobile phone.
Gomathi N. Page 20
Step 3: Now, click on the three dots of the right corner in the google chrome.
Gomathi N. Page 21
Step 4: Then, click on the Add to Home screen option and add it.
On iOS, you visit the website with the Safari browser and click the share icon. This opens a sub-
menu with more icons and an option to save to the home screen.
Gomathi N. Page 22
AliExpress
AliExpress is a popular e-commerce website that was introduced by the Alibaba Group. They turned
their website a few years ago to a Progressive Web App for mobile phones.
Flipkart
In India, Flipkart is the largest e-commerce website. Flipkart has recently updated its website for
mobile users to a PWA that is called Flipkart Lite. Flipkart lite combines the best of both the web
and native apps. It provides a fast and uninterrupted experience to smartphone phone users.
Twitter Lite
Twitter is a popular platform for social media. In 2017, they changed their website to Progressive
Web App for the mobile users that are called twitter lite. Twitter Lite loads posts instantly. It reduces
data usage by optimizing pictures and keep on cached data.
Twitter Lite rebuilds customers with push notifications system. It also allows users to connect the
Progressive Web App to their home screen of mobile phones.
Instagram is a very popular social media app. They changed their website to Progressive Web App
for mobile users. It reduces data consumption through processing photos.
Gomathi N. Page 23
BookMyShow
BookMyShow is a popular website in India that is used to book tickets online. In 2017, they changed
their website to Progressive Web App for mobile users.
Some uses had many problems with the BookMyShow mobile app. But PWA solved all problems. It
gives smartphone users a smooth ticket-booking experience.
MakeMyTrip
MakeMyTrip is the first online travel website in India. The website owner decided to invest in a
progressive web application to provide its users with a fast and appealing mobile web experience.
After changing to a Progressive Web App, Instagram saw incredible results:
Web pages can be viewed using many different devices: desktops, tablets, and phones. Your web
page should look good, and be easy to use, regardless of the device.
Web pages should not leave out information to fit smaller devices, but rather adapt its content to fit
any device:
Gomathi N. Page 24
It is called responsive web design when you use CSS and HTML to resize, hide, shrink, enlarge, or
move the content to make it look good on any screen.
Viewport
The viewport varies with the device, and will be smaller on a mobile phone than on a computer screen.
Before tablets and mobile phones, web pages were designed only for computer screens, and it was
common for web pages to have a static design and a fixed size.
Then, when we started surfing the internet using tablets and mobile phones, fixed size web pages were
too large to fit the viewport. To fix this, browsers on those devices scaled down the entire web page to fit
the screen.
HTML5 introduced a method to let web designers take control over the viewport, through
the <meta> tag.
You should include the following <meta> viewport element in all your web pages:
This gives the browser instructions on how to control the page's dimensions and scaling.
The width=device-width part sets the width of the page to follow the screen-width of the device
(which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.
Here is an example of a web page without the viewport meta tag, and the same web page with the
viewport meta tag:
Gomathi N. Page 25
Without the viewport meta tag With the viewport meta tag
Users are used to scroll websites vertically on both desktop and mobile devices - but not
horizontally!
So, if the user is forced to scroll horizontally, or zoom out, to see the whole web page it results in a
poor user experience.
Grid-View
Many web pages are based on a grid-view, which means that the page is divided into columns:
Using a grid-view is very helpful when designing web pages. It makes it easier to place elements on
the page.
A responsive grid-view often has 12 columns, and has a total width of 100%, and will shrink and
expand as you resize the browser window.
First ensure that all HTML elements have the box-sizing property set to border-box. This makes
sure that the padding and border are included in the total width and height of the elements.
Gomathi N. Page 26
*{
box-sizing: border-box;
}
The following example shows a simple responsive web page, with two columns:
Example
.menu {
width: 25%;
float: left;
}
.main {
width: 75%;
float: left;
}
The example above is fine if the web page only contains two columns.
However, we want to use a responsive grid-view with 12 columns, to have more control over the
web page.
First we must calculate the percentage for one column: 100% / 12 columns = 8.33%.
Then we make one class for each of the 12 columns, class="col-" and a number defining how
many columns the section should span:
CSS:
All these columns should be floating to the left, and have a padding of 15px:
Gomathi N. Page 27
CSS:
[class*="col-"] {
float: left;
padding: 15px;
border: 1px solid red;
}
Each row should be wrapped in a <div>. The number of columns inside a row should always add up
to 12:
HTML:
<div class="row">
<div class="col-3">...</div> <!-- 25% -->
<div class="col-9">...</div> <!-- 75% -->
</div>
The columns inside a row are all floating to the left, and are therefore taken out of the flow of the
page, and other elements will be placed as if the columns do not exist. To prevent this, we will add a
style that clears the flow:
CSS:
.row::after {
content: "";
clear: both;
display: table;
}
We also want to add some styles and colors to make it look better:
Example
html {
font-family: "Lucida Sans", sans-serif;
}
.header {
background-color: #9933cc;
color: #ffffff;
padding: 15px;
}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
Gomathi N. Page 28
.menu li {
padding: 8px;
margin-bottom: 7px;
background-color :#33b5e5;
color: #ffffff;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.menu li:hover {
background-color: #0099cc;
}
References
https://www.codewithrandom.com/2022/11/20/restaurant-website-using-html-css/
https://www.freecodecamp.org/news/responsive-web-design-modern-website-code-for-
beginners/
https://www.w3schools.com
Gomathi N. Page 29
Gomathi N. Page 30