Skip to content
Unit 4 Syllabus Note· Software Engineering

Software Engineering

Comprehensive exam revision notes for BCA-423E Unit 4 (Software Design Principles, Architecture & Strategies). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.

Software Engineering

Software Design Principles, Architecture & Strategies

Core Definitions & Key Concepts

What is the golden rule of modular design regarding Cohesion and Coupling

Software modules should possess High Cohesion (strong internal functional relatedness) and Low (Loose) Coupling (minimal interdependence between modules).

Who formulated the principle of Information Hiding

David L. Parnas in 1972: Modules should encapsulate implementation secrets and data structures behind stable abstract interfaces.

Name the seven levels of Cohesion from lowest (worst) to highest (best)

  1. Coincidental (worst)
  2. Logical
  3. Temporal
  4. Procedural
  5. Communicational
  6. Sequential
  7. Functional (best)

Name the seven levels of Coupling from tightest (worst) to loosest (best)

  1. Content Coupling (worst)
  2. Common Coupling
  3. External Coupling
  4. Control Coupling
  5. Stamp Coupling
  6. Data Coupling (best)
  7. Uncoupled

What is McCabe's Cyclomatic Complexity formula

$V(G) = E - N + 2P For a single connected component (P=1), V(G) = E - N + 2 = Pr + 1$ (where $Pr$ is the count of predicate/decision nodes).

What does Cyclomatic Complexity represent for a test engineer

It represents the exact number of linearly independent execution paths through the program, establishing the upper bound on test cases needed for basis path coverage.

Transform Analysis and Transaction Analysis in structured design

  • Transform Analysis: Used when DFD shows linear input, central transform, and output streams.
  • Transaction Analysis: Used when DFD branches from a transaction dispatcher to parallel specialized action handlers.

The Model-View-Controller (MVC) architectural pattern

  • Model: Manages application state and business logic.
  • View: Renders user interface.
  • Controller: Accepts user inputs and updates Model/View.

Conceptual & Architectural Analysis

The 7 Levels of Cohesion with Real-World Programming Examples

Cohesion LevelQualityDescriptionConcrete Code Example
1. FunctionalHighest (Best)Module executes single well-defined taskcalculate_square_root(x)
2. SequentialHighOutput of one step is direct input to nextparse_file() -> clean_tokens() -> write_output()
3. CommunicationalModerateFunctions operate on same shared dataupdate_student_record() & print_student_record()
4. ProceduralModerateTasks executed in specific procedural ordercheck_auth() -> log_attempt() -> read_profile()
5. TemporalWeakGrouped because executed at same timeinitialize_system() (opens DB, sets fonts, resets timers)
6. LogicalPoorGrouped by category; uses flag to selectprocess_all(flag) (if 1 prints, if 2 saves, if 3 emails)
7. CoincidentalLowest (Worst)Random arbitrary collection of tasksmisc_utilities() (validates credit card, draws circle)

The 7 Levels of Coupling with Real-World Programming Examples

Coupling LevelQualityDescriptionHazard
1. Data CouplingLoosest (Best)Pass atomic primitive parameters (int, str)Clean, isolated, reusable interfaces
2. Stamp CouplingModeratePass entire record/struct when only 1 field neededModule depends on full record layout
3. Control CouplingPoorPass flag directing internal execution branchCaller must know callee internal control logic
4. External CouplingPoorModules depend on external OS/hardware formatHardware changes break multiple modules
5. Common CouplingVery PoorMultiple modules share global variablesSilent corruption across distant files
6. Content CouplingTightest (Worst)Module directly modifies private data of anotherCatastrophic maintenance breakdown

Structure Chart Notations and Symbols

Structure Chart Elements

  1. Module Box: Rectangle containing module name.
  2. Invocation Line: Directed line from parent module pointing to child module.
  3. Data Couple: Arrow with Open Circle (-\circ\to) denoting data passed.
  4. Control Couple (Flag): Arrow with Filled Solid Dot (-\bullet\to) denoting status flag.
  5. Conditional Branch: Diamond symbol at root of invocation arrows.
  6. Repetitive Loop: Curved semicircular arrow across invocation arrows.

Object-Oriented Design Metrics (CK Metric Suite: WMC, DIT, NOC, CBO, RFC, LCOM)

Chidamber and Kemerer (CK) Metrics

  • WMC (Weighted Methods per Class): Sum of complexities of all methods in class. High WMC \implies high maintenance effort.
  • DIT (Depth of Inheritance Tree): Max path from root to class. Deep DIT \implies high reuse but complex debugging.
  • NOC (Number of Children): Count of direct immediate subclasses.
  • CBO (Coupling Between Objects): Count of other classes to which class is coupled. High CBO \implies low reusability.
  • RFC (Response for a Class): Methods in class + methods invoked by them.
  • LCOM (Lack of Cohesion in Methods): Number of method pairs with zero shared instance variables.

In-Depth Analysis & Implementation

Calculate Cyclomatic Complexity and Derive the Basis Path Test Suite for a Program Code Segment

McCabe's Cyclomatic Complexity Problem Solution

C
1// Function to classify student grades
2void classify_grade(int marks) {
3 if (marks >= 40) { // Node 1 (Predicate)
4 if (marks >= 75) { // Node 2 (Predicate)
5 printf("Distinction"); // Node 3
6 } else {
7 printf("Pass"); // Node 4
8 }
9 } else {
10 printf("Fail"); // Node 5
11 }
12} // Node 6 (Exit)

1. Construct Control Flow Graph (CFG):

  • Nodes: N = 6 (1, 2, 3, 4, 5, 6)
  • Edges: E = 7 ((1,2), (1,5), (2,3), (2,4), (3,6), (4,6), (5,6))
  • Predicate Nodes: P = 2 (Node 1, Node 2)

2. Cyclomatic Complexity Formulations:

  • Formula 1: V(G) = E - N + 2 = 7 - 6 + 2 = \mathbf{3}
  • Formula 2: V(G) = P + 1 = 2 + 1 = \mathbf{3}
  • Formula 3: Number of enclosed regions + 1 = 2 + 1 = \mathbf{3}

3. Linearly Independent Basis Paths:

  • Path 1: 1 \to 5 \to 6 (Input marks = 30 \implies 'Fail')
  • Path 2: 1 \to 2 \to 4 \to 6 (Input marks = 60 \implies 'Pass')
  • Path 3: 1 \to 2 \to 3 \to 6 (Input marks = 85 \implies 'Distinction')

A test suite executing these 3 paths achieves 100% statement and branch coverage.

Architectural Styles: Layered, Client-Server, Pipe-and-Filter, and Model-View-Controller (MVC) with Diagrams

1. Pipe-and-Filter Architecture

System Architecture / Concept DiagramHorizontal Scroll Enabled
[Raw Stream] ---> | Filter 1 | === Pipe ===> | Filter 2 | === Pipe ===> | Output |
                  (Lexer)                    (Parser)                    (Code Generator)
  • Decoupled filters process incoming data streams independently (e.g., Unix CLI pipelines).

2. Layered (N-Tier) Architecture

System Architecture / Concept DiagramHorizontal Scroll Enabled
+-------------------------------------------------------+
| Presentation Layer (React / Web UI)                   |
+-------------------------------------------------------+
                           |
                           v
+-------------------------------------------------------+
| Business Logic Layer (Spring Boot / Python Backend)   |
+-------------------------------------------------------+
                           |
                           v
+-------------------------------------------------------+
| Data Access Layer (Hibernate / SQL ORM)               |
+-------------------------------------------------------+
                           |
                           v
+-------------------------------------------------------+
| Database Layer (PostgreSQL / Oracle)                  |
+-------------------------------------------------------+
  • Each layer interacts strictly with adjacent layers, isolating architectural modifications.

SOLID Object-Oriented Design Principles with Code Demonstrations

The SOLID Principles

  1. S - Single Responsibility Principle (SRP): A class should have one reason to change.
  2. O - Open/Closed Principle (OCP): Open for extension, closed for modification.
  3. L - Liskov Substitution Principle (LSP): Derived types must be substitutable for base types.
  4. I - Interface Segregation Principle (ISP): Clients should not depend on interfaces they do not use.
  5. D - Dependency Inversion Principle (DIP): Depend on abstractions, not concretions.
Python
1# Demonstrating OCP and DIP
2from abc import ABC, abstractmethod
3
4class PaymentProcessor(ABC):
5 @abstractmethod
6 def pay(self, amount):
7 pass
8
9class UpiPayment(PaymentProcessor):
10 def pay(self, amount):
11 print(f"Paid Rs. {amount} via UPI QR.")
12
13class CreditCardPayment(PaymentProcessor):
14 def pay(self, amount):
15 print(f"Paid Rs. {amount} via Credit Card.")
16
17# High-level module depends on abstraction (DIP)
18class CheckoutService:
19 def __init__(self, processor: PaymentProcessor):
20 self.processor = processor
21 def checkout(self, amount):
22 self.processor.pay(amount)

Important Exam Points & Quick Revision

Master the 7 levels of cohesion and coupling, McCabe's Cyclomatic Complexity calculation, and SOLID principles.

Your reading progress
0%

100% left on this page — finishing it closes the gap for Software Design Principles, Architecture & Strategies.

Weak topic hint

Software Design Principles, Architecture & Strategies still counts as a weak topic until you finish this note and answer its questions.

Practise this unit
What Should You Do Next?

Test Your Understanding

Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.