Comments (2)
I would actually discourage this kind of comment. 😄 There is a multitude of reasons for this that are also spread throughout https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#comments:
-
These kinds of comments tend to outdate quickly and become misleading. If you change and rename the method to
prepend_xs
, will you remember to adjust the comment? Probably yes. But will you also remember it if you rename the method in an interface, and use auto-refactoring to adjust the class code? Or remember to adjust all occurrences if you rename a method that's used widely in a class hierarchy? Probably not. You will be left with methods that readprepend_xs
but have a misleading commentAdd Xs to a string
inside - and this is only an obvious, mild example for the confusion that outdated comments can create. -
If you add these comments everywhere, the code gets bloated drastically. Your example already has 7 lines of comments for 6 lines of production code - a clear misbalance, in my eyes. What will it look like after refactoring number 18, when your comment starts filling out a whole page for a still tiny piece of code?
-
Adding the history in such a prominent way suggests that the history is more important than what currently is. I think this is a misconception. The method should focus first and foremost on what it does. Only if need be should there be means to inspect what prior versions of the code did, and why that was changed.
-
Commit messages describe a set of related changes in a single place. This is quite different from these comments, where the common idea behind the change will probably get lost between the many individual small comments.
-
Most of the information in the comment can already be gleaned from the history of the object: the IDs of the transport requests, the dates (and even times) of change, and the users that released the changes. Transport requests also allow adding short texts that roughly describe the change.
-
Writing this information consistently is a lot of work, and - at least knowing my colleagues 😄 - I am convinced some people or others will simply forget it or make mistakes (copy-paste, wrong date, typo in the change ID, ...) that make the comments questionable or even worthless.
Of course we should be able to produce the information you describe. But I think that attempting to fix this with comments instead of improving the version control itself is the wrong way.
from styleguides.
You bring up a lot of good points and I have experienced several of the problems you mention IRL.
Most of my colleagues seem to agree with you :)
Hopefully better code and tools will make the header comment unnecessary.
Thank you for for you comments, I will close the issue.
regards
Frank
from styleguides.
Related Issues (20)
- Strategy regarding translations HOT 2
- Strategy for handling dependencies to system releases HOT 4
- Text on logo not readable in dark mode (Code Review Guide) HOT 3
- [Exploit the test tools] Add CL_AUNIT_AUTHORITY_CHECK to the list? HOT 6
- [Consider decomposing complex conditions] bad use case example HOT 1
- German Translation: Typo HOT 1
- Use assert class instead of ASSERT HOT 12
- Are comments bad or not?
- [Use CHANGING sparingly, where suited] Is it ok to use IMPORTING REF instead of CHANGING? HOT 7
- New rule: prefer inferring types HOT 1
- Abap Exception categories HOT 3
- Use READ-ONLY sparingly - new abap command FINAL HOT 2
- How to add sample code to Clean ABAP? HOT 1
- Unclear explanation of [Use LOCAL FRIENDS to access the dependency-inverting constructor] HOT 5
- Follow rules when abbreviating HOT 1
- "Dead" link at section "split-method-instead-of-boolean-input-parameter" HOT 3
- Chapter "Avoid abbreviations" HOT 7
- [Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE] In defense of RAISE EXCEPTION TYPE HOT 6
- Prefer ENUM to constants interfaces HOT 1
- [Use | to assemble text] Is a caveat needed in case of translatable texts? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styleguides.