Earlier quoted context omitted.
I stick a 'binding.pry' (pry gem) in the body of the method I'm trying to write, and I trigger it with a test that has all the correct parameters (i.e. the happy path). I then write my code in the REPL. I can use 'ls' to look up available methods dynamically. Complex ActiveRecord queries are much easier to prototype. Finding the right method isn't usually too difficult. And pry supports prefix completion at the first…
I actually follow a very similar pattern when developing in both Ruby and Clojure. I particularly like it in Clojure because I can run `(doc function-name)` to get some documentation on the function I intend to use (I can never remember the order of arguments!!).
“Did you mean?” Experience in Ruby
171–180 of 187 posts
Re: “Did you mean?” Experience in Ruby
#172Earlier quoted context omitted.
This is honestly an issue I don't experience, if I have a typo my test fails and the compiler tells me the line and method call that failed. I correct it, carry on. I can't think of a scenario where you would get stuck with this type of problem.
Compare this with an IDE highlighting this immediately when you write the offending line. In your workflow you have to run a test to identify this issue, then go back and fix it. It certainly doesn't leave you stuck but you are incurring additional overhead in that you actually have to run tests to discover there's a problem and then remediate it.
Re: “Did you mean?” Experience in Ruby
#173Blows my mind that IDEs and environments are not better at this. This is something that computers are good at, pattern recognition and scanning the whole file. Of course the it wouldn't work every time, an could make ridiculous suggestions, but I would love the computer to suggest something every time there is an issue. Even if it is wrong 90% of the time, if those guesses don't slow down the programmer the time save…
Re: “Did you mean?” Experience in Ruby
#174Earlier quoted context omitted.
I stick a 'binding.pry' (pry gem) in the body of the method I'm trying to write, and I trigger it with a test that has all the correct parameters (i.e. the happy path). I then write my code in the REPL. I can use 'ls' to look up available methods dynamically. Complex ActiveRecord queries are much easier to prototype. Finding the right method isn't usually too difficult. And pry supports prefix completion at the first…
I actually follow a very similar pattern when developing in both Ruby and Clojure. I particularly like it in Clojure because I can run `(doc function-name)` to get some documentation on the function I intend to use (I can never remember the order of arguments!!).
They don't always work depending on configuration, but it's very nice when they do. They can even go far enough to show the C source for builtins.
Re: “Did you mean?” Experience in Ruby
#175Earlier quoted context omitted.
"without a Java IDE" This was your problem. Programming Java without an IDE that recompiles your changes on the fly is just so arcane and really slows you down as you noticed.
Which is great, but that's almost not the main issue. In the ipython REPL I can work with my code and data at the same time. It's a huge disadvantage to not be be able to probe your data to create a working process.
Start your program in your IDE's debugger (or point it to your application server where your program is running) and you can change the code immediately, rerun your methods, change variables, inspect the objects, etc.
It's more than a simple REPL, it's a full-blown debugger and it comes really close to what you have in a SmallTalk image where your code, data, and environment is all the same.
Re: “Did you mean?” Experience in Ruby
#176Earlier quoted context omitted.
Compare this with an IDE highlighting this immediately when you write the offending line. In your workflow you have to run a test to identify this issue, then go back and fix it. It certainly doesn't leave you stuck but you are incurring additional overhead in that you actually have to run tests to discover there's a problem and then remediate it.
It's a marginal overhead and it also has the benefit of encouraging clear naming. Autocomplete is convenient but also removes some of the cost of poor naming. This is fine when you're writing code (the autocomplete just kicks in and you search for a method that seems about right) but it does nothing for the readability of your code.
Re: “Did you mean?” Experience in Ruby
#177Earlier quoted context omitted.
That has been tried before. Results were... poor. http://www.catb.org/~esr/jargon/html/D/DWIM.html
You are correct, but please don't refer to the bastardized version of the Jargon file. Wikipedia has a much better and more accurate article, with actual quotes and citations instead of unsourced politically motivated mythology attributed to "some victims": https://en.wikipedia.org/wiki/DWIM >Critics of DWIM claimed that it was "tuned to the particular typing mistakes to which Teitelman was prone, and no others" and…
Re: “Did you mean?” Experience in Ruby
#178Earlier quoted context omitted.
PyCharm's auto-complete is really nice. It seems to be the best Python editor going right now.
Really? I used Aptana, which includes the Pydev plugin. I notice everyone seems to give PyCharm lots of love, and have been tempted to try it. Autocomplete is one of the features I rely on heavily.
Re: “Did you mean?” Experience in Ruby
#179Obviously this is a useful tool, and all the power to the author for finding what looks to be an excellent solution, but this line bothers me: >>> Sometimes I wasted hours and hours just because there is one character difference. I hate it. This shouldn't happen. Ever. This should not be a problem anymore. These are the sort of errors that we can catch immediately and should be caught immediately. From looking at the…
Re: “Did you mean?” Experience in Ruby
#180Earlier quoted context omitted.
There is actually a python module that does something like that. It goes to the extreme to keep the program running no matter the error you make, arithmetic error are replaced with random results, missing functions skipped, exceptions silently swallowed etc etc. It is obviously a joke but they could benefit greatly from this feature ;)
For those who are interested, I'm pretty sure this is what you're referring to https://github.com/ajalt/fuckitpy . It's worth looking into for the documentation alone.
FuckIt.py uses state-of-the-art technology to make sure your Python
code runs whether it has any right to or not. Some code has an error? Fuck it.
FuckIt.py uses a combination of dynamic compilation, Abstract Syntax Tree
rewriting, live call stack modification, and love to get rid of all those
pesky errors that make programming so hard.
Still getting errors? Chain fuckit calls. This module is like violence:
if it doesn't work, you just need more of it.