20ITE02 -ADVANCED JAVA
PROGRAMMING
[Link]
Associate Professor
Department of IT
9788654804
[Link]@[Link]
What Is a Framework?
• A framework is a structure that you can build
software on.
• It serves as a foundation, so you're not
starting entirely from scratch.
• Frameworks are typically associated with a
specific programming language and are suited
to different types of tasks.
Why do you use frameworks?
• To provide a common structure so that
developers don't have to redo it from scratch
and can reuse the code provided.
• It allow us to cut out much of the work and
save a lot of time.
Java frameworks
• These are pre-built libraries and modules that provide a
set of common functionalities for building applications.
• Developers can easily integrate a set of reusable
components into their projects to help them write code
more efficiently and quickly.
• To provide flexibility to allow for the development of
various types of web applications that meet the varied
needs of users.
What framework is used in Java?
• Spring Framework is built for software design,
development, and deployment in Java.
• This Framework of java includes extensions
for software application development for
Java.
• Spring is majorly used in developing Web
Applications.
Is Spring boot a Java framework?
• Spring Boot is an open-source, microservice-
based Java web framework offered by Spring
• It is useful for software engineers developing
web apps and microservices.
skeleton
API Client tool
Software Architecture Design
During the application design the following factors are needed :
• Requirement Template
• Database design
• Performance (load & only needed Display)
• UI design / use experience (attract & easy of use)
• Validation (email is correct format ,DOB, date , length of character/ numbers all require field ,
maximum validation )
• Error handling (suddenly stop the software , user point of view is very bad- types of errors
handling is very important)
• Logging ( application monitoring through logging , may be database lock for past one year –
that all issues monitored through logging – fix the errors before the customer view )
• Code reuse
• No hardcode
• Regional setting (based on the country , date & time – database store)
• Initial data (for ex: drop down – no starting data available )
• Backup(data growth is very high in database)
• Reports (important – easy of use, check functionality to give very high, or file formats options
is very , file exports is very high)
Design patterns – during the software
development
• Represent the best practices followed by experienced
software developers
• Generalized solutions
• Particular solution is opt to particular application – that
solution is take a template format –that is design
pattern
• Targeted to solve the problems of object creation &
integration
• Design patterns act as template for real word problems
Use case ( written format for single function
)
• A use case is a written description of how
users will perform tasks
• For ex: Calculator – what are the
functionalities of this software
• 1. add ,sub ,mul, div – they are use various
types of functionalities - so use of the
particular case
• Write software usage in individual
Ex: School Management System /
facebook / instagram
• Functionalities explain / usage about particular task)
• Login – is a first use case ( authentication)
• Name of the use case – Login
• use case description / tell about the login use case - A user login to
system to access the functionality of the system
• Actor ( Who are the access the system) – parents , students , faculty ,
admin
• Pre-condition – System must be connected to the network or that user
should already have a account (signup)
• Post condition – after a successful login a notification mail is sent to the
user mail id
• Note – there are different kinds of template use the particular use case
Use Case
Diagram
How will interact with all use case or functionalities
through diagram
How to Get IT job before completing BE/[Link].
• Expected language - Java / Python – most of use complier is
javac ( all service and product based companies )
• Framework based language (java / C#)
• Communication ( How improve – presentation (Symposium /
club /cells/seminars)
• Bold speaking & Confidence speaking
• Java – OOPs concepts , Inheritance , Abstraction
• Collections – array , hashmap , ArrayList
• Strings
• Access modifiers – where it is use
• Static & instance variables
• & finally normal syntax
• Resume
Coupling in Java
• Tight coupling : It means the two classes often change
together.
• Example: if A knows more than it should about the
way in which B was implemented, then A and B are
tightly coupled.
• Example : If you want to change the skin, you would
also have to change the design of your body as well
because the two are joined together – they are tightly
coupled.
• The best example of tight coupling is RMI(Remote
Method Invocation).
class Topic {
public void understand()
{
[Link]("Tight coupling concept");
}
}
the Subject class is dependents on Topic class.
In this program Subject class is tightly coupled
class Subject {
with Topic class it means if any change in the
Topic t = new Topic(); Topic class requires Subject class to change.
public void startReading()
{ For example, if Topic class understand() method
[Link](); change to gotit() method then you have to
} change the startReading() method will call gotit()
} method instead of calling understand() method.
public class Main
{
public static void main(String[] args) {
Subject obj = new Subject();
[Link]();
} // tight coupling concept
class Volume
{
public static void main(String args[])
{
Box b = new Box(5,5,5);
[Link]([Link]);
} In this example, there is a strong inter-
dependency between both the classes.
}
class Box If there is any change in Box class then
they reflects in the result of Class
{ Volume.
public int volume;
Box(int length, int width, int height)
{
[Link] = length * width * height;
}
Loose coupling
• It means they are independent.
• If the only knowledge that class A has about class B, is
what class B has exposed through its interface, then
class A and class B are said to be loosely coupled.
• In order to over come from the problems of tight
coupling between objects, spring framework uses
dependency injection mechanism with the help of
POJO/POJI model and through dependency injection
its possible to achieve loose coupling.
public interface Topic
{
void understand(); // loose coupling concept
}
class Topic1 implements Topic {
public void understand()
{ [Link]("Got it"); }
}
class Topic2 implements Topic {
public void understand()
{ [Link]("understand"); }
}
public class Subject {
public static void main(String[] args)
{ Topic t = new Topic1();
[Link](); Topic1 and Topic2 objects are loosely coupled.
}
It means Topic is an interface and we can inject
} any of the implemented classes at run time and
we can provide service to the end user.
class Volume
{ public static void main(String args[])
{ Box b = new Box(5,5,5);
[Link]([Link]());
}
}
final class Box
{ private int volume;
Box(int length, int width, int height)
{ [Link] = length * width * height;
}
public int getVolume() there is no dependency between both the
{ return volume; } classes.
If we change anything in the Box classes then we
} dont have to change anything in Volume class.
Which is better tight coupling or loose
coupling?
• Tight Coupling is bad in but most of the time, because it
reduces flexibility and re-usability of code, it makes
changes much more difficult, it impedes test ability etc.
• loose coupling is a better choice because A loosely
coupled will help you when your application need to
change or grow.
• If you design with loosely coupled architecture, only a
few parts of the application should be affected when
requirements change.
Statefull vs Stateless Application
Stateful and stateless protocols
• Stateful and stateless protocols refer to the way in
which a server and client communicate and store
information.
• A stateful protocol maintains the state of the client
across multiple requests.
• This means that the server keeps track of the
client's state and session information, allowing for a
more personalized and tailored interaction.
• Examples of stateful protocols include FTP and
HTTP cookies.
Stateless Protocol Stateful Protocol
Stateless Protocol does not require the server to Stateful Protocol require server to save the
retain the server information or session details. status and session information.
Stateless Protocols works better at the time of Stateful Protocol does not work better at
crash because there is no state that must be the time of crash because stateful server
restored, a failed server can simply restart after a have to keep the information of the status
crash. and session details of the internal states.
Stateless Protocols handle the transaction very Stateful Protocols handle the transaction
fastly. very slowly.
Stateless Protocols are easy to implement in Stateful protocols are logically heavy to
Internet. implement in Internet.
The requests are not dependent on the server The requests are always dependent on the
side and are self contained. server side.
To process different information at a time , To process every request , the same server
different servers can be used. must be utilized.
Example of Stateless are UDP , DNS , HTTP , etc. Example of Stateful are FTP , Telnet , etc.