CSCI 370 Lecture 12 Review Sheet: Design Principles, Software Process Models, and the Singleton & Factory Patterns


โœ… Key Topics Covered


๐Ÿ” Functional vs. Non-Functional Requirements

Functional Requirements describe what the system should do, i.e., the features and functionalities requested by the user or client.

Non-Functional Requirements describe how the system performs a function, covering broader system attributes like performance, usability, reliability, etc. They often span multiple functional requirements.

Example: A system must process user logins (functional) and must do so within 2 seconds (non-functional).


๐ŸŒฉ๏ธ Cloud Software Benefits

Correct answer to the multiple-choice example: All of the above


๐Ÿง  Design Principles

Composition Over Inheritance

Example: A MedicalRecord class contains a Database object => Composition (โ€œhas-aโ€)

Open/Closed Principle


๐Ÿงช Incremental Development and Agile Models

Incremental development includes:

Models not using incremental development:


โœˆ๏ธ When to Use the Waterfall Model

Used when changes are expensive or difficult after development begins. Examples:

Reasons:

Not suitable for:


๐Ÿงฌ UML and Object-Oriented Relationships

Types of Relationships:

Examples:


โš™๏ธ Singleton Pattern (Java Implementation)

Problem Being Solved

Solution: Singleton Pattern

Purpose

Two Forms of Singleton

1. Eager Initialization

private static NextId instance = new NextId();

2. Lazy Initialization

private static DatabaseConnection connection = null;

public static DatabaseConnection getConnection() {
    if (connection == null) {
        connection = new DatabaseConnection();
    }
    return connection;
}

Common Issue: Thread Safety


๐Ÿญ Factory Pattern (Java Implementation)

Purpose

Benefits

Example from Class

public Bicycle getNewBicycle(int age) {
    if(age < 6)
        return new KidsTriCycle();
    if(age < 19)
        return new TenSpeedBicycle();
    return new MotorCycle();
}

Java Usage

Bicycle bicycle = new BicycleFactory().getNewBicycle(6);
bicycle.ride();

๐Ÿ‘๏ธ Observer Pattern

Purpose

Benefit

Example

interface Observer {
    void notify();
}

๐Ÿงฉ Strategy Pattern

Purpose

Principle

Example

Duck d = new Duck(new RealFly(), new LoudQuack());

๐Ÿงญ Software Project Lifecycle Phases (Correct Order)

  1. Feasibility Study โ€“ Can it be built within budget/tech constraints?
  2. Requirements โ€“ Define what the system should do
  3. Design โ€“ Architecting system components
  4. Development โ€“ Actual coding
  5. Testing โ€“ Verify correctness and reliability
  6. (Optional) Deployment, Maintenance

๐Ÿ” Reusability and Maintainability


๐Ÿ‘จโ€๐Ÿ’ป Software Engineering Essentials


๐Ÿ“‹ Summary of Design Patterns Covered

Pattern Purpose Benefit
Singleton One instance only; global control Prevents uncontrolled access to shared resource
Factory Encapsulate object creation Easy, centralized, controlled instantiation
Observer Notify multiple dependent objects on state change Loose coupling, unified notification interface
Strategy Behavior injection using composition Flexible, avoids inheritance problems

๐Ÿ’ฌ Interview Tips


๐Ÿ”š Summary

This lecture focused on core design principles and the practical implications of software development models. Key design patterns like Singleton, Factory, Observer, and Strategy help implement robust, modular, and maintainable systems. Singleton prevents issues with shared state, Factory simplifies object creation, Observer supports publish-subscribe architecture, and Strategy encourages behavior flexibility. Understanding when and how to apply these patterns is essential for real-world software engineering.