ITE 325 - Reviewer
ITE 325 - Reviewer
ITE 325 - Reviewer
Definition: Design patterns are general repeatable solutions to commonly occurring problems in
software design. They aren’t templates or actual code, but more like guidelines to solve a particular
problem in a certain way.
Elaboration: Design patterns can be seen as templates for how to solve software problems. They
represent solutions that have been developed and evolved over a long period by experienced software
developers.
Definition: Design principles represent high-level guidelines or best practices that software developers
should consider while designing system architecture.
Elaboration: They are broad concepts that can guide decisions, rather than specific solutions to
problems. Principles like SOLID in object-oriented design help in creating more maintainable, scalable,
and robust systems.
Nature: Design patterns provide specific solutions to specific problems, while design principles offer
broad guidelines.
Scope: Patterns address specific problems with a concrete solution, whereas principles guide decision-
making.
Example:
Pattern: Singleton pattern ensures a class has only one instance and provides a global point to access it.
Principle: The Single Responsibility Principle (SRP) from SOLID states that a class should have only one
reason to change.
Creational Patterns: Concerned with object creation. Examples: Singleton, Factory, Abstract Factory,
Prototype, Builder.
Structural Patterns: Concerned with how classes and objects are composed to form larger structures.
Examples: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy.
Behavioral Patterns: Define ways to communicate between objects. Examples: Observer, State,
Strategy, Command, Iterator, Mediator, Memento, Visitor, Chain of Responsibility, Template Method.
Single Responsibility Principle (SRP): A class should have only one reason to change.
Open/Closed Principle (OCP): Software entities should be open for extension, but closed for
modification.
Liskov Substitution Principle (LSP): Objects of a superclass should be able to be replaced with objects of
a subclass without affecting correctness.
Interface Segregation Principle (ISP): Clients should not be forced to implement interfaces they don’t
use.
Dependency Inversion Principle (DIP): High-level modules shouldn’t depend on low-level modules; both
should depend on abstractions.
Maintainability: Principles like SOLID make code more maintainable by reducing tight coupling, making
changes less risky and costly.
Software Design - An iterative process through which requirement are translated into blueprint for
constructing the software
Classes
Objects
Abstraction
Polymorphism
Inheritance
Encapsulation
ENCAPSULATION (IMPORTANT)
Encapsulation means enclosing the data/variables and the methods for manipulating the data into a
single entity called a class. It helps to hide the internal implementation of the functions and state of the
variables, promoting abstraction.
Benefits (IMPORTANT)
Security: By hiding the internal details of an object, encapsulation prevents unauthorized access and
modification of the object's state.
Modularity: Encapsulation promotes the organization of code into modular units (classes), making it
easier to understand and maintain.
Flexibility: The external interface of an object can remain consistent even if its internal implementation
changes, promoting flexibility in system design.
Challenges (IMPORTANT)
Balancing Access and Control: Finding the right balance between providing access to the internal state
and maintaining control. Too much openness (public) may lead to unintended consequences, while too
much privacy (private) can restrict necessary access.
Testing and Private Methods: Testing private methods can be challenging as they are not directly
accessible from outside the class. Unit testing may need to focus on the public interface, leaving some
encapsulated code untested.
Performance Overhead: The use of getter and setter methods, common in encapsulation, may
introduce a slight performance overhead. While modern tools mitigate this impact, it's a consideration
in performance-critical applications.
ABSTRACTION (IMPORTANT)
Abstraction is the process of hiding the internal details of an application from the outer world.
Abstraction is used to describe things in simple terms. It’s used to create a boundary between the
application and the client programs.
Objects are the building blocks of Object-Oriented Programming. An object contains some properties
and methods. We can hide them from the outer world through access modifiers. We can provide access
only for required functions and properties to the other programs. This is the general procedure to
implement abstraction in OOP.
1.Data Abstraction - When the object data is not visible to the outer world, it creates data
abstraction. If needed, access to the Objects’ data is provided through some methods.
2.Process Abstraction - We don’t need to provide details about all the functions of an object.
When we hide the internal implementation of the different functions involved in a user operation, it
creates process abstraction.
POLYMORPHISM (IMPORTANT)
Polymorphism is a popular concept in object-oriented programming (OOP), referring to the idea that an
entity in code such as a variable, function or object can have more than one form. The word
polymorphism is derived from Greek and means "having multiple forms." Apart from computer
programming, the idea of polymorphism occurs in other real-world areas, including biology, chemistry
and drug development.
Polymorphism is one of the most important concepts in OOP. It describes the ability of something to
have or to be displayed in more than one form. The different forms arise because these entities can be
assigned different meanings and used in various ways in multiple contexts.
Compile Time Polymorphism - Also known as static polymorphism, compile time polymorphism is
common in OOP languages like Java. It uses method overloading to create multiple methods that have
the same name in the same class, but a different number of parameters. They may also have parameters
for different data types.
Runtime Polymorphism - Also known as dynamic polymorphism, runtime polymorphism uses method
overriding to let a child class have its own definition of a method belonging to the parent class. This type
of polymorphism is often associated with upcasting, which happens when a parent class points to an
instance of the child’s class.