3 ms·
Ruby code seems to be designed to be hard to follow. Not only is it dynamically typed, but it seems like identifiers are dynamically generated, which makes it i
by IshKebab 3y ago
Ruby code seems to be designed to be hard to follow. Not only is it dynamically typed, but it seems like identifiers are dynamically generated, which makes it impossible to search for them.
Here's a challenge: in the Gitlab source code, tell me where `external_file_project_job_artifacts_path` is defined. It's referenced in a few places but it isn't defined anywhere.
And yes I know in other languages you can use codegen to construct unsearchable identifiers in the same way, but Ruby seems to actively encourage it.
- zemptime 3y agoThis made me curious. Having never read the gitlab code before, and on mobile, took all of about 30 seconds to find https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/routes/project.rb?ref_type=heads#L83 https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/ro... Those are some pretty clean routes!
- IshKebab 3y agoPerfectly illustrating the problem! Now try to imagine finding that if you are unfamiliar with Ruby routing.
- ilrwbwrkhv 3y agoI think another major problem which people do not mention too much is that the ruby community went pretty deep in the whole solid principles, uncle Bob refactoring rabbit hole. Because of that a lot of people still have major bad practices set in their heads such as a method shouldn't be longer than 5 lines etc. Most rails code bases that I have seen usually has had a senior ruby lover refactor things in such a way that one thing is always calling another thing and even though the actual working business logic might be 12 lines which should have been linearly written, is spread across 5 files with objects being new'd up everywhere making it really hard to follow.
- jupp0r 3y agoMost Ruby code I've worked with does not follow SOLID principles. Especially the Liskov substitution principle is almost never adhered to when using inheritance as a way of code sharing.
- chris12321 3y agoMost code doesn't follow SOLID principles.