3 ms·
This is a great article. The section concerning self-describing code really hit home. Comments can, at times, be more distracting than helpful. If one chooses
by brentr 19y ago
This is a great article.
The section concerning self-describing code really hit home. Comments can, at times, be more distracting than helpful. If one chooses to appropriately name code items, it is my belief that comments become unnecessary clutter.
One of the methods I use for clarity when writing object-oriented code is as follows: only getters and setters touch the private data members. The only problem with this approach is if performance (i.e. speed) in your system is an issue; there is a lot of overhead in calling the getters and setters.
What methods do other people use for maintaining source code readability and separation of concerns?
EDIT: For clarification, when I state that one should use only setters and getters to access private data, I mean that other public methods in the same class should be calling the setters and getters instead of accessing the private data directly.