3 ms·
Rubbish. Create a new library function that takes 'fruit' as a parameter. What methods are available on 'fruit'? The IDE can't help you; the contract is unspeci
by stickfigure 12y ago
Rubbish. Create a new library function that takes 'fruit' as a parameter. What methods are available on 'fruit'? The IDE can't help you; the contract is unspecified.
In addition to Java, I regularly write Python, Ruby, and Javascript using IDEA. The code navigation and code completion functions in those last three are utterly hopeless and fallback to grep-like behavior most of the time. Ruby deserves special mention because pretty much anything can get redefined at anytime anywhere. The poor IDE doesn't have a chance.
- taeric 12y agoAnd this is where things are kind of funny. You are, of course, correct in a major especially static sense. However, for many programs it is entirely conceivable that the IDE can tell you all of the members available on all objects that are actually passed to said function. Or, inverted, check that all of the necessary items are available on any item you call it with. Now, in dynamic languages this is typically done at runtime. That is kind of the whole point of dynamic runtimes; that you can hook into them. Curious what all properties are available on the object represented by a given symbol? Essentially, ask it. However, as computers get more and more powerful, this can be done by simulation statically for many programs. No, not all. Just many. Is it enough, though?
- tacos 12y ago(I don't think that's the whole point of dynamic languages. C++ has RTTI and .NET shipped with reflection as a fundamental construct...) I need to write code that talks to libraries today. I press dot and within 10 milliseconds I see an encyclopedic list of functions, complete with verifiable hints as to their structure. I type what looks like it makes sense, run the compiler that takes as much time to compile than python.exe takes to load, and a lot of the time, if the code compiles it just runs perfectly. I do not need to wade through verbose Doxygen boilerplate, nor page through source code, nor dance around fake json schemas. I do not need to write unit tests that, in many cases, serve merely to exercise the interpreter to make sure it hits everywhere I might have forgotten a parenthesis. It just friggin' works because a community has decided it's important to do things this way. So many of these "time-saving" languages are a full decade behind this reality. Right now it's definitely not enough. There's 30 years of idiotic cruft behind Windows bitmaps and it's STILL faster and easier to resize a jpeg in C# than using the insane Python libraries. Meanwhile C++ got "auto" and C# got "var" and "dynamic." At that point I picked my winners, there are of course other options. And when I write a library, doing it this way just seems like basic human respect. Sure: you're welcome to the source and here are some lovely docs. But if the only way to say whether something takes a string or bytes and that it varies between Python 2.7 and 3.x is in a README file, something's gone wrong. Like environmentalism we need to look at "total cost" before we declare something a net savings of energy.
- taeric 12y agoThis is a method of programming that just doesn't work for me. If I am at the point where I don't have a good idea of what functions I will be using, than the "encyclopedic list of functions" is just not going to be a help. Often, I find I will just put together a fairly long list of things where a much shorter construct would have worked. Which is not to say it is bad that you do this. Just, to each their own. I'm much better served by working before getting to the keyboard. Other folks aren't.
- stickfigure 12y agoYou presume there is a runtime to be had. As a library developer I have no idea what else will be in the runtime and what objects could get passed into my function. Bigger projects need more modularization... and with each independently developed module, the contracts get fuzzier.
- taeric 12y agoThe thing I described would work just as well in library development. Though, yes, it would likely be easier to just describe some contracts at border points in a program. That is, the inverted method would allow a way to say what all has to be on any object that is passed to you. If they have more, so be it.