Supported by

Clean ABAP

For many years, when confronted with ABAP OO, most ABAPers I talked to, acknowledged that OO is great for most languages but never saw any real advantage in adopting it for ABAP. So they carry on using FORMs, INCLUDEs and CALL FUNCTIONs. The standard SAP code sets the example by trying to make something work while breaking every possible programming best practice.

ABAP OO has many advantages. But, against all evidences, most people still use classic ABAP. Or create a single class with dozens of static methods, which is somewhat better (allowing for a more decent encapsulation and proper OO exceptions) but not OO at all.

And yet, it is very very easy to screw up with OO. Moving from classic ABAP to ABAP OO requires a radical paradigm shift. Besides, most of the OO programming techniques I learned in College 20 years ago are now obsolete (ex.: composition over inheritance). OO best practices have evolved greatly. My favorite reference is Robert Martin’s Clear Code.

But suddenly SAP does this: https://github.com/SAP/styleguides.

SAP is not what it used to be. This repository is a very complete ABAP styling guide. They call it Clean ABAP to make it explicit that it follows the Clean Code principles. It is an exemplary guide which is constantly evolving and to which anyone can contribute. Every ABAPer should take the time to read through this guide. I learn something new every time I visit it.

And if you still don’t use ABAP OO, reading it should probably be enough to convince you to give it a try.

Greetings from Abapinho.

2 comentários a “Clean ABAP”

  1. Ruthiel Diz:

    Olá Nuno,

    De facto é mesmo fácil fazer muita asneira com OOP.
    Principalmente quando ninguém o faz e tens que desbravar caminho =)

    Tive a sorte de conhecer e trabalhar com dois colegas que me ajudaram bastante a ir para a frente contra as 10 000 linhas de testamentos corridos, perfoms e MF, ahah.

    Esse guia é incrivel e também consulto frequantemente para ir melhorando uma coisa ou outra no meu código.

    Uma boa dica também é meteres esse WATCH nesse repositório da SAP.
    Vai fazer com que recebas as discussões e correções que vão sendo feitas nessa “bíblia” de como fazer um código limpo e legível =)

    Obrigado por partilhares isto.

  2. Nuno Godinho Diz:

    Obrigado eu! Olá Ruthiel, eu activei o watch nesse repositório também. As discussões são interessantes.

Deixe um comentário

About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).