This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Why is current Scala refactoring support poor in IDE?

9 replies
Julien Richard-Foy
Joined: 2011-04-24,
User offline. Last seen 42 years 45 weeks ago.

I’ve read a David Pollack rant, saying that Scala refactoring support
could never be good. Is it true? I can’t figure why it should be the
case. Could you explain me (or post links to explainations) what makes
Scala code more difficult to refactor than Java code?

channingwalton
Joined: 2008-09-27,
User offline. Last seen 2 weeks 1 day ago.
Re: Why is current Scala refactoring support poor in IDE?
Might be worth asking this question on scala-debate: https://groups.google.com/forum/#!forum/scala-debate
I don't know the answer :/
gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Re: Why is current Scala refactoring support poor in IDE?
On 17 September 2011 19:31, Julien Richard-Foy <julien [dot] rf [at] gmail [dot] com> wrote:
I’ve read a David Pollack rant, saying that Scala refactoring support
could never be good. Is it true? I can’t figure why it should be the
case. Could you explain me (or post links to explainations) what makes
Scala code more difficult to refactor than Java code?

Julien,
It would help to post a link to resource you are referring to and quote specific points.
In general: I happen to sit next to guys working hard on Scala IDE for Eclipse plugin. My observation is that Scala as a language doesn't pose that many problems. Most of the time being spent these days is on improving interoperability with Java in graceful way given the fact that Eclipse doesn't provide any sensible APIs for implementing such functionality.
That's where weeks of work are put and not on supporting Scala language. That's the job of scala compiler and it does it pretty well.

--
Grzegorz Kossakowski

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Why is current Scala refactoring support poor in IDE?

On Sat, Sep 17, 2011 at 14:31, Julien Richard-Foy wrote:
> I’ve read a David Pollack rant, saying that Scala refactoring support
> could never be good. Is it true? I can’t figure why it should be the
> case. Could you explain me (or post links to explainations) what makes
> Scala code more difficult to refactor than Java code?

I think David is plain wrong. I'm guessing he alludes to the fact that
just parsing Scala with a grammar is not enough to make decisions
about refactoring, since there might be implicits in scope that become
out of scope once the refactoring takes place.

If you take a look at the leading refactoring project,
http://scala-refactoring.org/, you'll see, however, that it simply
relies on the compiler to produce the AST that will be used in the
refactoring.

Julien Richard-Foy
Joined: 2011-04-24,
User offline. Last seen 42 years 45 weeks ago.
Re: Why is current Scala refactoring support poor in IDE?

On Sep 17, 11:26 pm, Grzegorz Kossakowski
wrote:
> It would help to post a link to resource you are referring to and quote
> specific points.

You're right, here is the article: http://goodstuff.im/yes-virginia-scala-is-hard

That said, he does not show theoretical evidence explaining why Scala
code should be hard to refactor.

Thanks for your replies, I was wondering if there were kind of
intrinsic limitations, due to Scala nature, but it does not seem to be
the case.

Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Why is current Scala refactoring support poor in IDE?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/2011 11:11 AM, Julien Richard-Foy wrote:
> On Sep 17, 11:26 pm, Grzegorz Kossakowski
> wrote:
>> It would help to post a link to resource you are referring to and quote
>> specific points.
>
> You're right, here is the article: http://goodstuff.im/yes-virginia-scala-is-hard

Take it as "made up stuff."

>
> That said, he does not show theoretical evidence explaining why Scala
> code should be hard to refactor.

I can show strong theoretical evidence, supported by academic research,
that Scala code would be easier to refactor.

daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 14 hours ago.
Re: Re: Why is current Scala refactoring support poor in IDE?

Basically, David is wrong. As Tony said, Scala should be *easier* to refactor than most other languages, it simply hasn't had the same amount of work put into it as Java has.

The reason for it being easier is two fold. First, Scala has a much stronger and more expressive type system than most languages. This gives a refactoring tool more information to work with. Second, and even more importantly, well-written Scala code tends to be pure, or very nearly purely functional. By definition, pure code is *vastly* easier to restructure, automatically or otherwise.

Daniel

On Sep 17, 2011, at 8:43 PM, "Tony Morris" wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 09/18/2011 11:11 AM, Julien Richard-Foy wrote:
>> On Sep 17, 11:26 pm, Grzegorz Kossakowski
>> wrote:
>>> It would help to post a link to resource you are referring to and quote
>>> specific points.
>>
>> You're right, here is the article: http://goodstuff.im/yes-virginia-scala-is-hard
>
> Take it as "made up stuff."
>
>>
>> That said, he does not show theoretical evidence explaining why Scala
>> code should be hard to refactor.
>
> I can show strong theoretical evidence, supported by academic research,
> that Scala code would be easier to refactor.
>
>
> - --
> Tony Morris
> http://tmorris.net/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJOdUzMAAoJEPxHMY3rBz0P07IH/jpeKhtmapXXuOA4tfLqsx1Q
> ja1kPkz4wuP9Da8zXqFltfTegoHXmmnqOck+sOSY3yYTBL9JzaCRSXWfTJcsRFwC
> Dr6aZe2ccIXB3QXrr27C9b3GMaEMftwr8SY2C+fgZvAbaXGefRLrOS54ndW4ObIb
> iRMyOMcAULQpZdRJbngGO8Cp1IrrGqz5VJTcCzmxSthq/SXYVWY7rJ10kTvilBri
> wVEd5KFOwKEwPtPpt3Xb96qzijxT46gDGzepSmhA1sFkR+wyG3JE4T+wY1YBuSuh
> 3WOSJHw8fPGr9M7nFFlFKRdniyR48Vb/jbN2iqm+ddOoyKPD+8QnaLP1zHHyIjA=
> =zcXw
> -----END PGP SIGNATURE-----

ATL-Recruiter
Joined: 2011-07-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Why is current Scala refactoring support poor in IDE?

Unsubscribe

On Sep 17, 2011 9:11 PM, "Julien Richard-Foy" <julien [dot] rf [at] gmail [dot] com> wrote:
> On Sep 17, 11:26 pm, Grzegorz Kossakowski
> <grzegorz [dot] kossakow [dot] [dot] [dot] [at] gmail [dot] com> wrote:
>> It would help to post a link to resource you are referring to and quote
>> specific points.
>
> You're right, here is the article: http://goodstuff.im/yes-virginia-scala-is-hard
>
> That said, he does not show theoretical evidence explaining why Scala
> code should be hard to refactor.
>
> Thanks for your replies, I was wondering if there were kind of
> intrinsic limitations, due to Scala nature, but it does not seem to be
> the case.
Adam Jorgensen
Joined: 2011-04-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Why is current Scala refactoring support poor in IDE?
IDEA doesn't seem to do too bad a job, although I did notice that refactoring a whole package to reside beneath another package didn't correctly update the package declarations in thesource files. But that may be already fixed...

On 18 September 2011 18:01, Shaun Sorrells <sorrells97 [at] gmail [dot] com> wrote:

Unsubscribe

On Sep 17, 2011 9:11 PM, "Julien Richard-Foy" <julien [dot] rf [at] gmail [dot] com> wrote:
> On Sep 17, 11:26 pm, Grzegorz Kossakowski
> <grzegorz [dot] kossakow [dot] [dot] [dot] [at] gmail [dot] com> wrote:
>> It would help to post a link to resource you are referring to and quote
>> specific points.
>
> You're right, here is the article: http://goodstuff.im/yes-virginia-scala-is-hard
>
> That said, he does not show theoretical evidence explaining why Scala
> code should be hard to refactor.
>
> Thanks for your replies, I was wondering if there were kind of
> intrinsic limitations, due to Scala nature, but it does not seem to be
> the case.

Mirko Stocker
Joined: 2009-09-10,
User offline. Last seen 45 weeks 6 days ago.
Re: Why is current Scala refactoring support poor in IDE?

On Saturday 17 September 2011 19:37:05 Daniel Sobral wrote:
> If you take a look at the leading refactoring project,
> http://scala-refactoring.org/, you'll see, however, that it simply
> relies on the compiler to produce the AST that will be used in the
> refactoring.

As the author of scala-refactoring.org, I'd like to add a few things. I don't
think that creating refactorings for Scala is much harder than for Java,
things like type inference are irrelevant because I can access the AST of the
compiler with all types inferred. Scala's syntax is more flexible than Java
(semicolon inference, operator notation), so that makes code generation a bit
harder, but not that much.

If we look at a concrete refactoring, like Extract Method, then that's
actually easier to implement in Scala because we can return several values.
And we can nest methods, which also makes the refactoring more flexible. On the
other hand, implicit values that need to be passed to the extracted method
might make the refactoring more complex again, but in the end, I'm quite
certain that refactoring Scala isn't harder than Java. Do you have a specific
refactoring in mind that you'd like to discuss?

I've also created one of the first refactoring tools for Ruby (), and I can
tell you, that's much much harder because the language is not statically
typed, and languages like C++ with macros are also much harder than Scala, so
as a refactoring creator, I'm quiet happy with Scala and the tools (compiler)
it provides!

So, why aren't Scala's refactoring tools as powerful as Java's? That's easy:
we don't have enough people working on it :-) So if you want to contribute,
take a look at scala-refactoring.org.

Cheers,

Mirko

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland