Understanding Few Rails Comments

Asked 2 years ago, Updated 2 years ago, 43 views

Thank you for your help.

It's been a while since I started developing Ruby on Rails.
I've seen a lot of source code online, including StackOverFlow and Qiita. Most of them have no comments.
There are times when there are no comments on the library override.
Therefore, you can either close your eyes for details from the method name or look for the code of the parent class method.

Certainly, I think it's a good code to be able to understand without comments, but I often feel like I'm forcing myself to lose it.
Is there a tendency for Rails development to eliminate comments?

Thank you for your cooperation.

ruby-on-rails ruby

2022-09-30 19:25

1 Answers

It's my subjective opinion, but not just Ruby on Rails, whether it's Java code or any language or framework, I think the code written directly on StackOverflow or Qiita tends to have fewer comments.I myself do not actively try to write comments when I create a code to post in such a place.There is a good reason for this.

First of all, the code written here is often a piece of code for reproducing or explaining a problem, not a finished product.As for the excellent questions, I wrote them down to the minimum reproducibility, so I think there is no need to comment on them as the code that is only available until now.The answer has already been explained in the text.This is because the code is only a supplement to actual operation verification.Commenting on the same text in the code will only be redundant.The same goes for Qiita articles.

To see how the Ruby on Rails program is trending, I don't think I can say anything unless I look at the finished product (not an experimental fragment, etc.Examples include Redmine, mastodon, and GitLab CE.

Well, with that in mind, it's a trend, but in the end, it's also a subjective opinion, but as long as you're on the Ruby on Rails rail, you won't be able to comment.For example, the controller class is self-evident from its location, name, and parent class of controller class.In addition, it is obvious which paths and which methods are followed by standard routing, and show and index do not bother to explain.On the other hand, I think comments tend to be written when it comes off the rails or when it comes off the rails.

However, there will always be differences in policies for each project, and I think the trend will change again between open source and closed products, so I don't think I can say for sure.Other than Ruby on Rails, it is not uncommon for open-source products to have no comments at all.(Oh, that's what I made...)


2022-09-30 19:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.