{"id":5104,"date":"2011-11-07T13:06:06","date_gmt":"2011-11-07T12:06:06","guid":{"rendered":"http:\/\/www.itwriting.com\/blog\/5104-eclipse-and-xtend-some-confusion-in-getting-started.html"},"modified":"2011-11-07T13:06:06","modified_gmt":"2011-11-07T12:06:06","slug":"eclipse-and-xtend-some-confusion-in-getting-started","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/5104-eclipse-and-xtend-some-confusion-in-getting-started.html","title":{"rendered":"Eclipse and Xtend: some confusion in getting started"},"content":{"rendered":"<p>Last weekend there was some publicity around Xtend, an Eclipse project which extends Java with new language features. Xtend now has a <a href=\"http:\/\/xtend-lang.org\/\" target=\"_blank\">new landing page<\/a>, as <a href=\"http:\/\/blog.efftinge.de\/2011\/11\/new-xtend-website.html\" target=\"_blank\">announced<\/a> by the lead architect Sven Efftinge.<\/p>\n<p>I did intend to post about this yesterday, but I wanted to see it in action first, so I tried to download it and have a look. I believe this is a case where those who wrote the new landing page are too close to the project and made some assumptions, because I did not find it obvious how to proceed. <\/p>\n<p>If you follow the Download link you are invited to paste one of the three URLs into the Eclipse update manager.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb10.png\" width=\"404\" height=\"72\" \/><\/a><\/p>\n<p>As a newcomer to the project, I did not want three URLs to choose from, I wanted just one. I picked Release as in general this one is likely to work.<\/p>\n<p>Now, the instructions say:<\/p>\n<blockquote>\n<p>To install the Xtend plugins open the update manager and paste one of the URLs on the right into the field &#8216;Work with&#8217; and select the Xtend SDK.<\/p>\n<\/blockquote>\n<p>The update manager actually presents you with a long list of updates, none of which say Xtend. I took a stab at what I thought was the right thing.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb11.png\" width=\"404\" height=\"490\" \/><\/a><\/p>\n<p>The All-In-One includes the Xtend SDK, which is what I want, right? <\/p>\n<p>Wrong. After installation I could not find the tutorial which the docs said would be available. <\/p>\n<p>I did some messing around with Eclipse and got the occasional error like this one:<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image12.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb12.png\" width=\"244\" height=\"231\" \/><\/a><\/p>\n<p>Then I realised that I should have looked under the TMF Xtext-2.1.0 tree, which is where the correct Xtend SDK resides:<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image13.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb13.png\" width=\"334\" height=\"294\" \/><\/a><\/p>\n<p>Except that if you find this <a href=\"http:\/\/nexnet.wordpress.com\/2011\/11\/06\/xtend-tutorial\/\" target=\"_blank\">helpful post<\/a> by&#160; Max Rohde you will know:<\/p>\n<blockquote>\n<p>The other packages need to be selected since otherwise the Xtend editors will not work.<\/p>\n<\/blockquote>\n<p>So you should select all of TMF Xtext-2.1.0 (or the latest release). Easy when you know, but not obvious since the word Xtend does not appear in the top node of the tree.<\/p>\n<p>I was then able to create the tutorial project. I opened HelloWorld.xtend and got this:<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb14.png\" width=\"301\" height=\"294\" \/><\/a><\/p>\n<p>Ah, but you have read Rohde\u2019s post so you know this is expected and that you should run this as a JUnit Test. However it does not have any output. To see some output, you have to run one of the other examples, like Xtend08_RichStrings, or perhaps add:<\/p>\n<p>sayHelloToSystemOut2(&#8216;Tim&#8217;)<\/p>\n<p>to the testHelloWorld() method in HelloWorld.xtend.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image15.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb15.png\" width=\"244\" height=\"212\" \/><\/a><\/p>\n<p>OK, it works.<\/p>\n<p>So what is Xtend? It is essentially a code generator which lets you write in Xtend and generate Java. You can see the generated code in the tutorial project under xtend-gen.<\/p>\n<p><a href=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image16.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2011\/11\/image_thumb16.png\" width=\"244\" height=\"130\" \/><\/a><\/p>\n<p>Xtend adds some nice features: type inference, property syntax, closures, switch expressions with no fall-through, template expressions, extension methods, and multiple dispatch. <\/p>\n<p>I can imagine C# creator Anders Hejlsberg smiling here, as most of this is already in C# in some form or other.<\/p>\n<p>But is Xtend the right way to bring these features to Java? I am not convinced so far. It is an interesting Eclipse project, but it may be more significant in speeding the implementation of features like these into Java itself, than as a mainstream approach to writing applications. Xtend is a kind of hybrid approach, where you will be switching between Java and Xtend while you code and debug your application, and I suspect it would get frustrating. <\/p>\n<p>There is also the question of widespread community support &#8211; beyond Eclipse.<\/p>\n<p>Finally, it would be good if the new landing page could be made more helpful for those getting started.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last weekend there was some publicity around Xtend, an Eclipse project which extends Java with new language features. Xtend now has a new landing page, as announced by the lead architect Sven Efftinge. I did intend to post about this yesterday, but I wanted to see it in action first, so I tried to download &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/5104-eclipse-and-xtend-some-confusion-in-getting-started.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Eclipse and Xtend: some confusion in getting started<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,29,49,67,80],"tags":[356,512,1056],"class_list":["post-5104","post","type-post","status-publish","format-standard","hentry","category-development","category-eclipse","category-java","category-professional","category-software-development","tag-eclipse","tag-java","tag-xtend"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/5104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=5104"}],"version-history":[{"count":0,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/5104\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=5104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=5104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=5104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}