Category Archives: eclipse

Eclipse and Xtend: some confusion in getting started

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 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.

If you follow the Download link you are invited to paste one of the three URLs into the Eclipse update manager.

image

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.

Now, the instructions say:

To install the Xtend plugins open the update manager and paste one of the URLs on the right into the field ‘Work with’ and select the Xtend SDK.

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.

image

The All-In-One includes the Xtend SDK, which is what I want, right?

Wrong. After installation I could not find the tutorial which the docs said would be available.

I did some messing around with Eclipse and got the occasional error like this one:

image

Then I realised that I should have looked under the TMF Xtext-2.1.0 tree, which is where the correct Xtend SDK resides:

image

Except that if you find this helpful post by  Max Rohde you will know:

The other packages need to be selected since otherwise the Xtend editors will not work.

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.

I was then able to create the tutorial project. I opened HelloWorld.xtend and got this:

image

Ah, but you have read Rohde’s 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:

sayHelloToSystemOut2(‘Tim’)

to the testHelloWorld() method in HelloWorld.xtend.

image

OK, it works.

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.

image

Xtend adds some nice features: type inference, property syntax, closures, switch expressions with no fall-through, template expressions, extension methods, and multiple dispatch.

I can imagine C# creator Anders Hejlsberg smiling here, as most of this is already in C# in some form or other.

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.

There is also the question of widespread community support – beyond Eclipse.

Finally, it would be good if the new landing page could be made more helpful for those getting started.

Appcelerator has released Titanium Studio, IDE for cross-platform mobile development

Appcelerator has released Titanium Studio, an IDE built with Aptana, the Eclipse-based IDE which the company acquired in January. It is an interesting products because it lets you build cross-platform mobile apps for Apple iOS, Google Android, and Blackberry, as well as desktop applications.

I downloaded the community edition and gave it a quick try. The download includes the Titanium SDK and is around 150MB.

Titanium Studio wanted to grab file associations for CSS, JS and PHP by default – but at least it asked first

image

I noticed lots of Python scripts getting installed. The install completed and I was up and running.

Running the IDE requires login, which seems intrusive. You can avoid this by going offline.

image

I created a new empty Android 2.2 project and got an error on first run. Required jarsigner not found. Required javac not found.

image

I fixed this by adding the JDK to the path and setting Java_home to the JDK; previously my Adobe CS5 install had set this to its own JRE install.

Next, I built a hello world application.

image

It feels like a version 1.0 release. When I clicked Run it started the emulator but did not run the app for some reason. A second run after the emulator had opened worked. Code Assist seems a bit hit or miss. There it tooltip help for some keywords, but too brief to be much use, and pressing F1 is unrewarding. No visual GUI designer. Finally, and this is purely a personal thing, the editor has a black background – something I will be sure to change soon.

Nevertheless, this is a step forward for Titanium and presuming the apps perform well I think it is significant and worth investigating.

Mobl: a new language for mobile applications, with Eclipse integration

It has gradually dawned on me that, contrary to first appearances, the Apple iPhone and iPad do come with a capable application runtime for those who would rather not tangle with Objective C; and one on which you can run applications without the hassle of negotiating the App Store. This runtime is the WebKit-based browser and JavaScript engine. This is for web apps of course; but as noted in my look at NS App Studio last week, you can blur the boundaries between web and local by creating a local shortcut and designing your app to work offline. Here is the Apple documentation, which notes:

Offline application support is available in iOS 2.1 and later and in Safari 4.0 and later

So you can do offline. There is also a local database, based on SQLite, documented by Apple here – putting iOS ahead of Windows Phone 7, which has no built-in relational database for Silverlight applications. Another plus is that other WebKit-based mobile browsers should work as well, including the one in Android devices.

It is possible to create application frameworks that wrap these features into a single development platform that compiles to JavaScript, HTML and CSS. PhoneGap is one example, and NS App Studio another; but today Reddit alerted me to another, Mobl, which has a modern feel and benefits from Eclipse integration. It is also free and open source, and with the right community momentum looks like it could be interesting.

Mobl is a statically-typed language with a syntax similar to Javascript – there is a guide and language reference here. The goal is to create a complete DSL (Domain Specific Language) for mobile development, which according to the web site:

Integrates all aspects of a mobile web application into a single language: data modeling, user interfaces, application logic, styling and web services.

The main author is Zef Hemel, from the Delft University of Technology in the Netherlands. Mobl makes use of Stratego/XT, which is a language and toolset for program transformation, and SDF  (Modular Syntax Definition Formalism), a language for defining syntax.

Mobl includes data modelling which handles object persistence and a concise language for defining user interfaces. AJAX support is built-in and there is integrated support for RESTful web services and for JSON (JavaScript Object Notation). The Eclipse add-in includes syntax highlighting, inline error reporting, code completion, and reference resolving.

All rather impressive for a project that has just burst onto the scene. I installed the Eclipse add-on and enjoyed its simple license:

image

“This software is distributed in the hope that it will be useful.” – though I have not found time yet to try creating an application.

There is more information on the nicely-designed website and blog and in the Google Group.

Update: thanks to @FransBouma for the link to the Mobl guide.

The desktop versus web application debate

I posted a piece entitled Desktop applications are dead which attracted the following comment:

Web apps have plenty of cons too. You seem to only be looking to the Pros.

There’s something in it; though the article is a little more nuanced than its title. There’s also another debate to be had around the question of what a web application really is. If thousands of lines of JavaScript are executing on the client, is it a web app? If it is running in Flash or Silverlight is it a web app? If it is running out of browser (Adobe AIR, Silverlight, JavaFX) has it crossed the border to become a desktop app? This last case is particularly interesting, since although something like AIR should probably be categorised as desktop, its programming model is normally that of a web application with an offline cache.

The semantic discussion can distract from the real issues. The ascendancy of web applications has a lot to teach software developers. The enforced simplicity, even crudeness, in the user interface of early web applications brought some surprising benefits: users generally liked the minimalist approach and ease of navigation. The page model, intended for documents, turns out to work for applications as well.

Another big lesson: users value zero-install extremely highly. The routine of go to the web page – run the app is easy to understand. Some find it easier than finding an application shortcut in the Windows Start menu, and that is after the potentially painful business of running setup.

Still, I am slipping into reiterating the advantages of web apps. What about their cons? What about the pros of desktop applications?

I still use desktop applications a great deal: Microsoft Office, Live Writer, Foobar, Visual Studio, Eclipse, all the things I listed in 10 Mac alternatives to Windows utilities. Doesn’t that prove that desktop applications are still important?

It does; but there is an important qualification. None of these are line of business applications of the type which occupy so much of the time of corporate software developers and contractors.

The real point: if there is a discussion about whether a particular project should be implemented as a desktop or web application, it is not the web application advocates who need to make their case. Rather, it is the desktop advocates who need to show the particular reasons (which may be good ones) why only a traditional local install will do.

It is also important to follow the curve on the graph. The list of things that can only be done by desktop applications gets shorter with every upgrade to the web platform – whether you think of that as HTML/AJAX, Adobe Flash, Microsoft Silverlight, or [insert your favourite web technology].

Ten years ago, a web version of Photoshop seemed an unlikely prospect. Today, here it is. Office and email is going the same way, even if it is not quite ready for all of us; Microsoft will have to accept that or lose its business.

I don’t follow Rich Internet Applications with such interest because they are cool, but because they are the future of the client – and increasingly the present as well.

Symbian appeals to Traveling Geeks: develop for our platform

I attended a Traveling Geeks event in London last night, a party sponsored mainly by Symbian and NESTA. I returned with a large pile of business cards from folk involved in a diverse range of initiatives. Kate Arkless Gray told me about Save our Sounds, a BBC World Service project to archive and map interesting and endangered sounds from around the world; while Sarah Blow sought to convince me that I don’t just need Twitter, I need Tweetmeme to track what is happening on the world’s most public short message service.

Digitrad wants me to sign up for yes.tel, which means registering a .tel domain with its service and using it as a public home page, email address and voicemail box. It’s not clear to me what advantage it has over all the other third-parties who want to own my digital identity, except that Digitrad is smaller and therefore less threatening than Google or Facebook. I’m happy with conventional registrars.

From my perspective, Symbian managed to dominate the event with engaging images around the walls and numerous representatives to talk up its mobile platform. The Symbian story is an interesting one. Originally developed by Psion, it was spun off in 1998 into an independent company co-owned by the giants of mobile at the time: Ericsson, Nokia, Motorola and Psion itself. Nokia proceeded to acquire more and more of Symbian, achieving greater control but also – it seemed to me – reducing the chance it once had of becoming an industry standard. Other vendors became wary of depending on an operating system controlled by a competitor. Linux had greater appeal – as seen in both the Palm Pre and Google Android – while Apple did its own thing with OS X on the iPhone, and Microsoft ploughed on with Windows Mobile.

Last year Nokia responded to the pressure by announcing plans to acquire Symbian in its entirety and then to give it to a new Symbian Foundation, an open source, collaborative project along the same lines as Eclipse. Developers can sign up to get the tools for programming Symbian applications in C++, Java, Python, Ruby, Adobe Flash, C# or HTML/JavaScript. I was told that Symbian intends to be even more open than Android. It restores Symbian’s cross-industry potential though there is now more competition.

Should you develop for Symbian? The Symbian Foundation is a great move, but in the App Store era I suspect deployment issues are even more critical than the quality of the OS or its development tools. Developers will go where they can find customers. Apple is reaping the rewards of controlling the entire platform and marginalizing the mobile operators.

Still, as long as Apple is content for the iPhone to be punishingly expensive, it leaves space for others. The appeal of Symbian will depend not only on its success among device manufacturers, but also on how easy it is for users to find, purchase and install applications.

There is also the matter of reliable, fast and affordable internet access, the lack of which has so far spoilt every mobile device I have owned.

Eclipse survey shows Windows decline

In May 2009 the open source Eclipse project surveyed its users. Visitors to the Eclipse site were asked to complete a survey, and 1365 did so. That’s out of around 1 million visitors, which shows how much we all hate surveys. Anyway, this report [pdf] was the result. A similar survey [pdf] was carried out in 2007, potentially making a valuable comparison, though the earlier survey has different questions making direct comparisons difficult in most cases, which is a shame. I especially missed the detail on which Eclipse projects are used most which is well covered in the 2007 report.

Here is what I found interesting. First, there’s a shift towards Linux and Apple Mac in the desktops developers use for Eclipse. In 2007 it was 73.8% Windows, 20% Linux and 3.5% Mac. In 2009 it is 64% Windows, 26.9% Linux and 6.9% Mac.

This is echoed in deployment platforms too (client and server). In 2007 it was 46.5% Windows, 36.6% Linux, 1% Mac; today it is 40.5% Windows, 42.7% Linux, 3% Mac.

Those surveyed were asked what other IDEs they used. I noticed that Microsoft Visual Studio and NetBeans feature fairly strongly; I also noticed that Embarcadero’s JBuilder is hardly a blip on the chart – intriguing, given how popular this used to be in the pre-Eclipse era.

The most popular code management tool is Subversion (57.5%) followed by CVS (20%). For build tools, Ant (33.4%) and Maven (18%).

Here’s an intriguing one: I often hear that Java is only successful on the server. That presumption is not supported by this survey. 23.4% said that desktop client apps are the primary type of software they are developing, compared to 30.2% server, and 24.7% web or RIA apps.

The preferred app server is Apache Tomcat (34.8%) followed by JBoss (12.7%) and Websphere (6.9%).

The most popular database manager is MySQL (27.7%) followed by Oracle (27.3%). That’s 55% for Sun+Oracle, of course, though bear in mind that many of the MySQL users are likely attracted by its free licence.

Before drawing too many conclusions, bear in mind that it is a small sample self-selected by people willing to take the survey; apparently it was also featured by a German technology site which resulted in a larger response from German visitors.

Although it suggests a declining use of Windows – which is especially plausible given the trend towards web applications – it does not prove it beyond the Eclipse community.

And next time – how about using the same questions, which would make it possible to identify trends?

I’ve also written about Eclipse here: The Eclipse Conundrum: can it grow without hurting its contributors?

Survey ranks developer tools, and reveals what developers care about most

Evans Data has published its 2009 Software Development Platforms survey, to which around 1200 developers contributed, scoring their chosen development tools in eighteen different categories.

The tools covered are Eclipse, Embarcadero’s Delphi, IBM’s Rational Suite, IntelliJ, Microsoft’s Visual Studio, NetBeans, Oracle JDeveloper and Sun Studio.

I was sorry not to see more products covered. Flex Builder Flash Builder, Zend Studio, Aptana and JBuilder would all have been interesting, for example. Each developer only scored the product they actually use (a good thing), so the sample is not as big as it first appears.

I’m also mistrustful of the survey results, particularly when you look at it in detail. For example, one of the categories is “Support for frameworks”.  Visual Studio came top, while Eclipse was last. But hang on: in Visual Studio (for example) are we talking MFC, or .NET Framework? The development experience for each is totally different. And were developers primarily judging on the framework tools, or the framework itself? It is hard to attach much meaning to the scores in this category.

Another flaw: the versions of the products is not specified. That means a weakness may have been fixed in a later version, but the survey does not tell you.

A third flaw: some tools are weak in several categories, dragging down their overall score, but that does not matter to developers who do not use them for that purpose. It is hard to compare like with like.

Still, while I’m wary of the survey overall, I though it brought out some interesting points. One is that developers were asked what features matter most to them. So:

The three things developers care about most (highest priority first):

1. Basic tools (editor/compiler/debugger)

2. Documentation

3. Tool integration

The things developers care about least (lowest priority first):

1. Support for remote development

2. Support for parallel programming (sorry Intel!)

3. App Modeling tools

What about the winners and losers in the survey? I almost forgot. IBM’s Rational Suite came top, followed by Microsoft’s Visual Studio. Eclipse came last, though it still got a decent score, well below its rival NetBeans.

The low ranking for Eclipse (which is nevertheless wildly popular) deserves some comment, particularly as the top tool, IBM Rational Suite, is built on Eclipse. I spoke to Eclipse executive director Mike Milinkovich while researching this Register piece recently. One of the points we discussed was the tension (if there is one, which he disputes) between tools vendors sharing resources to build the best possible platform, and holding resources back to retain commercial differentiation. I’ll write this up in more detail shortly; but it shows why certain areas in Eclipse may not receive the attention they deserve – localization was a specific example.

Another problem with Eclipse is that it is all a bit messy, confusing and hard to manage, particularly in a team where you want every member to have an identical setup. It is still worth it though, for the riches it provides for free.

Google’s cut-down Java: wanton and irresponsible, or just necessary?

Sun’s Simon Phipps stirred things up last weekend when he called Google’s actions wanton and irresponsible. Its crime: delivering a cut-down Java library for use on its App Engine platform, “flaunting the rules” which forbid creating sub-sets of the core classes.

It does sound as if Google is not talking to Sun as much as it might. Still, let’s note that Google has good reason to omit certain classes or methods. App Engine is a distributed, shared environment; this mean that some things make no sense – for example: writing to a local file – and other things may be unacceptable, such as grabbing a large slice of CPU time for an extended period.

Salesforce.com addressed this same issue by inventing a new language, called Apex. It’s Java-like, but not Java. The company therefore avoided accusations of creating an incompatible Java, and conveniently ensured that Apex code would run only on Force.com, at least until someone attempts to clone it.

Google’s approach was to use Java, but leave a few things out. This FAQ gives an overview; and the article Will it play in App Engine lists common frameworks and libraries with notes on whether they work. Given that languages like JRuby, Groovy and Rhino work fine, it’s clear that core App Engine Java is not too badly damaged. The big omissions are JDBC (because you are meant to use the App Engine datastore, which is not relational), and Enterprisey things like JMS, EJB and JNDI. Google is nudging, or shoving, developers towards RESTful APIs along with its built-in services.

Will you be able to escape App Engine if you have a change of heart after deployment? I’d guess that porting the code will not be all that hard. Perhaps the biggest lock-in is with identity; you could roll your own I guess, but Google intends you to use Google accounts and supplies a Java API. Microsoft is ahead of Google here since it does support federated identity, if you can get your head round it: you can authenticate users in the Microsoft cloud against your own directory using Geneva. The best Google can offer is Directory Sync; though even that is some protection from identity lock-in.

Java support on App Engine is actually a vote of confidence in Java; if what is good for Java is good for Sun, then Sun is a winner here. That said, just where is the benefit for Sun if companies host Java applications, built with Eclipse, on Google’s platform? Not much that I can see.

Technorati Tags: ,,,

Microsoft Expression Web causes PHP error

I ran into a strange and surprising PHP error today. I’m working on a little PHP application which has a login page. The login script calls session_start() to start or resume a PHP session. It was working OK so I decided to decorate the page a little (I was working in Eclipse). I like to try a variety of tools, so I ran up Microsoft’s Expression Web, added an image, then re-ran the script to see how it looked.

The answer was not good, because I now had an error:

Warning: session_start(): Cannot send session cookie – headers already sent

I puzzled over this for some time. The error was in line 0 of my login page. I couldn’t see anything that was different from before, except the static image that meant nothing to PHP.

Eventually I worked it out. Eclipse (running on Windows) created the PHP files using ANSI. On saving, Expression Web silently changed them to UTF-8. That in itself was no bad thing – it’s usually a better choice – though I reckon it should ask. The bigger problem was that Expression also added a BOM (byte order mark) to the beginning of the file. This is actually optional for UTF-8, and most non-Windows editors do not add it. It happens to flummox PHP, which interprets them who-knows-how and sends some output to the browser, preventing session_start from working.

This is particularly painful to debug since most editors do not display the BOM; they simply use it to confirm the character set in use. So you can have file A which works, and file B which does not, and they are character-by-character identical.

One way to see and remove the BOM is to open it with Edit.com, which does not understand it at all:

I guess both Expression and PHP could do better here. The bit that puzzles me is that I can’t be the first to run into this. Doesn’t Microsoft know that its UTF-8 BOM breaks PHP files, at least on the two versions I tried (XAMPP on Windows and PHP 5.2.1 on Linux)? I can’t even see a preference in Expression that would prevent it being written. And if you remove it, and then re-edit in Expression, it carefully writes it back. Unlike Adobe’s Dreamweaver, which leaves well alone.

PS if you want to know all about BOMs, see here.

Update: See comments – apparently this was fixed in Expression Web 2.0. Tina Clarke discusses the problem here.

Develop for Adobe Flex in Microsoft Visual Studio – or maybe not

News from the Adobe MAX conference this week in San Francisco: Ensemble has developed an add-in for Visual Studio for Flex development, code-name Tofino. It’s currently in beta and available for download. Flex is Adobe’s developer-focused SDK for Flash applications.

I installed it this morning, and so far it does not impress. There is zero documentation (just a few links to the standard Flex docs on Adobe’s site), and it lacks even MXML Intellisense, let alone a visual designer. When you go to project properties, there is nothing to configure. The toolbox is also empty. On the plus side, it successfully invoked the Flex compiler to build the project, and managed to open it as a static file in Internet Explorer when I clicked Debug. I’d prefer an option to use Visual Studio’s built-in web server for debugging. There must be more to it than this; then again it is advertised as a beta which is meant to mean well advanced (ha ha). I suggest sticking firmly with Flex Builder for the time being.

Adobe has largely ignored .NET in its Flex and AIR technology, though it does support SOAP. I am not sure whether this is caused by aversion to Microsoft, or an assumption that Microsoft developers will use Microsoft technologies like Silverlight or Windows Forms, or a bit of both. Integration with Visual Studio and server-side .NET could be significant for Flex adoption, though it would be better if Adobe itself were doing the add-in.

You can see the same thing happening on Microsoft’s side, with a half-hearted Silverlight project for Eclipse (which only works on Windows), or the well-regarded Teamprise which integrates Eclipse with Visual Studio Team System. In both cases Microsoft keeps itself at arms length, which does not have the same impact as in-house support.

There are always concerns about the quality of third-party applications. I am sure Adobe itself would not have put such an inadequate preview up for download, as Ensemble has done for Tofino.