Hacker News new | ask | show | jobs
by ooqr 3438 days ago
I am a rails dev. I inherited a legacy application. The biggest problem with Ruby/Rails is that anything Ruby will allow, someone will do. Ruby is the language I learned data structures and algorithms in, built my first significant projects in. It has a generous wealth of helpful builtins. But it makes me long for strictness, static typing, a language where not just anything can completely modify any other.
2 comments

This. Often, you can't find where this variable or function comes from. You read the sources only to discover that there is no trace of this variable and it is probably defined dynamically in some callback. You can only find this kind of stuff with the help of debugger. The dynamism, which allows one to create beautiful interfaces, and is often advertised as a programmer's friend, is actually the enemy of the programmer who is going to read the code afterwards.
I've actually run into methods defined from names concatenated from multiple strings, i.e. methods you can't even use grep over the whole codebase to find. This has left me with a lingering vague fear ever since.
I've seen worse.

A system that would load chunks of code out of MySQL and eval them in place.

Magic variables with magic meanings... shudder

Sounds like the coder was might have been imitating the idea of SQL stored procedures.
Actually he was imitating Lotus Notes...
that sounds like shitty code - i wouldn't blame ruby or rails for that.

Lots of things are possible - but not everything is a good idea - or is, but could be done in a clearer way.

This.

I used to work at places where we cared deeply about our code. You should see some of the code reviews from one of the places, sometimes they got kinda ridiculous and people got into arguments about coding style and the discussion never ended... But the code was great. I kept it for some time after leaving the job and I looked at it to see how good a Rails project can be. Ah, we had over 90% code coverage from the beginning too.

Without Rails, I don't think that codebase would have been as maintainable as it was.

Then at my next job after that, I was hired as a Rails developer. Rails was a dependency and they used controllers and views and wrote the most insane code I have ever seen. Not that many tests, and the tests we had required a significant amount of setup and no one really knew how to run them (and make them pass).

I'm used to Rails being nice and friendly to work with, so joining a project where they fucked up everything really sucked, because I know what it's like to work in a good rails app.

I feel that ways as well... and I'm loving F# for being easy to write and read and yet giving me algebraic data types which allow me to better to model the domain I'm working in and for forcing me to explicitly demarcate what's mutable and what's not.

You should check out Scott Wlaschin's talk, Domain Modeling with F# if you get the chance. https://vimeo.com/97507575