uprm-inso4117-2024-2025-s2 / semester-project-thriftuni

semester-project-thriftuni created by GitHub Classroom
8 stars 0 forks source link

[Lecture Topic Task] Refactor Profile to Comply with Open/Closed Principle #198

Closed yadrielsamir closed 1 month ago

yadrielsamir commented 1 month ago

Objective

Refactor the Profile.tsx component so that it adheres to the Open/Closed Principle. The goal is to make the component easily extendable for future functionalities (e.g., new tabs, features, or profile sections) without having to modify its existing, stable code.

Task Description

This task involves redesigning the Profile.tsx file to decouple its core functionality from potential extensions. The refactoring should extract and isolate distinct sections into separate components.

Implementation Ideas

Component Decomposition: Extract the profile header, statistics, tab toggles, and listings into individual, reusable components. Configuration-Driven Design: Define configuration objects (e.g., an array of tab configurations) to control the rendering of dynamic elements.

Testing and Debugging

Unit Testing: Write unit tests for each extracted component to ensure they render correctly with different configurations. This includes tests for the header, stats display, and dynamic tab switching. Integration Testing: Perform integration tests on the entire Profile component to verify that the component works as expected when all parts are composed.

Suggested Values

Difficulty: Urgency: