Hacker News new | ask | show | jobs
by knivets 3439 days ago
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.
2 comments

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.