Skip to content

Commit

Permalink
Added section Avoid obsolete language elements (#31)
Browse files Browse the repository at this point in the history
* Added section How to Check Automatically

* Explain example a little better

* Updated the cheat sheet to 1.3.0

Added section Avoid obsolete language elements
  • Loading branch information
HrFlorianHoffmann committed May 8, 2019
1 parent 8b7944d commit 47e515f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
49 changes: 49 additions & 0 deletions clean-abap/CleanABAP.md
Expand Up @@ -32,6 +32,7 @@ The [Cheat Sheet](cheat-sheet/CheatSheet.md) is a print-optimized version.
- [Mind the performance](#mind-the-performance)
- [Prefer object orientation to procedural programming](#prefer-object-orientation-to-procedural-programming)
- [Prefer functional to procedural language constructs](#prefer-functional-to-procedural-language-constructs)
- [Avoid obsolete language elements](#avoid-obsolete-language-elements)
- [Use design patterns wisely](#use-design-patterns-wisely)
- [Constants](#constants)
- [Use constants instead of magic numbers](#use-constants-instead-of-magic-numbers)
Expand Down Expand Up @@ -591,6 +592,54 @@ IF line_exists( value_pairs[ name = 'A' ] ).

Many of the detailed rules below are just specific reiterations of this general advice.

### Avoid obsolete language elements

> [Clean ABAP](#clean-abap) > [Content](#content) > [Language](#language) > [This section](#avoid-obsolete-language-elements)
When upgrading your ABAP version,
make sure to check for obsolete language elements
and refrain from using them.

For example, the `@`-escaped "host" variables
in the following statement make a little clearer
what's a program variable and what's a column in the database,

```ABAP
SELECT *
FROM spfli
WHERE carrid = @carrid AND
connid = @connid
INTO TABLE @itab.
```

as compared to the [obsolete unescaped form](https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenopen_sql_hostvar_obsolete.htm)

```ABAP
SELECT *
FROM spfli
WHERE carrid = carrid AND
connid = connid
INTO TABLE itab.
```

Newer alternatives tend to improve readability of the code,
and reduce design conflicts with modern programming paradigms,
such that switching to them can automatically clean your code.

While continuing to work, obsolete elements may stop benefitting
from optimizations in terms of processing speed and memory consumption.

With modern language elements, you can onboard young ABAPers easier,
who may no longer be familiar with the outdated constructs
because they are no longer taught in SAP's trainings.

The SAP NetWeaver documentation contains a stable section
that lists obsolete language elements, for example
[NW 7.50](https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/index.htm?file=abenabap_obsolete.htm),
[NW 7.51](https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenabap_obsolete.htm),
[NW 7.52](https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_obsolete.htm),
[NW 7.53](https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=abenabap_obsolete.htm).

### Use design patterns wisely

> [Clean ABAP](#clean-abap) > [Content](#content) > [Language](#language) > [This section](#use-design-patterns-wisely)
Expand Down
4 changes: 3 additions & 1 deletion clean-abap/cheat-sheet/CheatSheet.md
Expand Up @@ -12,14 +12,16 @@ is versioned according to the [Semantic Versioning specification](https://semver

## Download

- [**Cheat Sheet**](CleanABAPCheatSheetV1.2.1.pdf) · Latest version · PDF
- [**Cheat Sheet**](CleanABAPCheatSheetV1.3.0.pdf) · Latest version · PDF

- [**The Golden Rules**](CleanABAPTheGoldenRulesV1.0.0.pdf) · Latest version · PDF

## Versions

### Cheat Sheet

- [v1.3.0](CleanABAPCheatSheetV1.3.0.pdf) · 8 May 2019
- Added section _Avoid obsolete language elements_
- [v1.2.1](CleanABAPCheatSheetV1.2.1.pdf) · 7 May 2019
- Replaced _imperative programming_ with _procedural programming_
- [v1.2.0](CleanABAPCheatSheetV1.2.0.pdf) · 6 May 2019
Expand Down
Binary file modified clean-abap/cheat-sheet/CleanABAPCheatSheet.docx
Binary file not shown.
Binary file not shown.

0 comments on commit 47e515f

Please sign in to comment.