Files
2026-10-05 18:02:52 +02:00

48 lines
2.1 KiB
Markdown

# 1. Goal
Refactor the legacy class {{P}}TAILOR_PRICER in package $TMP. The class calculates
the price of an alteration job in a tailor shop. The shop terminal calls the class
for each job. The behavior of the class must stay the same.
# 2. Open questions
None.
# 3. Context
- The class {{P}}TAILOR_PRICER exists in package $TMP. It is active.
- The class is public and final. The public constructor has no parameters.
- The shop terminal calls the public method CALCULATE_PRICE for each job.
- The legacy implementation is correct. It is also long, deeply nested, and full of
magic numbers. It is hard to read and hard to change.
- The customers do not accept different prices. The same input must give the same
result as before.
# 4. Contract
- The class {{P}}TAILOR_PRICER stays in package $TMP. Do not rename it.
- The class stays public and final. The public constructor stays without parameters.
- The public types ty_garment, ty_service, and ty_price stay unchanged.
- The public method stays unchanged:
calculate_price
IMPORTING iv_garment TYPE ty_garment
iv_service TYPE ty_service
iv_quantity TYPE i
iv_express TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_price.
- Do not add other public methods, public attributes, or public types.
# 5. Business rules
The legacy implementation of {{P}}TAILOR_PRICER defines the price rules. Read the
legacy code in the seed object. Keep every rule, the sequence of the rules, and all
special cases. The behavior stays the same for every input combination.
# 6. Constraints
- Release target: SAP_BASIS 816.
- Coding standards: Clean ABAP. Methods below 40 statements. Maximum nesting depth
of 3. No magic numbers, use constants. No global variables. No comment that
restates the code.
- Out of scope: do not change the public interface. Do not change the class name.
Do not add public members. Do not change the price rules.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests as local test classes in the class.