Eclipse Europa is here
Tuesday 17 July 2007 @ 3:52 pm
Filed under:

Two weeks a brand new Eclipse called Europa has been released.
This release is just as the previous one (Callisto; version 3.2) a combination a range of of Eclipse projects.
So this release is not only one for the Java IDE, but also the Web Tools Platform (WTF), Eclipse Modeling Framework (EMF), CDK, Eclipse Dynamic Language Toolkit (DLTK), Eclipse Business Intelligence and Reporting Tools (BIRT) and much more.

Since the whole Europa release is too large for the average developer, the best way is to only download it by starting of with the Platform Runtime which can be found here
and install only the desired stuff using the Update Manager from Eclipse (”Help -> Software Updates -> Find and Install..” from the menu bar) via the “Europa Discovery Site”.

After you installed your customized Eclipse IDE you can check New and Noteworthy from the Platform, Java Development Tools (JDT) and Web Tools.
To summarize the new and noteworthy in Europa, I personally found the following relevant items:

  • You can optionally use “Save Actions” (configured and enabled in the preferences) to perform all kind of actions when saving a Java editor in Eclipse. Possible actions are code formatting, adding missing @Override and @Deprecated annotations, Organize imports and removing trailing whitespace.
  • Support for the Java Persistence API
  • We can now finally benefit from a visual JSP / JSF Web-Page Editor
  • Full JSF 1.2 support including a visual Faces configuration editor
  • Long resource paths are now supported on Windows. Requires 1.5 or higher for it to work.
  • Improves refactoring like refactoring directly inside the editor (without a dialog) and no need anymore to save your editors before doing a refactoring.
  • Workspace relative paths are now possible for JavaDoc locations. This way it’s now possible to place a zip with the JavaDoc of a library inside your project and attach it to your library. The advantage is that each developer will automatically get the JavaDoc when the check-out the project from version control. This is especially helpful for commercial libraries for which you don’t have the source code.
  • CTRL + 3 will give you a quick access to UI elements such as views, commands, preference pages etc.
  • And finally for Eclipse is now fully functional for Windows Vista.

The items I described above are just the tip of the iceberg. This because Europa consists of 21 Eclipse projects, so I barely scratched to surface so to speak.

— By Emil van Galen   Comments (0)   PermaLink
Differences between C++, Java and C#
Wednesday 4 April 2007 @ 9:04 pm

Bjarne Stroupstrup, the inventor of the C++ programming language, has an interesting technical FAQ about C++. He has an example in the FAQ that inspired me to try this out in C++, Java and C#. Have a look at the following C++ code. What do you think this prints?

(NOTE: The C++ code looks a bit weird. I had to replace the angle brackets with ‘[’ and ‘]’ because the WordPress editor does not let me enter angle brackets properly, even if I edit the HTML code manually…).

 

 #include [iostream]   // NOTE: Use angle brackets here

class Super {
public:
    void method(int i) {
        std::cout [[ "method(int): " [[ i [[ std::endl; // NOTE: Use angle brackets here
    }
};

class Sub : public Super {
public:
    void method(double d) {
        std::cout [[ "method(double): " [[ d [[ std::endl; // NOTE: Use angle brackets here
    }
};

int main(int argc, char* argv[]) {
    Sub obj;

    // Which method is called for each of these statements, the int or the double version?
    obj.method(10);
    obj.method(3.2);

    return 0;
} 

Here is the Java version. What do you think this prints? Do you think Java works the same as C++ or not?

 

 class Super {
    public void method(int i) {
        System.out.println("method(int): " + i);
    }
}

class Sub extends Super {
    public void method(double d) {
        System.out.println("method(double): " + d);
    }
}

public class Main {
    public static void main(String[] args) {
        Sub obj = new Sub();

        // Which method is called for each of these statements, the int or the double version?
        obj.method(10);
        obj.method(3.2);
    }
} 

And lastly the C# version. What do you think - does C# work the C++ or the Java way, or is it the same - or different?

 

 namespace Example {
    class Super {
        public void method(int i) {
            System.Console.WriteLine("method(int): " + i);
        }
    }

    class Sub : Super {
        public void method(double d) {
            System.Console.WriteLine("method(double): " + d);
        }
    }

    class Program {
        static void Main(string[] args) {
            Sub obj = new Sub();

            // Which method is called for each of these statements, the int or the double version?
            obj.method(10);
            obj.method(3.2);
        }
    }
} 
— By Jesper de Jong   Comments (3)   PermaLink
a few quick (must) reads ….
Monday 28 August 2006 @ 10:54 am
Filed under:

Five habits of highly profitable software developers for those who might think writing code can be career limiting

Or are we doing something wrong?

 

— By Okke van 't Verlaat   Comments (0)   PermaLink
Just a couple of links how to find Buildix
Thursday 20 July 2006 @ 2:26 pm
Filed under:

Found on Javalobby a link to Russ Olsens Web Log, having a comment that pointed me to Martin Fowler who has written a nice entry about Buildix. A bundle of essential pieces of software that form the cornerstone of agile development. According to their website everything you need to get started in one easy install. You can download it as CD, VMWare image or as binary package. And as long as you don’t care dealing with linux, it sounds like a very good deal. Have it a try I would say ….

— By Okke van 't Verlaat   Comments (0)   PermaLink
Eclipse Callisto, the video, or when to push and when to pull
Tuesday 4 July 2006 @ 3:43 pm
Filed under:

I’ve been way too busy doing probably important but not blogoductive things but today I found a few minutes to take a look at Elcipse Callisto and write some meaningful comments about it. At least, I thought …

In may, during the JavaOne, I saw callisto for the first time. The eclipse team proudly presented their plans. And during this session thay gave me the impression Callisto could be something worth to check out. Well, At the end of June, exactly like they promised (very cool, those release schedules and planning all done through IBM’s jazz), the time has come. It is Callisto time!

So Let’s go …. [quote]

  • First download either the Eclipse SDK or the Eclipse Platform Runtime Binaries.
  • You then need to use the update manager to load Callisto projects. See Eclipse Help for general information about using Update Manager.  
  • [/quote]

    Hummm …. so I need to download eclipse and after that I need to use the update manager to select what I want. Does not sound like a smooth download and go to me. I think the idea to combine several projects into one coordinated release cycle is a very good idea. And providing the flexability to select what you want is also a good idea. But how about the idea to productize the whole bunch in one download? I wanted to do a quick click through to write down some first impressions. Instead, I’ll restrict this blog entry by only watching the video. [offside discussion: Why does a product (yep, i know, it is not a product, wish it was a product) needs a video to tell me how to install it?? Since RoR has shown the world how convenient it is to use videos, every product that might need some better marketing, uses a video]

    Well, my review can be short. Why on earth does someone wants to select the ‘XSD Schema Infoset Model 2.2.0.v2′ ?? Lunatic :-) . Is there someone on this planet really planning to go the callisto way only to use this extension? Well, the eclipse team already predicted the amount of developers looking for this one feature is not worth counting so they provided the ’select required’ button. So, you select the feature you want and all depending feature are selected automatically. Great, I want Callisto to bring me all! Also possible. The selection model is tree driven. One select box, one button, some intermediate wizard screens and a restart. Well, if that is possible, why not provide that one click download?

    The actual question of course is not why we need videos nor what is wrong with the exotic selection of some deep down under package. The actual question is all about software distribution. It is push versus pull. Pull, just like the eclipse way but also like the linux way of packaging, is extremely useful for those who know what they are doing. Those who really need lunatic versions of lunatic packages. The only problem with pull is the lack of control on the distribution side. And that is where push comes in.

    On development teams it is sometimes important all developers are using the same tools. I especially used the word sometimes because I know this can be a delicate issue. But when you are in the situation this sometimes is a definately, pulling exotic packages from the Callisto discovery site might not be a very good idea. And that is exactly the reason why I want that one click download. (including restrictions on the update manager inside eclipse so I can throw away the video :-)

    — By Okke van 't Verlaat   Comments (5)   PermaLink
    do the ui with double-u
    Tuesday 11 April 2006 @ 11:31 am
    Filed under:

    It’s framework time. Again. We’ll probably never learn. And on one hand it’s good we do not learn, creativity is partly based on exploring the unlearned. But on the other hand building solutions for already solved problems seems a waste of time. What I’m talking about? New frameworks for solving the UI problem of our world wide web. The list is evergrowing and when looking at the latest additions your homebrew’s name must at least start with a capitol ‘W‘. I’m talking about Waffle’ and Wedge’ Is this the Wicket-effect??

    I’m not in the mood, nor in the position, to dive deeply into these two new kids on the block but a quick look through their respective tutorials gave me the impression we’re not dealing with new and fresh approaches. Waffle seems nothing more than an action handling request based view dispatching framework. And Wedge is following the component oriented paradigm and utilizes ANT to generate java code (how about the write-deploy-test cycle??) for binding (indeed, no reflection needed anymore).

    But, If you want to give it a try, go ahead! And Feel free to convince me whenever you’re findings do not match my quick look-without-touching way of review. Oh, and for those with too much spare time, I do not care you’re using it to build UI- framework XYZ, but I strongly suggest not to start its name with a trendy double-U :-) .

    — By Okke van 't Verlaat   Comments (7)   PermaLink
    Productivity versus design
    Wednesday 5 April 2006 @ 3:06 pm
    Filed under:

    In his excellent written article The state of design Steven Devijver makes some intriguing comments on common design principles. While advertising the principle of simplicity, he focuses on the effect EJB technology had on current practices. Major target of critique is the inherited (as in taken from the olf J2EE world) use of data transfer objects while everyone seems to have forgotten the idea of rich domain models. You can agree with him or not (as one can follow on the discussion full of lengthy replies at javalobby.org), but one point he makes seems evident: when dealing with an object oriented world (language, platform) why restrict yourselves to behaviourless classes? It’s a bit of missed opportunity he forgot to mention how complex OO can make life and how delighting DTO’s can be. I do agree with Steven we not always get the best out of the OO instruments we are using but sometimes I also wonder for whatever reason we decided it must be OO (not even mentioning the additional layer on top dealing with cross cutting concerns). Not everybody is a PhD in applied computer science! At the end, a design will be settled by the fact it resulted in a piece of software that works and that was build within budget.

    The last months I’ve been busy exploring productivity boosts around web application development. And during this quest I discovered there are only two major streams to follow: You either simplify everything you can and make life as easy as possible especially by underdesigning your app, or you don’t care about complexity that comes with ‘well designed’ OO and rely on the tools you use. No middle of the road! Setting up a rich domain model without the tools to maintain it? Forget it! But on the other hand you can also forget to build an utterly complex application without any design. It seems to be either the complete low- or the complete high-end of bandwith. So you either end up in a Ruby on Rails alike world with simple models (indeed, DTO’s without behaviour), simple controllers and a couple of useful helpers, or you find yourself behind a ‘do everything a normal programmer does not want to do by himself‘ kind of RAD environment. And it’s exactly this perspective you have to use when looking at ‘the state of design’: It’s all about productivity.

    So, that said it’s time to drop in the bit over-acted and bold statement Java is not a very productive language. Neither is C++, neiter is C#, neither is any 3GL (not going to argue a language producing byte code that get interpretered by a virtual machine is not pure 3GL!). When you’re planning to write a data driven web application by hand using java, no matter which (set of) frameworks you’re planning to lay as foundation, the language you’ve choosen will become your biggest enemy. You might have the most elegant framework you could find (yep, of course it is Spring), you can have the most elegant design (including those lovely rich domain models) but the chance you got beaten by a bunch of scriptkiddies who just met the Rails environment is quite high. Unless you got tooling! Heavy tooling! And once you’ve got your ironwork, I bet you won’t care about design at all. That is up to the tools and embedded (meta) frameworks you bring with you. So, if you ask me what the state of design is, I would say it has been forgotten. Design has left the building. For the sake of productivity.

    — By Okke van 't Verlaat   Comments (0)   PermaLink
    It’s just common(s) sense
    Monday 3 April 2006 @ 9:59 am
    Filed under:

    Most java projects use a bunch of common classes for various things.
    Because this functionality is so common, we tend to copy these common classes from one of our earlier projects.
    Instead of just copying some ‘legacy’ snippets from previous projects, it might be a more sensibly thing to use the (Apache) Jakarta Commons libraries instead.
    One of the jakarta commons should be mandatory for each Java project: Commons Lang

    The commons lang contains all kind of utility classes that will make you think why it is not part of the standard Java lang(uage).

    One of the most handy features of the Commons Lang are the Builder classes to easily create toString, equals and hashCode implementations for a class. All these builder classes are smart enough to detail with null and array arguments, so you don’t have to.

    Another handy class is the StringUtils class that contains a whole bunch of string functionality like isEmpy / isBlank, trimming, replacing, chomp / chop etc.

    When coding I like to aggressively enforce my constructor / method pre-conditions by throwing and IllegalArgumentException when any argument value is not according to a pre-condition. The Validation class will help you with that. It contains utility methods to easily check if the supplied argument isTrue, notEmpty and notNull. Furthermore for a collection / array you can easily validate if there are no null element and that all elements are of a certain type.

    There last class I would like to mention is the Enum / ValuedEnum base class.
    By extending from this class you can easily create a enum class in Java 1.4 (in Java 5 you should use the new enum language functionality).

    I would advise any Java programmer to have a (short) look at the Javadocs of Commons Lang, because besides the features I described above there are a lot more gems to be discovered.

    — By Emil van Galen   Comments (0)   PermaLink
    Internal LogicaCMG RADRace: Oracle ADF wins
    Monday 23 January 2006 @ 12:43 pm

    Last friday and saturday LogicaCMG organised an internal RADRace. The man who made the assignment was nobody other than Ivan Verborgh, the man who makes the assignments for the international RADRace.

    The assignment was to make a webbased application with which people could apply for a license plate. It had to contain at least:

    • Multi-lingual screens
    • A webservice for checking credit card codes
    • Role based authorisation, different functions for different roles
    • Wizard like registration process
    • And of course lots of business rules

    Last year we (Reza Ahmadi and I) entered using Oracle Designer and Oracle Forms (after realising we didn’t have enough knowledge of Oracle ADF) and had the pleasure to win.

    This year we (Gideon Liem and I) entered using Oracle JDeveloper 10.1.2 and the Oracle ADF framework. We had prepared a kick-start application that contained a new look-and-feel (Using custom renderers in UIX) and some authentication method.

    From there we built almost the complete application. In the end the following stack of technologies were used:

    • Oracle Database 10g (as the big Datastore, we can use another database?)
    • Oracle OC4J stand-alone (as the application server)
    • A small SMTP server, called JES
    • Oracle ADF Business Components (as the persistence layer)
    • Oracle’s implementation of JSR-227 (as the binding layer, between the persistence and the view layer)
    • Oracle ADF UIX (as the view layer layer)
    • Apache Axis (as the webservice engine)
    • Apache jUDDI (as the webservice registry)
    • UDDI4j from Sourceforge (communication with the registry)
    • Apache WSIF (communication with the webservice)
    • Apache POI (generating Excel reports)

    One of the things that were most difficult for us was the refactoring of the data. Ivan had prepared the challenge in a way that we got the data as two big denormalised tables. Part of the challenge was to normalise the data so you could use it for your application. It took us the morning of the first day and the first hour of the afternoon to get the database right.

    After that the framework kicked in: generation of the persistence layer is really a breeze. When you just had the rule of thumb to code your screens on your tables (don’t think in Objects if you got tables… it makes sence to see the whole picture and combine the two). UIX pages are the view layer we used in projects the last year and we have become quite proficient with them. The binding layer makes it possible to get your model and just drag them tables into the screen and have them work. Most of the time we could do what building an application is about: building the business logic that matters… All else should be simple, easy and quickly done.

    Rest us to say we had the pleasure to finish first in the contest. Unfortunatly our competitors that used JHeadstart had to drop out for the second day (for personal reasons), we would have really liked to compare their result with ours.

    Runners up were: in second place a microsoft team using Microsoft .NET 2.0 (they also had a good working application) and in third place a Java based team that used LogicaCMG’s own open-source framework: ePlatform.

    Photo’s
    All contenders
    All the teams and the jury
    Us
    We, Gideon (right; in white, red & blue) & Robert (left; in grey)
    Us
    Design is essential
    Us
    Evaluation by the jury
    Us
    Success!

    Links
    Oracle Technology site, you can find the database, application server and JDeveloper here.
    Apache, great products here
    Sourceforge, also here
    bloggingabout.net, another blog sponsered by LogicaCMG that contains a post from the microsoft competitors
    ePlatform (on sourceforge), the ePlatform site

    — By Robert Willems of Brilman   Comments (8)   PermaLink
    Java generics quirks
    Monday 16 January 2006 @ 12:31 pm
    Filed under:

    One of the major new features of Java 5.0 is generics. The main purpose of generics is to provide you with a way to make type safe collections, for example, you can specify that your List contains only String objects. The obvious advantages are that the compiler can check at compile time that nothing else than String objects are stored in the List and that you can eliminate a lot of type casts from your source code.

    // Old style, not type safe
    List names = new ArrayList();
    names.add("Jesper");
    names.add(new Integer(123)); // not what you meant, but no error or warning

    // Java 5.0, using generics
    List<String> names = new ArrayList<String>();
    names.add("Jesper");
    names.add(new Integer(123)); // compiler error

    That seems simple enough, but if you study generics in more detail, you will discover that there are some strange limitations that don’t look obvious at first sight.

    For example, here is one limitation of generics I would like to highlight: You cannot create an array whose component type is a concrete parameterized type. An example to explain what this means:

    // An array of a list of strings. This is illegal, but why?
    List<String>[] data = new ArrayList<String>[10];

    At first sight, this looks perfectly reasonable. But if you try to compile this, you get an error message, and it isn’t very helpful either:

    Jesper.java:6: generic array creation
            List<String>[] data = new ArrayList<String>[10];
                                  ^
    1 error

    The compiler just tells you that you can’t do this, but it doesn’t give a hint why. To understand why this is illegal, we have to know a few things about arrays and generics in Java.

    First of all, arrays are covariant, which means that an array of supertype references is a supertype of an array of subtype references. For example, Object[] is a supertype of String[], and a string array can be accessed through a reference variable of type Object[].

    Object[] example = new String[10]; // ok
    example[0] = "Hello World!";

    Arrays also carry runtime type information about their component type. At runtime, when you assign a value to an array element, an array store check is performed to check that you’re not storing a value in the array that’s not compatible with its component type. If the check fails, an ArrayStoreException is thrown.

    Object[] example = new String[10];
    example[0] = new Long(123); // compiles, but throws ArrayStoreException at runtime

    That still doesn’t explain why arrays of concrete parameterized types are illegal. There’s one more thing we have to understand, and that is the process of type erasure.

    When you compile Java source code in which generic types are used, the compiler does the extra type checks and then translates the code into plain old Java code without generics. If you would decompile the byte code, you would see that the generics have disappeared. So for example List<String> and List<Integer> would both look like the plain old List in the byte code - the information about the generics has been lost by the process of type erasure. The following example illustrates this:

    List<String> names = new ArrayList<String>();
    List<Integer> values = new ArrayList<Integer>();

    System.out.println("Runtime type of 'names': " + names.getClass().getName());
    System.out.println("Runtime type of 'values': " + values.getClass().getName());

    The output of this piece of code is:

    Runtime type of 'names': java.util.ArrayList
    Runtime type of 'values': java.util.ArrayList

    As you see, both look like plain old ArrayList at runtime. I won’t go into the details here of how and why the compiler handles generics using type erasure.

    So here comes the catch. The combination of how arrays work (covariance and runtime type information about the component type) and type erasure for generic types creates a problem when you want to create an array of a concrete parameterized type.

    Because of type erasure, there is no exact type information available for the generic type at runtime, so that the array store check doesn’t work, and an unacceptable situation occurs. Here’s an example.

    List<String>[] data = new ArrayList<String>[10]; // illegal, but assume that this would be ok

    Object[] objArr = data;
    objArr[0] = new ArrayList<Integer>(); // should fail, but would succeed

    List<String> firstList = data[0]; // would fail with ClassCastException, but there's no cast!

    Because of type erasure, List<String> looks like a plain List and ArrayList<Integer> looks like a plain ArrayList at runtime. The array store check would succeed, because ArrayList is a subtype of List. Ofcourse we now end up in an unacceptable situation - the first element of the array now contains an ArrayList<Integer>, which shouldn’t be possible.

    To avoid this problem, the Java language engineers at Sun simply decided to make arrays of concrete parameterized types illegal.

    Isn’t it ugly that a construct that looks perfectly reasonable (you can make an array of any type, so why not of a concrete parameterized type?) is made illegal essentially because of the way the compiler treats generics? In other words, the language has a hole now because of the implementation details of the compiler.

    This is just one of the quirks that you find when you look at generics in depth. You can find a lot of detailed information about generics in Angelika Langer’s Java Generics FAQ.

    — By Jesper de Jong   Comments (6)   PermaLink
    Next Page »

    Menu


    Blog Categories

    Browse by Date
    September 2007
    M T W T F S S
     12
    3456789
    10111213141516
    17181920212223
    24252627282930

    Upcoming Events

    Monthly Archives

    Recent Comments

    Links


    XML Feeds Option


    Get Firefox  Powered by WordPress

    code validations
    Valid RSS 2.0  Valid Atom 0.3
    Valid W3C XHTML 1.0  Valid W3C CSS