Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

naming of range tables #286

Open
mastergago opened this issue Oct 2, 2022 · 7 comments
Open

naming of range tables #286

mastergago opened this issue Oct 2, 2022 · 7 comments

Comments

@mastergago
Copy link

As I try to stick with singular and plural should a range table be named in plural or singular? I ask this because a range table is a special type.

`data company_code_range type range of t001-bukrs.

data company_code_ranges type range of t001-bukrs.`

@ruthiel
Copy link

ruthiel commented Oct 10, 2022

As I try to stick with singular and plural should a range table be named in plural or singular? I ask this because a range table is a special type.

`data company_code_range type range of t001-bukrs.

data company_code_ranges type range of t001-bukrs.`

Nice question!

I usually use:
DATA company code_range TYPE RANGE OF t001-bukrs.

Don't know what the correct way to do it indeed.

@suynwa
Copy link

suynwa commented Nov 18, 2022

IMO, there can be multiple company codes (plural) in the range (singular). Therefore, i prefer using this:

data RANGE_OF_COMPANY_CODES type range of T001-BUKRS.

@fabianlupa
Copy link
Contributor

I do DATA company_code_range TYPE RANGE OF bukrs and DATA company_codes TYPE STANDARD TABLE OF bukrs. I am not a native english speaker, to me I always understood range as a collective noun/term (?), therefore what stands before it should be singular. Like to me it would be DATA company_code_list TYPE STANDARD TABLE OF REF TO company_code_model and not company_codes_list. vehicle_list instead of vehicles_list, therefore vehicle_range -> company_code_range. 🤷

If I see company_code_ranges I'd assume it's TYPE STANDARD TABLE OF RANGE OF bukrs (with an intermediate helper type...).

@N2oB6n-SAP
Copy link
Member

There is no perfect answer to this but in any case the sections Use descriptive names and Use plural should provide an outline to assist your in finding a good name for your context:
First of all note that company_code_range tells you about the what but not the why. However the what is fully covered by the typing already. Sure, "company code" is clearer than the cryptic (yet in an SAP context well-understood) "BUKRS" yet providing some information about the why or what for is more helpful. Putting "range" or "list" in a name is redundant to some degree.

Consider this fictitious example with some context:

SELECT * FROM partners WHERE company_code IN collaboration_partner_codes INTO @DATA(partners_with_collab_agreement).

For the goal of understanding this code I believe it is sufficient to consider a range(s) table a set definition (in the mathematical sense) and thus simply use the plural.

@fabianlupa
Copy link
Contributor

I think I agree to a point, one thing that comes to mind though is that the variable does not actually contain a list of company codes like TYPE STANDARD TABLE OF bukrs would. TYPE RANGE OF bukrs may also use the whole feature set of ranges, that includes patterns and excluding values. One could argue it's a filter, so maybe company_code_filter would also be an option if range is too technical.

@N2oB6n-SAP
Copy link
Member

Yes, I was aware that it is not actually a list of company codes - hence the pointer to the mathematical definition of a set that may describe it by the properties of its elements (i.e. a set-builder notation or set comprehension). To understand the goal of the algorithm, however, this "implementation detail" should not be required. Using the IN operator is the next best thing to a fictitious SELECT * FROM partners WHERE has_collaboration_agreement( company_code ) INTO ... in terms of pushing the filter logic down to the database.
Nevertheless, calling it a filter is closer to the intention so I would consider this an improvement over naming the variable *_range[s] already.

@HrFlorianHoffmann
Copy link
Contributor

HrFlorianHoffmann commented Dec 12, 2022

Agree with @fabianlupa and @N2oB6n-SAP. In my non-prefixed code, I mostly use company_code_filter or company_code_selector to name ranges.

One confusing thing about naming ranges is that it's unclear what exactly "the range" is: Is it one row in the table, because it could be a BT entry, so we effectly have a table of ranges? Or is it the table as such, because it describes "the range of things to select"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants