<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mirko Stocker&#039;s Blog &#187; Scala</title>
	<atom:link href="http://misto.ch/tag/scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://misto.ch</link>
	<description></description>
	<lastBuildDate>Fri, 04 May 2012 18:00:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Detecting and Naming Boolean Parameters</title>
		<link>http://misto.ch/detecting-and-naming-boolean-parameters/</link>
		<comments>http://misto.ch/detecting-and-naming-boolean-parameters/#comments</comments>
		<pubDate>Fri, 04 May 2012 18:00:25 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[code analysis]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=404</guid>
		<description><![CDATA[After a recent discussion on the Scala-Internals mailing list on the pros and cons of methods that take boolean arguments, the consensus was that they should always be passed as named arguments. The compiler doesn&#8217;t enforce this, so it&#8217;s up to us IDE and tools developers to provide a solution. The code-analysis branch for the Eclipse Scala [...]]]></description>
			<content:encoded><![CDATA[<p>After a <a href="https://groups.google.com/forum/#!msg/scala-internals/5VhsT3PhcSg/4TWXKA3XuuUJ">recent discussion on the Scala-Internals mailing list</a> on the pros and cons of methods that take boolean arguments, the consensus was that they should always be passed as named arguments. The compiler doesn&#8217;t enforce this, so it&#8217;s up to us IDE and tools developers to provide a solution. The code-analysis branch for the Eclipse Scala IDE can now warn you of such boolean arguments that are passed to Scala methods:</p>
<p><a href="http://misto.ch/wp-content/unnamed_bool_11.png"><img class="aligncenter size-full wp-image-409" title="unnamed_bool_1" src="http://misto.ch/wp-content/unnamed_bool_11.png" alt="" width="453" height="169" /></a></p>
<p>The warning comes with a quick-fix that inserts the parameter name:</p>
<p><a href="http://misto.ch/wp-content/unnamed_bool_2.png"><img class="aligncenter size-full wp-image-406" title="unnamed_bool_2" src="http://misto.ch/wp-content/unnamed_bool_2.png" alt="" width="433" height="197" /></a></p>
<p><a href="http://misto.ch/wp-content/unnamed_bool_3.png"><img class="aligncenter size-full wp-image-407" title="unnamed_bool_3" src="http://misto.ch/wp-content/unnamed_bool_3.png" alt="" width="447" height="160" /></a></p>
<p>Of course, the competition isn&#8217;t sleeping either, the IntelliJ Scala plug-in just got a <a href="http://blog.jetbrains.com/scala/2012/05/04/new-intentions/">bunch of new Intentions</a>.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/detecting-and-naming-boolean-parameters/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/detecting-and-naming-boolean-parameters/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Quickfix to Expand Case-Class Bindings in Pattern Matching</title>
		<link>http://misto.ch/expand-case-class-bindings-in-pattern-matching/</link>
		<comments>http://misto.ch/expand-case-class-bindings-in-pattern-matching/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 20:03:05 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[Scala]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=365</guid>
		<description><![CDATA[When writing Scala code that involves pattern matching I often work with (nested) case classes and sequences of case classes. I usually start with a simple binding like this and then when I need to access members of the matched class convert it to use the extractor: What&#8217;s tedious about that step is that one [...]]]></description>
			<content:encoded><![CDATA[<p>When writing Scala code that involves pattern matching I often work with (nested) case classes and sequences of case classes. I usually start with a simple binding like this</p>
<pre class="brush: scala; title: ; notranslate">
case class Person(firstName: String, lastName: String)

List(Person(&quot;Mirko&quot;, &quot;Stocker&quot;)) match {
  case person :: Nil =&gt;; ...
}
</pre>
<p>and then when I need to access members of the matched class convert it to use the extractor:</p>
<pre class="brush: scala; title: ; notranslate">
List(Person(&quot;Mirko&quot;, &quot;Stocker&quot;)) match {
  case Person(firstName, lastName) :: Nil =&gt; ...
}
</pre>
<p>What&#8217;s tedious about that step is that one needs to know how many arguments there are and name all the bindings. But not for much longer! I wrote a quick-fix for the Scala IDE that does this for you:</p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_1.png"><img class="size-full wp-image-375 alignleft" title="expand_case_class_binding_1" src="http://misto.ch/wp-content/expand_case_class_binding_1.png" alt="" width="495" height="123" /></a></p>
<p>Ctrl+1 brings up the available quick fixes:</p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_2.png"><img class="size-full wp-image-376 alignleft" title="expand_case_class_binding_2" src="http://misto.ch/wp-content/expand_case_class_binding_2.png" alt="" width="512" height="219" /></a></p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_3.png"><img class="size-full wp-image-377 alignleft" title="expand_case_class_binding_3" src="http://misto.ch/wp-content/expand_case_class_binding_3.png" alt="" width="497" height="104" /></a></p>
<p>And this is what happens when the binding you&#8217;re expanding is used in the pattern&#8217;s body:</p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_4.png"><img class="size-full wp-image-378 alignleft" title="expand_case_class_binding_4" src="http://misto.ch/wp-content/expand_case_class_binding_4.png" alt="" width="495" height="108" /></a></p>
<p>It also works if you use a typed pattern where the type is a case class:</p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_5.png"><img class="alignleft size-full wp-image-379" title="expand_case_class_binding_5" src="http://misto.ch/wp-content/expand_case_class_binding_5.png" alt="" width="511" height="93" /></a></p>
<p><a href="http://misto.ch/wp-content/expand_case_class_binding_6.png"><img src="http://misto.ch/wp-content/expand_case_class_binding_6.png" alt="" title="expand_case_class_binding_6" width="504" height="113" class="alignleft size-full wp-image-387" /></a></p>
<p>This feature isn&#8217;t in the recently released <a href="http://scala-ide.org/blog/release-notes-2.1-Milestone-1.html">Milestone 1</a>, but it should be part of the next one (or one of the upcoming <a href="http://scala-ide.org/download/nightly.html">nightly builds</a>). Suggestions for a better wording &ndash; expand case class binding &ndash; are welcome <img src='http://misto.ch/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/expand-case-class-bindings-in-pattern-matching/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/expand-case-class-bindings-in-pattern-matching/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Move Class, Object and Trait Refactoring for Scala</title>
		<link>http://misto.ch/move-class-for-scala/</link>
		<comments>http://misto.ch/move-class-for-scala/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 06:51:00 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=311</guid>
		<description><![CDATA[After lots of bug fixing and improvements of existing refactorings in the Scala IDE, I took a few days off between Christmas and New Year to finally implement a completely new refactoring: Move Class. Move Class (see Fowler&#8217;s description if you&#8217;re unfamiliar with it) moves a top-level Class, Object or Trait definition into a different [...]]]></description>
			<content:encoded><![CDATA[<p>After lots of bug fixing and improvements of existing refactorings in the Scala IDE, I took a few days off between Christmas and New Year to finally implement a completely new refactoring: Move Class. </p>
<p>Move Class (see <a href="http://martinfowler.com/refactoring/catalog/moveClass.html">Fowler&#8217;s description</a> if you&#8217;re unfamiliar with it) moves a top-level Class, Object or Trait definition into a different package. And if there exists more than one declaration in the file, you can choose to split-off one of the declarations or to move them all. The refactoring will move all the necessary imports along, and also update all the references to the moved implementation (other imports, or qualified names) in the project.</p>
<p>The refactoring can either be invoked from the menu, or by drag-and-dropping a file in the Package Explorer. Here are some screenshots of the refactoring in action:</p>
<p><a href="http://misto.ch/wp-content/move_class_1.png"><img class="aligncenter size-full wp-image-318" title="move_class_1" src="http://misto.ch/wp-content/move_class_1.png" alt="" width="600" height="519" /></a></p>
<p>It&#8217;s also possible to create a new package during the refactoring:</p>
<p><a href="http://misto.ch/wp-content/move_class_3.png"><img src="http://misto.ch/wp-content/move_class_3.png" alt="" title="move_class_3" width="500" class="aligncenter size-full wp-image-322" /></a></p>
<p>As usual, the changes can be previewed. In this case, the class is removed from the original source file and an import is added to its new location:</p>
<p><a href="http://misto.ch/wp-content/move_class_4.png"><img src="http://misto.ch/wp-content/move_class_4.png" alt="" title="move_class_4" width="620" class="aligncenter size-full wp-image-326" /></a></p>
<p>Looking at the created file, we see the changed package declaration (a copyright notice in the original file would also have been copied along to the new file) and some imports to types of the originating package:</p>
<p><a href="http://misto.ch/wp-content/move_class_5.png"><img src="http://misto.ch/wp-content/move_class_5.png" alt="" title="move_class_5" width="600" height="426" class="aligncenter size-full wp-image-333" /></a></p>
<p>There are a few limitations: the refactoring works only on Scala code, and it simply ignores visibility issues, so moving might result in compilation errors (cursory tests showed that this also happens in Eclipse JDT &#8212; my gold standard for refactoring implementations). </p>
<p>The Move refactoring will be part of the 2.1 release of the Scala IDE, for which there are <a href="http://scala-ide.org/download/nightly.html">nightly builds</a> available.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/move-class-for-scala/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/move-class-for-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Organizing Imports in Scala</title>
		<link>http://misto.ch/organizing-imports-in-scala/</link>
		<comments>http://misto.ch/organizing-imports-in-scala/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 09:27:55 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=273</guid>
		<description><![CDATA[Organize Imports was a very often requested feature for the Scala IDE for Eclipse, so I wrote the first very limited version as part of my thesis. It couldn&#8217;t do much more than sorting the imports and collapsing them from multiple import statements to a single one. At the beginning of this year, Daniel Ratiu [...]]]></description>
			<content:encoded><![CDATA[<p>Organize Imports was a very often requested feature for the Scala IDE for Eclipse, so I wrote the first very limited version as part of my thesis. It couldn&#8217;t do much more than sorting the imports and collapsing them from multiple import statements to a single one. At the beginning of this year, Daniel Ratiu provided a patch that made Organize Imports recognize some of the unused imports.</p>
<p>One limitation we still had was that we didn&#8217;t really know the complete set of required imports, but this is required to, for example, replace all wildcard imports with the actually used ones. Another request was that it should be possible to push import statements down to the scope where they are used. For this, we also need to know which parts of the code require which imports.</p>
<p>Yet another motivation to write some code to analyze dependencies was that I want to provide a move refactoring, and for this too we need to know some of the dependencies in the code. But that&#8217;s for a future post, back to what we have now:</p>
<p><a href="http://misto.ch/wp-content/organize-imports-configuration.png"><img class="alignnone size-full wp-image-276" title="organize-imports-configuration" src="http://misto.ch/wp-content/organize-imports-configuration.png" alt="" width="552" height="421" /></a></p>
<p>As you can see, just like the JDT, we can now configure grouping for imports (groups are separated by a blank line), and it&#8217;s possible to expand or collapse imports from the same package. The Scalaz or Lift users will likely want to always use wildcard imports on some packages and types, so this is also possible. The JDT has some additional options, but I think I implemented the important ones.</p>
<p>And there&#8217;s more! No, <a href="http://www.youtube.com/watch?v=tGvHNNOLnCk">not Reversi</a>, but if there are missing imports in the file, Organize Imports will add them for you:</p>
<p><a href="http://misto.ch/wp-content/organize-imports-missing.png"><img class="alignnone size-full wp-image-277" title="organize-imports-missing" src="http://misto.ch/wp-content/organize-imports-missing.png" alt="" width="468" height="321" /></a></p>
<p>This all is part of the<a href="http://www.scala-ide.org/2011/06/scala-ide-beta-6-available/"> latest beta release of the Scala IDE</a>, so please give it a try and <a href="http://scala-ide.assembla.com/">open a ticket</a> if you find a problem.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/organizing-imports-in-scala/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/organizing-imports-in-scala/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eliminating Pattern Matching</title>
		<link>http://misto.ch/eliminating-pattern-matching/</link>
		<comments>http://misto.ch/eliminating-pattern-matching/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 16:19:39 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=248</guid>
		<description><![CDATA[In the last few years, I worked on several Java projects where we transformed and analyzed abstract syntax trees, so when I started learning Scala, pattern-matching quickly became one of my favorite language features. I could never warm up to the visitor pattern, so I was thankful that Scala offered a much more powerful alternative. [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few years, I worked on several Java projects where we transformed and analyzed abstract syntax trees, so when I started learning Scala, pattern-matching quickly became one of my favorite language features. I could never warm up to the visitor pattern, so I was thankful that Scala offered a much more powerful alternative.</p>
<p>What I also liked very much was Scala&#8217;s consistent use of the <tt>Option</tt> type in its standard library. Now, instead of having to read the documentation to find out whether some call could return <tt>null</tt>, the type checker forced me to handle this where necessary. So a lot of my early Scala code looked as follows:</p>
<pre class="brush: scala; title: ; notranslate">
doSomething() match {
  case Some(value) =&gt; Some(doSomethingElse(value))
  case None =&gt; None
}
</pre>
<p>While it&#8217;s still possible to get a NPE in Scala, it just doesn&#8217;t happen with well-written libraries, simply because there&#8217;s no need to ever use <tt>null</tt>.</p>
<p>(By the way, isn&#8217;t it funny that Java forces you to check exceptions but doesn&#8217;t help you with the much more common and annoying <tt>null</tt> problem?)</p>
<p>So yes, in practice, <tt>Options</tt> do save you from NPEs. Does your code also get smaller (because usually, in Scala it will)? Not if you pattern match on <tt>Some</tt>/<tt>None</tt>, all the un-wrapping and lifting is quite verbose.</p>
<p>Nowadays, certainly influenced by all the discussions on monads, I realize that pattern-matching on <tt>Option</tt> is a very primitive  form of abstraction, and instead of the code above I now write:</p>
<pre class="brush: scala; title: ; notranslate">
doSomething() map (value =&gt; doSomethingElse(value))
</pre>
<p>(For those unfamiliar with functional programming, <tt>map</tt> applies the function to the value inside a <tt>Some</tt>, and does nothing when called on a <tt>None</tt>.)</p>
<p>Even better, we can fully automate this refactoring! I&#8217;m currently working on a first version in the scala-refactoring library. So far, I&#8217;ve implemented the refactoring for map, but there are many more we can do, for example:</p>
<ul>
<li>If the <tt>Some</tt> case does not construct a <tt>Some</tt> but calls a function that returns an <tt>Option</tt>, we use <tt>flatMap</tt> instead of <tt>map</tt>.</li>
<li>If the <tt>Some</tt> case evaluates to <tt>Boolean</tt> and the <tt>None</tt> case returns <tt>false</tt>, we can replace it with <tt>exists</tt>. If <tt>Some</tt> returns <tt>true</tt> and <tt>None</tt> returns <tt>false</tt>, we can just replace the whole pattern match with <tt>isDefined</tt>.</li>
<li>When the <tt>None</tt> case is <tt>()</tt>, we can transform to <tt>foreach</tt>.</li>
</ul>
<p>So far we have only looked at <tt>Option</tt>, but there is more: for example, we could also replace pattern-matching on lists and recursion with folds. I&#8217;m sure somebody has already written a paper about such refactorings, but I haven&#8217;t found anything yet.</p>
<p>What do you think about eliminating pattern matching? Do you also prefer mapping to explicit pattern-matching?</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/eliminating-pattern-matching/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/eliminating-pattern-matching/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Plans for 2011</title>
		<link>http://misto.ch/plans-for-2011/</link>
		<comments>http://misto.ch/plans-for-2011/#comments</comments>
		<pubDate>Sat, 01 Jan 2011 18:00:02 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=236</guid>
		<description><![CDATA[I originally wanted to write a review of 2010 here, but by now I definitely missed the deadline for year-end-retrospectives, so I&#8217;m going to make this about my plans for 2011. I&#8217;ve spent a large portion of last year on the Scala Refactoring project, and I&#8217;m quite happy with the results: four editors/IDEs are using [...]]]></description>
			<content:encoded><![CDATA[<p>I originally wanted to write a review of 2010 here, but by now I definitely missed the deadline for year-end-retrospectives, so I&#8217;m going to make this about my plans for 2011.</p>
<p>I&#8217;ve spent a large portion of last year on the <a href="http://scala-refactoring.org">Scala Refactoring</a> project, and I&#8217;m quite happy with the results: four editors/IDEs are using the library to do refactoring, plus others use parts of it to manipulate or generate Scala source code.</p>
<p>It&#8217;s clear that I cannot continue investing as much time into it as during my master thesis (except of course, if someone would be willing to sponsor me <img src='http://misto.ch/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). My plan for this year is to find at least half a day per week to continue writing new refactorings and improving the existing code. One idea I originally had with the refactoring library hasn&#8217;t played out yet: getting others to create new refactorings. It&#8217;s really <a href="https://www.assembla.com/code/scala-refactoring/git/nodes/org.scala-refactoring.library/src/main/scala/scala/tools/refactoring/implementations?rev=57a6bbb87e8680d64e554611837ab8bbc35fd07c">not that hard</a>! So give it a try if you have an idea for a refactoring you want to automate.</p>
<p>Besides working on the refactoring library, I also really want to get back to writing for InfoQ. Speaking of InfoQ, I&#8217;m looking forward to <a href="http://qconlondon.com/">QCon London in March</a>!</p>
<p>Now, enough with the blogging &ndash; there are some bugs in Organize Imports I need to fix <img src='http://misto.ch/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  A happy new year to all of you!</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/plans-for-2011/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/plans-for-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scala IDE at Eclipse Summit Europe 2010</title>
		<link>http://misto.ch/eclipse-summit-europe-2010/</link>
		<comments>http://misto.ch/eclipse-summit-europe-2010/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 16:28:17 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[talk]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=223</guid>
		<description><![CDATA[It seems to be customary to announce his Eclipse Summit talk in blogs, so here&#8217;s mine: My talk will of course be on the Scala IDE for Eclipse: This talk introduces the Scala IDE for Eclipse, the obvious choice for all Eclipse users who want to write Scala code. We are going to both take [...]]]></description>
			<content:encoded><![CDATA[<p>It seems to be customary to announce his Eclipse Summit talk in blogs, so here&#8217;s mine:</p>
<p><a href="http://www.eclipsecon.org/summiteurope2010/sessions/?page=sessions&#038;id=1777"><img src="http://misto.ch/wp-content/speaking-ese.gif"/></a></p>
<p>My talk will of course be on the <a href="http://www.eclipsecon.org/summiteurope2010/sessions/?page=sessions&#038;id=1777">Scala IDE for Eclipse</a>:</p>
<blockquote><p>This talk introduces the Scala IDE for Eclipse, the obvious choice for all Eclipse users who want to write Scala code. We are going to both take a look at the features the IDE currently provides as well as a glance under the hood.</p></blockquote>
<p>So if you&#8217;re at ESE and want to know more about the Scala IDE for Eclipse, <a href="http://www.eclipsecon.org/summiteurope2010/table/?page=table&#038;date=2010-11-04">visit me on Thursday</a>, just before lunch.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/eclipse-summit-europe-2010/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/eclipse-summit-europe-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scala Refactoring Thesis Finished</title>
		<link>http://misto.ch/scala-refactoring-thesis-finished/</link>
		<comments>http://misto.ch/scala-refactoring-thesis-finished/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 15:01:45 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=181</guid>
		<description><![CDATA[I&#8217;m done! A few minutes ago, I handed in my thesis on Scala Refactoring. The project also has a new home at scala-refactoring.org, where you can find more about the refactorings I implemented, how they can be used, etc. I also recommend reading my report, but if you just want an overview, take a look [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m done! A few minutes ago, I handed in my thesis on Scala Refactoring.</p>
<p>The project also has a new home at <a href="http://scala-refactoring.org">scala-refactoring.org</a>, where you can find more about the refactorings I implemented, how they can be used, etc. I also recommend reading <a href="http://scala-refactoring.org/wp-content/uploads/scala-refactoring.pdf">my report</a>, but if you just want an overview, take a look at the poster:</p>
<p><a href="http://misto.ch/wp-content/poster.png"><img class="alignnone size-medium wp-image-182" title="poster" src="http://misto.ch/wp-content/poster-300x212.png" alt="" width="300" height="212" /></a></p>
<p>The next steps for me now are to go on holidays, so please excuse if I don&#8217;t respond for a week.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/scala-refactoring-thesis-finished/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/scala-refactoring-thesis-finished/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Scala Refactoring Talk at Scala Days 2010</title>
		<link>http://misto.ch/scala-refactoring-talk-at-scala-days-2010/</link>
		<comments>http://misto.ch/scala-refactoring-talk-at-scala-days-2010/#comments</comments>
		<pubDate>Mon, 03 May 2010 15:30:04 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=156</guid>
		<description><![CDATA[My talk at Scala Days 2010 is now available online: And don&#8217;t forget to take a look at the other talks.]]></description>
			<content:encoded><![CDATA[<p>My talk at Scala Days 2010 is now available online:</p>
<p><a href="http://days2010.scala-lang.org/node/138/141" target="_new"><img src="http://misto.ch/wp-content/scala_refactoring_talk_screenshot.png" alt="" title="scala_refactoring_talk_screenshot" width="580"  class="alignnone size-full wp-image-157" /></a></p>
<p>And don&#8217;t forget to take a look at <a href="http://days2010.scala-lang.org/node/136">the other talks</a>.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/scala-refactoring-talk-at-scala-days-2010/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/scala-refactoring-talk-at-scala-days-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Eclipse Plug-ins Written in Scala with Maven/Tycho</title>
		<link>http://misto.ch/eclipse-plugins-scala-maventycho/</link>
		<comments>http://misto.ch/eclipse-plugins-scala-maventycho/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:40:04 +0000</pubDate>
		<dc:creator>Mirko Stocker</dc:creator>
				<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://misto.ch/?p=140</guid>
		<description><![CDATA[The Scala Refactoring project currently uses a rather crude hand-written ant build file; it compiles and runs tests. What it doesn&#8217;t do is creating a proper OSGi bundle, which I need if I want to do proper releases and integrate it into the Scala Eclipse IDE. Most of my colleagues are using PDE build, but [...]]]></description>
			<content:encoded><![CDATA[<p>The Scala Refactoring project currently uses a rather crude hand-written ant build file; it compiles and runs tests. What it doesn&#8217;t do is creating a proper OSGi bundle, which I need if I want to do proper releases and integrate it into the Scala Eclipse IDE. Most of my colleagues are using PDE build, but from what I&#8217;ve heard, <a href="http://www.eclipse.org/buckminster/">Buckminster</a> or <a href="http://tycho.sonatype.org/">Maven/Tycho</a> are the way to go.</p>
<p>Buchminster looks rather complex to me, so I went with Maven, even though I had no prior experience with it. Now, a few hours later, I have a <em>Hello World</em> plug-in written in Scala and a bunch of poms that build everything I want, even an update site! </p>
<p>Tycho needs Maven 3, which hasn&#8217;t been released yet, so I downloaded the latest <a href="http://maven.apache.org/download.html">alpha build</a> and created an alias that pointed to the mvn binary.</p>
<p>I started with <a href="http://mattiasholmqvist.se/2010/02/building-with-tycho-part-1-osgi-bundles/">Mattias Holmqvist&#8217;s Blog</a> where he explains how to create the initial Maven configuration and an OSGi bundle in Eclipse (I created a Hello World Plug-in Project). Now, we don&#8217;t want to have a Java plug-in but one written in Scala, so I added the Scala Nature to the project and re-wrote the two generated files in Scala.</p>
<p>To add Scala functionality to my pom, I followed the <a href="http://code.google.com/p/esmi/wiki/CreatingScalaMavenProjectsInEclipse">Eclipse Scala Maven Integration wiki</a>. I also had to add the Scala Eclipse Plug-in nightly build update site to my list of repositories so Maven could resolve the <em>scala.library</em> dependency the project has. </p>
<pre class="brush: xml; title: ; notranslate">    &lt;repository&gt;
       &lt;id&gt;scala eclipse nightly&lt;/id&gt;
       &lt;layout&gt;p2&lt;/layout&gt;
       &lt;url&gt;http://download.scala-ide.org/scala-eclipse-toolchain-osgi-2.9.1.final/&lt;/url&gt;
    &lt;/repository&gt;
</pre>
<p>Because I apparently didn&#8217;t follow Maven&#8217;s source layout, I had to explicitly specify the source directory via:
<pre class="brush: xml; title: ; notranslate">&lt;sourceDirectory&gt;${basedir}/src&lt;/sourceDirectory&gt;</pre>
<p>Adding the update site and feature projects was a peace of cake when following <a href="http://tycho.sonatype.org/how-to-create-a-new-osgi-bundle.html">this tutorial</a> (scroll to <em>Creating an Update Site / P2 repository</em>) from the Tycho project.</p>
<p>I&#8217;ve put the whole project on <a href="http://github.com/misto/Scala-Hello-World-Plug-in">GitHub</a> so you can try it yourself. And remember, this is my first day with Maven, so if I could make the poms even smaller or more idiomatic, please tell me. Or even better, just fork my code!</p>
<p>Next I&#8217;m going to find out how to run unit tests and how the integration in Hudson works, and then I can migrate the Scala Refactoring project and delete a build.xml file.</p>
<p><strong>Update April 2012:</strong> I&#8217;ve updated the <a href="https://github.com/misto/Scala-Hello-World-Plug-in">sample repository</a> to the latest versions of Scala, Eclipse and Maven-Tycho.</p>
<div class="plus-one-wrap"><g:plusone href="http://misto.ch/eclipse-plugins-scala-maventycho/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://misto.ch/eclipse-plugins-scala-maventycho/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

