Today, after 15 weeks of hard work, I was finally able to hand in my Refactoring for Scala term project (its website is scala.ifs.hsr.ch, where you can also find the technical report). After a short break of four weeks, I will continue the project as my master’s thesis.
What has been achieved so far? After investigating the Scala compiler (nothing is more fun than learning a new language by reading it compiler’s source code, trust me), I started to create with a foundation to build the refactorings on. Refactorings basically just transform an AST, which has to be converted back to plain text afterwards (which is far more complicated than it sounds, trust me). This occupied me for the larger part of the project, and it still isn’t finished, but I was able to come up with a scheme that allowed me to leave it in an unfinished state and still being able to perform refactorings, at least good enough for a proof-of-concept.
The implemented refactoring is Extract Method; a perfect candidate because it is not too simple (with regards to the code transformatioms) and it looks much more impressive than e.g. Rename. Is it already usable? I’m not sure, it has not been tested with a lot of real world code (and usually when I did, it didn’t take me long to find new bugs, or rather things that were not yet implemented), but that will certainly be done in the near future. Another hurdle to using it is that you would need to install my modified Eclipse Scala plug-in (and I haven’t yet been able to create a working nightly-build including the Eclipse plug-in and all my stuff that would be needed).
For the near future, i.e. before the thesis, the plan is to implement organize imports, so I can bribe Miles Sabin into including the refactoring library in the Eclipse Scala IDE. After that, I’ll continue the project with a 20 week full-time thesis (~800 hours of work), where I hope to stabilize the existing Extract Method, advance the library so it can be used by other developers without knowing the inner workings of it, and to provide many new refactorings!
In the mean time, I highly appreciate any feedback. And keep an eye on this blog or follow me on twitter to hear the latest about the project.