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

SCD Assignment 1

The document outlines the implementation of design principles in a software project, specifically focusing on SOLID, DRY, and KISS principles. It provides examples of code segments that adhere to these principles, such as the ConcurrentPayment, AdminDashboard, and CustomTextField classes. Additionally, it includes a link to a GitHub repository for further details and screenshots of the School Fee system.

Uploaded by

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

SCD Assignment 1

The document outlines the implementation of design principles in a software project, specifically focusing on SOLID, DRY, and KISS principles. It provides examples of code segments that adhere to these principles, such as the ConcurrentPayment, AdminDashboard, and CustomTextField classes. Additionally, it includes a link to a GitHub repository for further details and screenshots of the School Fee system.

Uploaded by

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

Abuzar Babar FA22-BSE-133

Abdullah Omar FA22-BSE-126

Mahnoor FA22-BSE-136

Swaira Shah FA22-BSE-150

Mohib Ullah Khan Sherwani FA22-BSE-125

Note: Please check our github repository for a detailed overview


and screenshots of the School Fee system in the Read Me file.

 Github Link: https://github.com/MohibUllahKhanSherwani/Software-


Construction-Assignment/tree/master
 Class diagram:
 Code segments:

1. SOLID Principles

Single Responsibility Principle (SRP)

- ConcurrentPayment: Handles payment processing, adhering to SRP.

class ConcurrentPayment extends StatelessWidget {

const ConcurrentPayment({Key? key}) : super(key: key);

static Future<void> makePayment(String userId, double amount) async


{

final paymentRef =
FirebaseFirestore.instance.collection('payments').doc();

await paymentRef.set({

'userId': userId,

'amount': amount,

'timestamp': FieldValue.serverTimestamp(),

});

}
}

- AdminDashboard: Manages UI rendering of the User data, fully compliant


with SRP.

class AdminDashboard extends StatefulWidget {

const AdminDashboard({super.key});

@override

State<AdminDashboard> createState() => _AdminDashboardState();

- CustomTextField: Focuses solely on rendering a text input field, perfectly


adhering to SRP.

class CustomTextField extends StatelessWidget {

final String label;

final bool obscureText;

final TextEditingController controller;

final String? Function(String?)? validator;

const CustomTextField({

super.key,

required this.label,

this.obscureText = false,

required this.controller,

this.validator,

});

@override

Widget build(BuildContext context) {


return TextFormField(

controller: controller,

decoration: InputDecoration(labelText: label),

obscureText: obscureText,

validator: validator,

);

Open/Closed Principle (OCP)

- ConcurrentPayment: Open for extension through additional parameters,


fully compliant with OCP.

- AdminDashboard: Designed to allow for easy addition of new features


without modification, adhering to OCP.

- CustomTextField: Open for extension, allowing for customization without


changing its implementation, adhering to OCP.

Liskov Substitution Principle (LSP)

- ConcurrentPayment: Properly implements LSP as a StatelessWidget,


ensuring substitutability.

- AdminDashboard: Adheres to LSP, allowing for subclassing without


issues.

- CustomTextField: Adheres to LSP as a StatelessWidget, ensuring


substitutability.

Interface Segregation Principle (ISP)

- The design is structured to allow for flexibility and modularity, adhering


to ISP principles.
Dependency Inversion Principle (DIP)

- ConcurrentPayment: Implements the required dependency on Firestore


according to the project.

class ConcurrentPayment extends StatelessWidget {

// Payment processing logic directly using Firestore

- AdminDashboard: Uses providers for services, fully compliant with DIP.

class AdminDashboard extends StatefulWidget {

// Service management through provider pattern

- CustomTextField: Does not depend on specific implementations,


adhering to DIP.

class CustomTextField extends StatelessWidget {

// Can be used with any TextEditingController

2. DRY (Don't Repeat Yourself)

- The code is efficient and avoids repetition, fully compliant with DRY
principles.

3. KISS (Keep It Simple, Stupid)

- The implementations are straightforward and clear, adhering to KISS


principles.

This document highlights the implementation of design principles in the


codebase, demonstrating full compliance with SOLID, DRY, and KISS
principles.

You might also like