0% found this document useful (0 votes)
10 views4 pages

Modal

The document is a guide on software specification and design, outlining key concepts such as definitions, objectives, quality design principles, and contract-based specifications. It emphasizes the importance of modularity, cohesion, and the SOLID principles for maintainability, while providing exercises and code examples for practical understanding. The conclusion highlights that specifications define the 'what' and design defines the 'how', aiming to reduce project risks through clear contracts.

Uploaded by

toni popi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Modal

The document is a guide on software specification and design, outlining key concepts such as definitions, objectives, quality design principles, and contract-based specifications. It emphasizes the importance of modularity, cohesion, and the SOLID principles for maintainability, while providing exercises and code examples for practical understanding. The conclusion highlights that specifications define the 'what' and design defines the 'how', aiming to reduce project risks through clear contracts.

Uploaded by

toni popi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Sophisticated Software Specification

and Design Guide


Integrating Key Concepts from Provided Materials

Compiled from Course Notes (2023)


Contents

1 Introduction to Software Specifications and Design 2


1.1 Definitions & Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Key Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Principles of Quality Design 2


2.1 Core Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Example: Library Management System . . . . . . . . . . . . . . . . . . . . . . . . 2

3 Contract-Based Specifications 2
3.1 Key Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 Code Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

4 Exercises & Solutions 3


4.1 Exercise 1: SquareRoot(x) Specification . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 Exercise 2: Chat Application Module Design . . . . . . . . . . . . . . . . . . . . . 3

Conclusion 3

A UML Diagram Example 3

B Glossary 3

1
Introduction to Software Specifications and Design
Definitions & Objectives
• Specification: Defines what the system should do (external behavior, functionalities).

• Conception: Describes how to implement it (internal structure, architecture).

• Implementation: Actual coding and technical realization.

Key Roles
• Specifications act as contractual agreements between clients and developers.

• Example: E-commerce System Specification:

– What: Users can browse products, add to cart, and pay via credit card.
– Not Included : Database schema or API endpoints (design elements).

Principles of Quality Design


Core Criteria
1. Modularity: Divide systems into coherent modules (e.g., Payment, Inventory).

2. Cohesion & Coupling:

• Strong Cohesion: Module elements focus on a single responsibility.


• Weak Coupling: Minimal inter-module dependencies.

3. SOLID Principles:

• Single Responsibility: One reason to change per module.


• Open/Closed: Extendable without modifying existing code.

Example: Library Management System


• Modules:

– Borrow Management: Handles checkouts/returns.


– Database Module: Stores book/user data.
– Notification Module: Sends alerts (depends only on dates).

Contract-Based Specifications
Key Components
• Precondition: Requirements before execution (e.g., n ≥ 0 for F actorial(n)).

• Postcondition: Guaranteed outcome (e.g., F actorial(n) = n!).

2
Code Examples

Listing 1: Factorial Function


# Precondition : n >= 0
# Postcondition : Returns n !
def factorial ( n ) :
if n < 0:
raise ValueError ( " n ␣ must ␣ be ␣ non - negative . " )
return 1 if n == 0 else n * factorial (n -1)

Exercises & Solutions


Exercise 1: SquareRoot(x) Specification
• Precondition: x ≥ 0

• Postcondition: Returns x with precision 0.001

• Error Handling: Raise exception if x < 0

Exercise 2: Chat Application Module Design


• Cohesion: Message Encryption (handles encryption/decryption only).

• Coupling: Depends only on the Network Module.

Conclusion
• Specifications define what, design defines how.

• SOLID principles and modularity ensure maintainability.

• Clear contracts reduce project risks.

UML Diagram Example


Class diagram for the library management system.

Glossary
Invariant Condition that remains true during execution.

Overload Multiple functions with the same name but different parameters.

You might also like