AiPromptss
Back to browse

2. Complex Refactoring

Help plan refactoring this monolithic class : class OrderProcessor { constructor ( ) { this . db = new Database ( ) ; this . payment = new PaymentGateway ( ) ;…

Added May 19, 20260 views0 copies
Prompt
Help plan refactoring
this
monolithic
class
:
class
OrderProcessor
{
constructor
(
)
{
this
.
db
=
new
Database
(
)
;
this
.
payment
=
new
PaymentGateway
(
)
;
this
.
inventory
=
new
InventorySystem
(
)
;
this
.
shipping
=
new
ShippingService
(
)
;
this
.
notification
=
new
NotificationService
(
)
;
}
processOrder
(
order
)
{
// 500 lines of business logic
}
}
Goals
:
1.
Split into smaller classes
2.
Implement
SOLID
principles
3.
Improve testability
4.
Maintain transaction safety

Replace text in [BRACKETS] with your own values before pasting.