• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 64 pages
Exam (elaborations)

WGU D780 Software Architecture and Design Task 1 | Complete Design Patterns and Python Code Refactoring Exemplar with Detailed Explanations and Tested Code | 2026/2027 Updated

Document preview thumbnail
Preview 4 out of 64 pages

WGU D780 Software Architecture and Design Task 1 | Complete Design Patterns and Python Code Refactoring Exemplar with Detailed Explanations and Tested Code | 2026/2027 Updated

Content preview

,WGU D780 Task 1 - Design Patterns & Refactoring -
PRACTICE EXEMPLAR
Complete Design Patterns and Python Code
Refactoring Exemplar with Detailed Explanations
and Tested Code | 2026/2027 Updated

Part 1: Architectural Analysis & Refactoring
Strategy
1. Legacy Monolith Codebase Issues
In a typical legacy retail or order-processing system
(e.g., the legacy codebase targeted in WGU D780
Task 1), a single monolithic class often manages
product pricing, discount logic, payment processing,
notification dispatch, and receipt generation.
Identified Anti-Patterns & Violations:
• Single Responsibility Principle (SRP)
Violation: The main order manager class
handles business calculation, external API
payment calls, email notification formatting, and
file I/O operations simultaneously.
• Open/Closed Principle (OCP) Violation:
Adding a new payment processor (e.g., Apple
Pay, PayPal) or a seasonal discount strategy
requires directly modifying if-elif-else

, branches inside core order processing methods,
introducing regression risks.
• Tight Coupling: Core business logic directly
instantiates concrete third-party services (e.g.,
SMTPClient, StripeAPI), making isolated
unit testing impossible without live network
connections.
2. Design Pattern Selection & Architectural
Strategy
To refactor this tightly coupled monolith into a clean,
extensible, and maintainable architecture, three core
GoF design patterns are introduced:
+----------------------------------
-----------------------------------
--+
| Order
Context
|
+----------------------------------
-----------------------------------
--+
|
|
v
v

, +-----------------------+ +--
---------------------+
| Strategy Pattern | |
Factory Pattern |
| (Discount Logic) | |
(Payment Processors) |
+-----------------------+ +--
---------------------+
- PercentageDiscount -
CreditCardProcessor
- FixedAmountDiscount -
PayPalProcessor
- BlackFridayDiscount -
CryptoProcessor
|
v
+----------------------------------
---------------------+
| Observer Pattern
|
| (Decoupled Event
Notifications) |
+----------------------------------
---------------------+
- EmailNotificationObserver
- SMSNotificationObserver
- InventoryAuditObserver

Document information

Uploaded on
October 29, 2026
Number of pages
64
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$17.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
50
Followers
4
Items
5573
Last sold
5 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions