4 ms·
Not to put too fine a point on it, but this is what Rails does when the programmer fails. If you type in invalid identifiers, no programming language or web fr
by patio11 17y ago
Not to put too fine a point on it, but this is what Rails does when the programmer fails. If you type in invalid identifiers, no programming language or web framework is going to be very happy with you. After that, it is a matter of taste and technical feasibility how the framework handles it. If you're lucky and using Java, you typed in an invalid identifier in such a way that the project fails to compile, and Eclipse will give you little red squiggles. (If you're not lucky, you get an undescriptive error message thrown up from a 700 line stack trace and have to guess what caused it then spend 30 seconds redeploying to see if you guessed right. For example, if you have a genetic predisposition against typing things correctly the first time, botching values in your XML configurations in such a manner than the XML is still valid is going to cause you a lot of pain.)
Ruby is an interpreted language and can't feasibly do the red squiggle thingee, but the common errors are trivially debuggable after a few hours experience with the framework. If you see an error message talking about HommeController, you search for homme globally, find the one instance of it, fix the spelling and reload the page you were just seeing. Bam, that took you three seconds.
- smanek 17y agoAs a non-ruby dev, it isn't obvious to me that I should grep 'Homme' instead of 'HommeController' ... A statically typed language with a good IDE (yes, like Java) will find almost all these errors for you as you type (excepting config files, like you said).
- futuremint 17y agoI've found RubyMine to do a pretty good job with "red squiggly things". Its an IDE (yes, like Java) but for Ruby. A dynamic language. Static typing isn't a necessity for a good IDE, just look at Smalltalk.
- latortuga 17y agoAs another data point, a few of my coworkers claim Netbeans is a reasonably good Rails IDE.
- patio11 17y agoI do Java at the day job. If we hired you as a new employee, and in the course of cutting your teeth on our Java framework you made those errors, I think Eclipse would have caught exactly one of them. Routes.rb errors 1 and 2: sorry, this is either handled in a configuration file or the database, which is loaded from an XLS file in our framework. None of this is checked. Linking to non-existent pages: we don't actually have a URL generation helper, but if we did, it would be in the JSP and thus not subject to fast checking. Since in Java you'd be passing a string as a parameter rather than an automatically generated method, you'd get nothing useful here prior to actually clicking on the link and finding it didn't go anywhere. Misspelling confirm: This would be caught in your JSP compile step prior to deploying the server, although you'd still waste a minute. Mistyped property names: OH GOD do I hate this one. You'll get as far as any page done by that action without error. Then the action gets loaded and the fun begins. Typically you'll get an error telling you that a form is not defined , which is your cue that says "Check the contents of the annotations for this action, something is borked", but if you don't know that symptom or (worse) if you borked something in one of the fields where the page can still load, you'd either waste a lot of time or miss the bug entirely. (For example, in our system, one way of causing this bug would leave "name" totally unchecked but let the form submission succeed for good input. Since many of our outsourcers don't bother testing with bad input...) Misspelled formats: We don't even have this feature. (P.S. I don't know why Rails books and tutorials always emphasize this so much, since most people don't need it. I always just delete that code from my own Rails methods.) Botching the key to a parameters access: Since the key is a string and there is no way to tell whether Map#contains("arbitrary string") at compile time, you'll get as far as execution before seeing any error here. It will probably be a NullPointerException.
- tptacek 17y agoIt's a religious thing. Writing actions that make sense both with XML output and with HTML output tends to force you to write REST-y web-service-y interfaces. I delete the code too, but I feel guilty for doing it.
- lonestar 17y agoIf you're not a Ruby/Rails dev, it doesn't seem reasonable to expect that all the framework's errors will make sense to you. If you took the time to learn how requests are routed in an MVC framework, this particular error would probably make perfect sense to you.
- deleted 17y ago[deleted]