SAP / styleguides

This repository provides SAP style guides for coding and coding-related topics.
Other
1.68k stars 445 forks source link

SAP Dictionary Style Guides versus SAP Code Style Guides #195

Open WouterTriesCoding opened 3 years ago

WouterTriesCoding commented 3 years ago

I came across the following issue: https://github.com/SAP/styleguides/issues/171 where it discusses the database and the use of date time, which I found interesting. I worked with a developer who fancied using UTC timestamps without any reason, but this was disastrous for querying on from a Dynpro Report, requiring mapping and additional performance loss.

As I use CleanABAP to convince programmers of certain things, I'd like to do the same to dictionary objects. @HrFlorianHoffmann asked the question if CleanABAP is the right place for this, but I'd like to discuss exactly that to see what the community thinks, before creating a pull request.

After all, it's called 'CleanABAP', code and dictionary are tightly intertwined, especially now that we'll be pushing more and more code matters down to the database.

So proposal to add Dictionary topic, some thoughts:

Or is a 'SAP Dictionary Style Guides' in order? As I see the header of CleanABAP page is 'SAP Code Style Guides'

xtough commented 3 years ago

Good idea. Unfortunately, I am only aware of several internal DDic and/or CDS style guides. Nothing that could be published straight away...

WouterTriesCoding commented 3 years ago

@xtough I'm still finding it a difficult, one could say this belongs more in best practice guidelines (e.g. DSAG one) Are we able to clearly define CDS/DDIC things relating to 'Cleancode' without going to implementation best practices? Or is it acceptable to also include implementation best practices here?

xtough commented 3 years ago

adding @KlausHaeuptleSAP and @HrFlorianHoffmann : any opinion?

KlausHaeuptleSAP commented 3 years ago

The idea of a Clean CDS existed some time ago, but did not get a lot of traction. Still it would be highly relevant for ABAP and Non-ABAP. Somehow CDS is a language on its own and has implementations for different technology stacks.

One question is where to store such recommendations? Alternatives are:

  1. In the Clean ABAP file
  2. In a new Clean CDS file. Could also be a Clean ABAP CDS file if there are too many differences between the different CDS implementations.

Additionally we would need core owners/reviewers from the CDS language development - the language is still in its early stage and evolving a lot).

Another question is how to apply Clean Code principles to CDS and how to balance it with performance.

pokrakam commented 3 years ago

I'm all in favour of a CDS guide, there's a lot of bad CDS being written out there. You'd be amazed how hard it is to convince people not to use the DDIC field names like auart in CDS views. I think it could help if we even just start out with these kind of basics.

I also think the ABAP guide is getting a bit big so putting it into a separate section may be easier to manage. CDS is also a bit of a specialist field you can get quite deep into, and it's quite feasible to build Fiori apps and Gateway services based on CDS without writing a single line of ABAP.

WouterTriesCoding commented 3 years ago

FYI, coincidentally, blogpost and comments going in regards to date, time and timestamps: https://blogs.sap.com/2021/05/16/time-stamps-in-abap/comment-page-1/#comment-574580

Louis-Arnaud commented 2 years ago

About that blog post : I don't think that these annotations improve performance. It is just information that can be helpful to a developper that wants to use this CDS view. I might be wrong but that's what I find out after doing some research when I found this blog post.

But yes, CDS view performance guidelines should exist (and I think that it is SAP job to initiate it). As @xtough said, SAP has internal documentation about CDS, I don't understand why they keep it secret (or maybe I do know but that is not a good reason).