Object-Oriented Software Engineering - Assignment 1
Q1. Explanation of Terms with Examples/Diagrams
1. Class and Object:
- Class: A blueprint for objects.
- Object: An instance of a class.
Example:
class Car {
String color;
void start() {
System.out.println("Car started");
public class Main {
public static void main(String[] args) {
Car myCar = new Car();
myCar.color = "Red";
myCar.start();
2. Metadata:
Metadata is data about data, providing information about structure and constraints.
Example: XML or JSON schema.
Object-Oriented Software Engineering - Assignment 1
3. Reusability:
The ability to use existing code in new contexts.
Example: Using inheritance to extend class functionality.
4. Abstract Class and Encapsulation:
- Abstract Class: Cannot be instantiated; provides a base for subclasses.
- Encapsulation: Bundles data and methods, restricting direct access.
Example:
abstract class Shape {
abstract void draw();
class Circle extends Shape {
void draw() {
System.out.println("Drawing Circle");
5. UML Concepts:
UML (Unified Modeling Language) visually represents a system?s structure.
Example: Class diagrams, use-case diagrams.
6. Persistence:
Storing data for long-term access.
Example: Databases like MySQL.
Object-Oriented Software Engineering - Assignment 1
Class Diagram Example
Q2. Differences
a. Generalization vs. Specialization:
- Generalization: Combining subclasses into a general superclass.
- Specialization: Creating subclasses from a superclass.
b. Aggregation vs. Composition:
- Aggregation: A "has-a" relationship; objects exist independently.
- Composition: A "part-of" relationship; objects depend on each other.
c. Link vs. Association:
- Link: Physical connection between objects.
- Association: Logical connection showing relationships.
Q3. Short Notes
Object-Oriented Software Engineering - Assignment 1
a. Method Overloading:
Defining methods with the same name but different parameters.
Example:
void add(int a, int b) {}
void add(double a, double b) {}
b. Polymorphism:
The ability of an object to take many forms.
c. Method Overriding:
Redefining a parent class method in a child class.
d. Interfaces:
A collection of abstract methods implemented by classes.
Example:
interface Animal {
void sound();
class Dog implements Animal {
public void sound() {
System.out.println("Woof");
}
Object-Oriented Software Engineering - Assignment 1
e. Inheritance and Types:
Mechanism for a class to acquire properties of another class.
Types: Single, multiple, multilevel, hierarchical, hybrid.
Q4. 4+1 Architecture and SDLC
a. 4+1 Architecture:
Organizes a system into 5 views: Logical, Process, Physical, Development, and Use Case.
b. SDLC Phases:
Waterfall: Requirement -> Design -> Implementation -> Testing -> Deployment.
Prototype: Building a working prototype for feedback.
Q5. Diagrams
a. Object Diagram:
Represents objects and their relationships.
b. Class Diagram:
Shows class structures, attributes, and methods.
c. ER Diagram:
Entity-Relationship diagram for database modeling.
Object-Oriented Software Engineering - Assignment 1
d. EER Diagram:
Enhanced ER diagram with specialization and generalization.
e. DFD Diagram:
Data Flow Diagram for process modeling.