{"id":512,"date":"2009-12-20T14:55:32","date_gmt":"2009-12-20T12:55:32","guid":{"rendered":"http:\/\/misto.ch\/?p=100"},"modified":"2009-12-20T14:55:32","modified_gmt":"2009-12-20T12:55:32","slug":"extract-method-for-scala","status":"publish","type":"post","link":"https:\/\/misto.ch\/de\/2009\/12\/20\/extract-method-for-scala\/","title":{"rendered":"Extract Method for Scala"},"content":{"rendered":"<p>I haven&#8217;t blogged in quite a while now. Actually, the last entry was to announce my <a href=\"http:\/\/misto.ch\/scala-refactoring-term-project\/\">term project<\/a> on Scala Refactoring. My excuse is, I was hard at work! So without further ado:<\/p>\n<pre class=\"brush: scala; title: ; notranslate\" title=\"\">class Demo1 {\n  def demo1(i: Int): Int = {\n    val a = i\n    val b = a + i\n    b\n  }\n}<\/pre>\n<p>Select the line with the assignment to b, <del datetime=\"2009-12-20T12:55:39+00:00\">murmur the incantation<\/del> press some keys, et voil\u00e0:<\/p>\n<pre class=\"brush: scala; title: ; notranslate\" title=\"\">class Demo1 {\n  def newMethod(i: Int, a: Int): Int = {\n    val b = a + i\n    b\n  }\n  def demo1(i: Int): Int = {\n    val a = i\n    val b = newMethod(i, a)\n    b\n  }\n}<\/pre>\n<p>It also works with multiple return values and when passing functions. Now, the code isn&#8217;t ready yet, and I have to concentrate on writing my report right now, so it might take a couple more weeks until I can ship something.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I haven&#8217;t blogged in quite a while now. Actually, the last entry was to announce my term project on Scala Refactoring. My excuse is, I was hard at work! So without further ado: class Demo1 { def demo1(i: Int): Int = { val a = i val b = a + i b } } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27,1],"tags":[37,38],"class_list":["post-512","post","type-post","status-publish","format-standard","hentry","category-infoq","category-scala","category-uncategorized","tag-refactoring","tag-scala"],"_links":{"self":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/comments?post=512"}],"version-history":[{"count":0,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/512\/revisions"}],"wp:attachment":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/media?parent=512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/categories?post=512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/tags?post=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}