@@ -122,52 +122,52 @@ While this practice was not correct in the first place, as an interface is somet
122
122
Name the interface more generic and the implementing classes more specific:
123
123
124
124
``` ABAP
125
- interface game_board.
125
+ INTERFACE game_board.
126
126
...
127
- endinterface .
127
+ ENDINTERFACE .
128
128
129
- class game_board_as_list definition .
130
- public section .
131
- interfaces game_board.
129
+ CLASS game_board_as_list DEFINITION .
130
+ PUBLIC SECTION .
131
+ INTERFACES game_board.
132
132
...
133
- endclass .
133
+ ENDCLASS .
134
134
135
- class game_board_as_array definition .
136
- public section .
137
- interfaces game_board.
135
+ CLASS game_board_as_array DEFINITION .
136
+ PUBLIC SECTION .
137
+ INTERFACES game_board.
138
138
...
139
- endclass .
139
+ ENDCLASS .
140
140
```
141
141
142
142
To avoid name clashes with method e.g. importing parameters use the self reference ` me-> ` :
143
143
144
144
``` ABAP
145
- class game_board_as_list definition .
146
- public section .
147
- methods constructor
148
- importing x_dimension type i
149
- y_dimension type i.
150
- private section .
151
- data x_dimension type i.
152
- data y_dimension type i.
153
- endclass .
154
-
155
- class game_board_as_list implementation .
156
- method constructor.
145
+ CLASS game_board_as_list DEFINITION .
146
+ PUBLIC SECTION .
147
+ METHODS constructor
148
+ IMPORTING x_dimension TYPE i
149
+ y_dimension TYPE i.
150
+ PRIVATE SECTION .
151
+ DATA x_dimension TYPE i.
152
+ DATA y_dimension TYPE i.
153
+ ENDCLASS .
154
+
155
+ CLASS game_board_as_list IMPLEMENTATION .
156
+ METHOD constructor.
157
157
me->x_dimension = x_dimension.
158
158
me->y_dimension = y_dimension.
159
- endmethod .
160
- endclass .
159
+ ENDMETHOD .
160
+ ENDCLASS .
161
161
```
162
162
163
163
For tables and structures use singular and plural:
164
164
165
165
``` ABAP
166
- types: begin of coordinate,
167
- x type i,
168
- y type i,
169
- end of coordinate.
170
- type coordinates type standard table of coordinate with default key .
166
+ TYPES: BEGIN OF coordinate,
167
+ x TYPE i,
168
+ y TYPE i,
169
+ END OF coordinate.
170
+ TYPE coordinates TYPE STANDARD TABLE OF coordinate WITH DEFAULT KEY .
171
171
```
172
172
173
173
## Compromises
0 commit comments