News for hackers. Stuff that matters.
Re:I Love Ruby by IshKebab on Tuesday December 19, 2023 @06:10AM (#38694207)
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.

Re:I Love Ruby by zemptime on Tuesday December 19, 2023 @07:36AM (#38694795)
This 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/ro...

Those are some pretty clean routes!

Re:I Love Ruby by IshKebab on Tuesday December 19, 2023 @09:37AM (#38696016)
Perfectly illustrating the problem! Now try to imagine finding that if you are unfamiliar with Ruby routing.
Re:I Love Ruby by ilrwbwrkhv on Tuesday December 19, 2023 @08:41AM (#38695388)
I 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.

Re:I Love Ruby by jupp0r on Tuesday December 19, 2023 @02:04PM (#38699998)
Most 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.
Re:I Love Ruby by chris12321 on Thursday December 21, 2023 @08:54PM (#38729976)
Most code doesn't follow SOLID principles.