Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
54 lines
2.3 KiB
Markdown
54 lines
2.3 KiB
Markdown
# 1. Goal
|
|
Refactor the class {{P}}MARINA_FEE in package $TMP. The class calculates the
|
|
berthing fee of a boat in a marina. The behavior of the class must not change.
|
|
The public interface of the class must not change. Improve the internal quality
|
|
of the class.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The class {{P}}MARINA_FEE exists in package $TMP. It is active.
|
|
- A marina uses the class to calculate the berthing fee of a boat.
|
|
- The class is legacy code. The results of the class are correct. The quality of
|
|
the code is poor.
|
|
- The class has one public method. This method contains the complete calculation.
|
|
- The source code of the class is the specification of the behavior. Read the
|
|
source code before you change it.
|
|
|
|
# 4. Contract
|
|
- Change the class {{P}}MARINA_FEE in package $TMP. Do not create a new class.
|
|
- Keep the name of the class {{P}}MARINA_FEE.
|
|
- Keep the public interface of the class. The public interface is:
|
|
- The public types TY_BOAT_TYPE (CHAR 1), TY_SEASON (CHAR 1), and TY_FEE
|
|
(PACKED 8, 2 decimal places).
|
|
- The public method CALCULATE_FEE.
|
|
- The importing parameters of CALCULATE_FEE: IV_LENGTH_M (TYPE i), IV_NIGHTS
|
|
(TYPE i), IV_BOAT_TYPE (TYPE ty_boat_type), IV_SEASON (TYPE ty_season), and
|
|
IV_POWER (TYPE abap_bool).
|
|
- The returning parameter RV_FEE (TYPE ty_fee).
|
|
- Do not change the names, the types, or the sequence of the parameters.
|
|
- Do not add other public methods or public attributes.
|
|
- You can change the private section of the class.
|
|
|
|
# 5. Business rules
|
|
- The method CALCULATE_FEE keeps its behavior. The behavior is the behavior of
|
|
the legacy class {{P}}MARINA_FEE in package $TMP.
|
|
- Read the legacy source code. The legacy source code is the only specification
|
|
of the calculation.
|
|
- Do not change a result value. Do not add a rule. Do not remove a rule.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Coding standards: Clean ABAP. Methods below 40 statements. No nesting deeper
|
|
than two levels. No magic numbers. Use constants. Use meaningful names. No
|
|
comment that restates the code.
|
|
- Out of scope: none.
|
|
|
|
# 7. Acceptance
|
|
- The class {{P}}MARINA_FEE is active and has no syntax error.
|
|
- The public interface of the class is unchanged.
|
|
- The behavior of the class is unchanged. The hidden tests pass.
|
|
- The class has no ATC priority 1 finding and no ATC priority 2 finding.
|
|
- Write your own ABAP Unit tests for the class.
|