19 / 19

Chapter 15: Software Reuse

نموذج إِمام التعليمي: إنطلاقة راسخة على خطى الأولين
وَتَعَاوَنُوا عَلَى الْبِرِّ وَالتَّقْوَىٰ

"And cooperate in righteousness and piety" - Qur'an 5:2

(Transliteration: Wata'āwanū 'alā l-birri wa-l-taqwā)

Foundation: التعاون (Cooperation) and عدم الإسراف (Avoiding Waste)

⚡ Your Mission: Master reuse to accelerate Saudi's digital transformation by 70%
افهم
Understand

Why reuse?
Benefits & challenges
Section: Landscape

مارس
Practice

Frameworks
MVC patterns
Section: Frameworks

اتقن
Master

Product lines
ERP systems
Section: Enterprise

ميز
Excel

Integration
Vision 2030
Section: Innovation

🚀 Framework Evolution: Software Reuse Engineering

افهم

Two Lenses for Mastering Software Reuse

🏭 Industrial Revolution 6.0 (IR 6.0)

Human-Centric Reuse (2020s)

  • Section 15.1 - Reuse Landscape: Prioritizes rapid development (e.g., Tawakkalna's 3-month launch) through strategic component selection.
  • Section 15.2 - Frameworks: Enables MVC patterns (e.g., Absher's modular architecture) for scalable government services.
  • Section 15.3 - Product Lines: Creates configurable systems (e.g., Sehhaty variants) serving diverse healthcare needs.
  • Section 15.4 - ERP Systems: Adapts global solutions (e.g., SAP in Aramco) to local contexts efficiently.
Market Impact: IR 6.0 reduces development time by 60% and costs by 40% through systematic reuse.

📖 Islamization of Knowledge

إسلامية المعرفة (Proactive)

  • Section 15.1 - Reuse Landscape: Derives efficiency from Islamic prohibition of waste (Israf), promoting shared knowledge.
  • Section 15.2 - Frameworks: Models collaborative development from Shura principles, ensuring collective benefit.
  • Section 15.3 - Product Lines: Inspires modularity from Islamic inheritance laws (precise sharing).
  • Section 15.4 - ERP Systems: Aligns enterprise systems with Amanah (trust) and transparency.
Principle: Reuse = Sadaqah Jariyah (continuing charity) through shared code.
University Tool: Theoretical Foundation
Market Test: ROI and Time-to-Market

🎯 Your Learning Approach (Mapped to Objectives)

  • ✅ Analyze reuse landscape and trade-offs (Objective 1, Section 15.1).
  • ✅ Master framework architectures and MVC (Objective 2, Section 15.2).
  • ✅ Design product lines for domains (Objective 3, Section 15.3).
  • ✅ Integrate enterprise systems effectively (Objective 4, Section 15.4).
🤔 Quick Quiz: Which Reuse Approach for Tawakkalna? (2 mins)
⏱️ Timer: 2:00
A. Build everything from scratch
B. Framework + existing components
C. Copy another app's code
D. Buy complete solution

🌍 Mission Context: The Reuse Revolution

افهم
University Tool: Systems Thinking
Market Test: Delivery Speed & Quality
Reality Check: 70% of your future code should be reused components

🎯 Start With Your Experience (3 mins)

⏱️ Timer: 3:00

(Adapt for online/in-person; use breakout rooms for discussion)

Quick Activity: List software you use daily:

  • WhatsApp (uses React Native framework)
  • Instagram (uses Django framework)
  • Your banking app (likely uses Spring Boot)
  • University LMS (uses Moodle/Canvas frameworks)

Discover: NONE built from scratch! All use extensive reuse!

Notice: Same login components, similar UI patterns. Why?!

💥 The Spotify Phenomenon

  • • 500+ million users worldwide
  • • Built on open-source components (95%)
  • • Custom code only 5% of system
  • • Development time: 6 months vs 5 years
🤔 Quick Poll: What percentage of Absher is reused?
A. 10-20%
B. 30-40%
C. 60-70%
D. 90%+

📚 What IS Software Reuse?

افهم
University Tool: Systematic Analysis
Market Test: Cost-Benefit Evaluation

🔍 Discover It Yourself (4 mins)

⏱️ Timer: 4:00

(Adapt for online/in-person)

With your neighbor, evaluate these scenarios:

Scenario Reuse Level Why?
Copy-paste code ? Your answer...
Import library ? Your answer...
Use framework ? Your answer...
Configure ERP ? Your answer...

Copy-paste: Low - Error-prone, no updates
Import library: Medium - Function reuse
Use framework: High - Architecture reuse
Configure ERP: Very High - Complete system reuse

Sommerville Definition: "Using existing software artifacts to create new systems, ranging from functions to complete applications"
Market Reality: Companies with <50% reuse have 3x higher development costs and 5x more bugs.

🚀 Why Reuse? The Business Case

افهم
University Tool: Cost-Benefit Analysis
Market Test: ROI Calculation

🎮 Live Simulation: The Saudi Startup Challenge (5 mins)

⏱️ Timer: 5:00

(Adapt for online/in-person; use spreadsheet simulation)

Scenario: Building e-commerce for Saudi market

  • Budget: 1M SAR
  • Timeline: 6 months
  • Team: 5 developers

Options (Calculate with neighbor):

A) Build from scratch (18 months, 3M SAR)
B) Use Shopify framework (3 months, 500K SAR)
C) Copy competitor code (legal issues!)
D) Wait for perfect solution

Why Option B? Framework reuse provides 6x faster delivery, 60% cost reduction, proven reliability.

Market Reality: Noon used existing e-commerce frameworks, launched in 12 months vs Amazon's original 5 years.

6 Critical Benefits (Figure 15.1)

Benefit Description Saudi Example Metric
🚀 Speed Faster time to market Tawakkalna: 3 months 70% faster
💰 Cost Lower development cost Absher saved 40M SAR 40% cheaper
✅ Quality Proven components Nafath: 99.9% uptime 5x fewer bugs
📉 Risk Known costs/timeline Government projects 90% on-time
👥 Efficiency Expert components NCA security 3x productivity
🎨 Standards Compliance built-in SAMA banking 100% compliant

⚠️ The Dark Side of Reuse

افهم
University Tool: Risk Assessment
Market Test: Mitigation Strategies

6 Major Problems (Figure 15.2)

1. Maintenance Cost

Creating/maintaining library

Solution: Dedicated team

2. Not-Invented-Here

Developer resistance

Solution: Incentivize reuse

3. Finding Components

Discovery overhead

Solution: Component catalog

4. Understanding

Learning curve

Solution: Documentation

5. Adaptation

Customization effort

Solution: Flexible design

6. Tool Support

Limited tooling

Solution: Invest in tools

Real Story: Saudi Bank Integration Failure

2019: Major bank tried integrating 3 different systems

  • Problem: Incompatible data models
  • Cost overrun: 500% (10M → 50M SAR)
  • Delay: 2 years
  • Lesson: Plan integration architecture first!
Market Reality: 30% of reuse projects fail due to poor planning, not technical issues.

🗺️ The Reuse Landscape: 16 Approaches

مارس
University Tool: Classification Systems
Market Test: Approach Selection

🎭 Role Play: Choose Your Reuse Strategy (4 mins)

⏱️ Timer: 4:00

(Adapt for online/in-person; use decision tree)

Your scenarios (pick one):

  • A) Ministry needs document management
  • B) Startup needs mobile app
  • C) Hospital needs patient system
  • D) University needs LMS

Navigate the decision tree to find best approach!

Figure 15.3 & 15.4: Reuse Approaches

🏗️ Architectural Patterns

  • Application frameworks
  • Design patterns
  • Model-driven engineering
  • Legacy system wrapping
Best for: New systems with standard needs

📦 Component-Based

  • COTS integration
  • Configurable products
  • Program libraries
  • Service-oriented systems
Best for: Rapid assembly of proven parts
Industry Tool: Use dependency managers (npm, Maven, pip) for component management.

🎨 Application Frameworks Deep Dive

مارس
University Tool: Architecture Patterns
Market Test: Framework Selection

🔧 Live Challenge: Build Absher Module (5 mins)

⏱️ Timer: 5:00

(Adapt for online/in-person; use CodeSandbox)

Task: Design MVC for passport renewal service

# Model Layer
class Citizen:
  id: NationalID
  passport: PassportData
  # Your code: Add validation

# View Layer
class PassportRenewalView:
  # Your code: Design form

# Controller Layer
class RenewalController:
  # Your code: Handle workflow
class Citizen:
  def validate_eligibility(self):
    return self.passport.expires_in_days() < 180

class PassportRenewalView:
  def render_form(self, citizen):
    return f"Renew passport for {citizen.id}"

class RenewalController:
  def process_renewal(self, citizen_id):
    citizen = Citizen.find(citizen_id)
    if citizen.validate_eligibility():
      return self.view.render_form(citizen)

Figure 15.5: MVC Pattern

💾
Model
Business Logic
👁️
View
Presentation
🎮
Controller
User Input
Market Reality: 90% of web applications use MVC or similar patterns (MVP, MVVM).

🌐 Modern Web Frameworks (WAFs)

مارس
University Tool: Framework Comparison
Market Test: Production Deployment

5 Essential WAF Features

🔐
Security
Auth, encryption
📄
Dynamic Pages
Templates
💾
Database
ORM
🔄
Sessions
State mgmt
AJAX
Reactive UI

Saudi Framework Usage

System Framework Why Chosen Users
Absher Spring Boot Enterprise Java 25M+
Tawakkalna React Native Cross-platform 20M+
Sehhaty Django Rapid development 15M+
Maroof Laravel PHP ecosystem 5M+
Industry Tool: Use Next.js for modern React applications with SSR/SSG capabilities.

🏭 Software Product Lines

اتقن
University Tool: Domain Engineering
Market Test: Product Variants
Product Line: Set of software-intensive systems sharing a common, managed set of features that satisfy specific needs of a particular market segment

Figure 15.7: Product Line Architecture

Core Assets
Shared by all
+
Variable Features
Configured
=
Product Instance
Customer-specific

🏗️ Design Activity: Sehhaty Product Line (6 mins)

⏱️ Timer: 6:00

(Work in pairs)

Design variants for:

  • Hospital version (full features)
  • Clinic version (basic features)
  • Pharmacy version (prescription only)
  • Home care version (mobile-first)

Identify: Core features vs Variable features

Market Reality: Sehhaty saves 200M SAR annually through product line approach vs custom development.

💼 Enterprise Resource Planning (ERP)

اتقن
University Tool: Systems Integration
Market Test: ERP Implementation

Figure 15.13: ERP Architecture

📦 Supply Chain

Inventory
Procurement
Logistics

💰 Finance

Accounting
Budgeting
Reporting

👥 HR

Payroll
Recruitment
Training

🏭 Operations

Production
Quality
Maintenance

Case Study: Aramco SAP Implementation

  • Scale: 70,000+ users globally
  • Investment: 500M SAR
  • Timeline: 3 years
  • Result: 20% efficiency gain
  • Lesson: Change processes to fit ERP, not vice versa
🤔 Why do 60% of ERP implementations fail?
A. Technical problems
B. Resistance to process change
C. High cost
D. Poor software quality

🔗 System Integration Challenges

اتقن
University Tool: Integration Patterns
Market Test: API Management

Figure 15.14: Integration Architecture

// Integration Challenge: Connect 3 systems
System A: Legacy Oracle DB (Arabic)
System B: Modern REST API (English)
System C: SAP ERP (German config)

// Your Solution:
class IntegrationAdapter {
  translateData(source, target) {
    // Map fields
    // Convert formats
    // Handle errors
  }
}

4 Integration Problems (Boehm & Abts)

No Control

Can't modify vendor code

Solution: Wrapper patterns

Interoperability

Different data models

Solution: Common schema

Evolution

Version incompatibility

Solution: Version management

Support

Vendor dependency

Solution: Exit strategy

Market Reality: Poor integration costs Saudi enterprises 2B SAR annually in inefficiencies.

🚀 Saudi's Software Reuse Leadership

ميز
Vision 2030: Transform from technology consumer to global provider of reusable solutions

🏛️ Government Platforms

300+
Services unified
  • Absher framework
  • Tawakkalna modules
  • Unified authentication

🏙️ NEOM Components

100%
Modular city
  • Smart city modules
  • Open-source contributions
  • Global reuse

🏢 Enterprise Success

60%
Cost reduction
  • Aramco SAP
  • STC frameworks
  • Banking systems

🕋 Hajj Systems

3M+
Pilgrims managed
  • Reusable crowd mgmt
  • Exported globally
  • Olympic adoption

Innovation Showcase: Saudi Open Source

  • Tawakkalna SDK: 500+ apps using it
  • Absher Components: Government standard
  • Nafath Auth: Regional adoption
  • Your contribution: Next global framework?

💼 Your Software Reuse Career Path

ميز

12-Month Roadmap to Reuse Excellence

Months 1-3
Master frameworks
React, Spring, Django
Months 4-6
Component libraries
npm, Maven, GitHub
Months 7-9
Product lines
Domain engineering
Months 10-12
Enterprise systems
ERP, integration

Saudi Career Opportunities

Company Role Salary (SAR) Reuse Focus
NEOM Framework Architect 400,000+ Smart city modules
Aramco SAP Developer 350,000 ERP customization
STC Component Engineer 300,000 Telecom frameworks
Elm Integration Specialist 280,000 Government systems

🎓 Bridging University to Market

ميز

الجامعة تعلمك (University Teaches)

  • نظريات إعادة الاستخدام (Reuse theories)
  • أنماط التصميم (Design patterns)
  • هندسة البرمجيات (Software engineering)
  • التحليل والتصميم (Analysis & design)
  • أفضل الممارسات (Best practices)
  • المعايير الدولية (Standards)
  • البحث العلمي (Research)

السوق يعلمك (Market Teaches)

  • الوقت = مال (Time = money)
  • إعادة الاستخدام = البقاء (Reuse = survival)
  • السرعة تغلب الكمال (Speed > perfection)
  • العميل لا يهتم بالكود (Customer doesn't care)
  • الصيانة تكلف أكثر (Maintenance costs more)
  • الفشل = خسارة مالية (Failure = financial loss)
  • المكتبات القديمة تعمل (Old libraries work)

University: Teaches you WHY and HOW to reuse properly

Market: Shows you WHEN reuse saves money and time

Balance: Use university knowledge to make smart market decisions

📝 Assignment: Design Reusable Saudi Solution

ميز
Create a reusable solution that could serve 10+ Saudi organizations

Choose ONE Reuse Project:

  1. 🏛️ Government service framework (like Absher 2.0)
  2. 🏥 Healthcare product line (hospital variants)
  3. 🎓 Educational platform components
  4. 🏪 E-commerce framework (Saudi market)
  5. 🏦 Banking integration middleware

Deliverables (EMAM Framework)

Phase Weight Requirements Rubric
افهم 20% Reuse analysis, cost-benefit Clear ROI calculation – 10/20; Risk analysis – 10/20
مارس 30% Framework selection, MVC design Working prototype – 15/30; Documentation – 15/30
اتقن 30% Product line architecture 3+ variants – 15/30; Configuration strategy – 15/30
ميز 20% Integration plan, Vision 2030 Export potential – 10/20; Innovation – 10/20

Submission Requirements

  • Due: Next week
  • Format: Report + GitHub repo
  • Must include: 60%+ reuse metrics
  • Bonus: Open-source contribution, AI integration

AI Guidance for Bonus

Use GitHub Copilot or ChatGPT for code generation, but document reuse percentage:

# Metrics Dashboard
Total LOC: 10,000
Reused components: 7,000 (70%)
Custom code: 2,500 (25%)
AI-generated: 500 (5%)
ROI: 400% (3-month vs 12-month)

🎯 Key Takeaways - Chapter 15 Mastery

Summary: "Software reuse ranges from functions to complete systems, offering faster delivery, lower costs, and higher quality through proven components"
🧠 Landscape

• 16 approaches
• Benefits vs problems
• Decision factors

🎨 Frameworks

• MVC pattern
• IoC principle
• WAF features

🏭 Product Lines

• Core + variable
• Configuration
• Domain focus

💼 Enterprise

• ERP systems
• Integration
• COTS products

Success Formula

Strategic Reuse + Islamic Efficiency + Saudi Innovation + Global Standards = Your Impact

Self-Reflection Prompts

  • What percentage of your code is currently reused?
  • Which framework will you master first?
  • How can you contribute to Saudi's reuse ecosystem?

🤝 Your Software Reuse Commitment

إِنَّ اللَّهَ يُحِبُّ إِذَا عَمِلَ أَحَدُكُمْ عَمَلًا أَنْ يُتْقِنَهُ

"Allah loves when one of you does work, that they perfect it" - Hadith

(Transliteration: Inna Allāha yuḥibbu idhā 'amila aḥadukum 'amalan an yutqinahu)

Every component you reuse saves time for innovation. Every framework you master enables faster delivery.
افهم

Foundation

Know the landscape

Evaluate trade-offs

مارس

Application

Use frameworks

Build components

Share libraries

اتقن

Excellence

Design product lines

Integrate systems

ميز

Innovation

Create frameworks

Export solutions

Lead industry

Your Pledge:

  • I will reuse before recreating
  • I will document for others to reuse
  • I will contribute to open source
  • I will build Saudi's digital future efficiently

🙏 شكرًا - Your Journey in Reuse Begins

وَقُل رَّبِّ زِدْنِي عِلْمًا

"My Lord, increase me in knowledge" - Qur'an 20:114

Reuse knowledge compounds - share it to multiply impact!

You now understand how to build faster, cheaper, and better through reuse
From copy-paste to enterprise systems - you're ready!
📧 Contact

Office Hours: By Email

Email: arnoor@kau.edu.sa

📅 Next Class

Chapter 16

Component-based

Monday, 2:30 PM

📝 Due Soon

Reuse project

Next week

Start TODAY!

🎯 Resources

Framework docs

GitHub examples

Office support

بروف: أديب بن رضا نور

See you next class, إن شاء الله
Remember: Your reused code = Continuous charity!