Friday, September 07, 2007

[Event] Informatics-Week

From September 19 to September 28 the "Informatics-Week" takes places in Austria. This series of events is organised by the Austrian Computer Society. In this week a series of high-profile IT conferences are held in Austria, most prominent and from the Software Engineering point of view maybe the most important one is the Very Large Databases (VLDB) conference.



The informatics week additionally launches a set of events ("day of meda", "day of economy", "day of research" and so on), however a detailed program can be found here.

I am running a podcast that started reporting this week about the preparations of the events and gives insight into upcoming events. For SE people I will make also a coverage of VLDB with the support of the general chair of the VLDB Prof. Klas. The first VLDB coverage will be "on the (podcast) air" by next week.

So if you are interested, check out and subscribe to the Podcast. Or directly subscribe to this URL e.g. in iTunes (check the advanced / erweitert menu):

http://feeds.feedburner.com/woche-der-informatik

This is an enhanced Podcast (i.e., contains images and urls), if you are not experienced with listening to podcasts, please check out the brief description I made for the Best-Practice-Software-Engineering Podcast here (but of course use the URL above; unless you want to subscribe also to the SE podcast...).

Monday, September 03, 2007

[Arch] Design a Good API is hard

It takes a long time to learn an API. Especially in the Java world, where a lot of Open Source frameworks are out there. Beside the documentation, also the API is an important factor whether a framework success or failure. It heavily depends on developers experience how easy to handle with the API. Are there any best practices out there to design good APIs? I think there are many start points to design good APIs, e.g. naming or provide small APIs. But there are many other factors influence really good APIs. The ACM queue published an article called API: Design Matters, analyzing apsects of good and bad APIs.

There is also a very good presentation about How to design a good API and why it matters, hold by Joshua Bloch. In this presentation, he assumed why good APIs are important, e.g.:
  • Many people work with API
  • People invest heavily: buying, writing, learning
  • Successful public APIs capture customers
  • and as I mentioned before it contributes to the success of a product/technology
The characteristics of a good API are:
  • Easy to learn
  • Easy to use, even without documentation
  • Hard to misuse
  • Easy to read and maintain code that uses it
  • Sufficentily powerful to satisfy requirements
  • Easy to extend
  • Appropriate to audience
Additional to the above mentioned characteristics an API should also be good documented by using JavaDoc in case of Java. Why JavaDoc? The javadoc goes hand in hand with the development of an interface and is easy to update. It just depends on the developers discipline. The presentation provides a really good starting point by explaining how to write good APIs. He always provide short code snippets as a discussion base. Check out the article and presentation, and learn how to write good APIs.

Sunday, September 02, 2007

[About] Happy Birthday :-)

As time goes by...

Actually our Best-Practice SE Blog is meanwhile one year old! We started with this Blog end auf August 2006.

I must say, that I am quite happy with the impact so far. We have regular writers and readers, and the quality of the blog entries is good from my point of view. In 2006 we had 44 articles, and in 2007 (until now) we have 42 so far with on average more than 5 articles per month, so it seams, that writing is a rather steady process.

Also the number of readers is slightly, but continuously raising over the last years. About the Feed subscription I don't have proper information yet, I just recently started the feedburner service.

However, I want to thank all authors for their articles, and hope that everyone is motivated to participate even more in the next year.

I also (last but not least) want to thank our readers and would ask them for critical and positiv feedback!! Please use the comment function!!

Wednesday, August 29, 2007

[Arch] What is an ESB?

Well, good question. Dealing with a lot of middleware technologies in the last month, I was trying to get a clean description about what an ESB actually is. What is e.g., the conceptional difference between Mule and Service Mix (not to mention about the commercial products like Tibco and Sonic)?

You can actually get an impression, when you read what they write about the other projects respectively, e.g.:
We even get some nice side-blows like: "so if you already have an investment in some Mule configuration or code, you can reuse it inside ServiceMix along with any other JBI components". Good to know, that I can operate Mule within Service Mix, whatever might be the reasion I would want to do that. If we still do not know what an ESB is, and what we would use it for, I recommend the talk of Mark Richards:

Mark Richards poses the question: is it a
  • Pattern?
  • Product?
  • Architecture Component?
  • Hardware component?
Well, maybe all of that, check out his nice video presentation. In this talk he gives some general ideas and also talks about the two mentioned Open Source competitors, SOA, decoupling and all the other nice buzzwords.

Monday, August 27, 2007

[Tech] Combine Hibernate and Wicket

In the previous post, Alex gives an overview about Wicket and what advantages and disadvantages this component based framework has. The majority of web applications are very data intensive, where simple CRUD (Create, Read, Update, Delete) operations needed. Apart from this, many software projects use the popular ORM (Object Relational Mapping) Tool Hibernate in association with annotated domain objects. Such a tool close (or better "try" to close) the gap between the object oriented world and the relational world. To combine these two different worlds is not a trivial task. Consider object oriented appraches like inheritance, polymorphism and other points.

Back to the blog issue! Wicket is an component oriented web framework, commemorating on Swing. On the back end you have Hibernate, often used to implement the DAOs in an application. Currently finished a data driven web application, using Databinder, a simple bridge from Wicket to Hibernate. As a classical MVC framework, Wicket uses models in order to populate data in forms and vice versa. What are the most uses cases of data driven solutions:
  • Show a list of data
  • Filter a list of data
  • Show details of data
  • CRUD operations of objects
  • and some other features
Databinder is a library providing different types of wicket models and view components enables an easy Hibernate integration. For example a data form, containing a number input components for the user and a submit button. Submitting the form entails a model update in the database out of the box. Another use case is to set up a query (Hibernate Query) to receive a list of objects. The list is wrapped in a HibernateListModel which can be populated in an easy way. In order to illustrate the main functionality of databinder, consider the following code snippet, taking from the databinder examples.
@Entity
public class Graffito implements Serializable {
private Integer id;
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Id @GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}

Each databinder application must provide an implementation of the DataApplication, which enhances the WebApplication object from wicket. Databinder must know about the managed annoated data objects, by add all annotated classes to the applicaiton.
public class GraffitiApplication extends DataApplication {
@Override
public Class getHomePage() {
return TheWall.class;
}

@Override
protected void configureHibernate(AnnotationConfiguration config) {
super.configureHibernate(config);
config.addAnnotatedClass(Graffito.class);
}
}

Now databinder is ready to use and manage your domain objects in components, like DataForm, DataPanels, Tables and the like. The following code snippet provides a data form to display domain object details.
    public class MyForm extends DataForm {
public MyForm(String id) {
super(id, Graffito.class);
add(new TextField("text"));
@Override
protected void onSubmit() {
super.onSubmit();
clearPersistentObject();
setResponsePage(OrderList.class);
}


Databinder provides a HibernateListModel enables the developer to create list models by using the powerful Criteria API of Hibernate or Hibernate Query Language. The generated list model can then be populated in a list, by using property list view for instance.
IModel lastFive = new HibernateListModel(Graffito.class, new ICriteriaBuilder() {
public void build(Criteria criteria) {
criteria.addOrder(Order.desc("id")).setMaxResults(5);
}});

// show previous scrawls in list
add(new PropertyListView("graffiti", lastFive) {
@Override
protected void populateItem(ListItem item) {
item.add(new RenderedLabel("text", true)
.setFont(spidershank)
.setColor(orange));
}});
The aim of this blog was not to introduce in databinder, rather I want to give a short overview of an interesting integration library between wicket and hibernate.

Tuesday, August 14, 2007

[Tech] Wicked Wicket

In the last years, the "market" of Web-frameworks was probably the most active one. I know hardly any other domain, where we can find such a number of different frameworks and tools. There are probable hundreds of different web-frameworks out there; just the Apache Software Foundation has: Struts, Tapestry, Cocoon, Wicket, Turbine (? never knew what this is good for), myFaces. So about 6, if I have not forgotten anything, plus a wide range of subprojects dealing with specific problems or providing taglibs or components.

So what to choose?

Actually it seems, that there are three streams of framwork concepts:
  • The "traditional" ones based on JSP (or PHP alike), HTML; i.e., more or less extending JSP like Struts or building upon template engines like Velocity
  • Special-purpose frameworks like Cocoon, that have a stronger focus on XML processing or content management
  • Application-oriented frameworks like Google Web Toolkit or Apache Wicket.
I recently had a look at the "new kid on the block" Wicket, that is recently graduated from the Apache incubator:

The general idea of Wicket is to provide a very clean separation between html/css presentation layer and application logic. As a consequence each "webpage" is a duo of one html page and one Java class. The Java class looks a little bit like a Swing class, in the sense, that visual components are initialised and assembled like in a Swing project. One could create a text-box and put it into a form component for example.

However, the concrete visual appearence is controled by a html document aside, in which html code is used with wicket id-attributes that reference to the Java code. The consequence is, that the html code is pretty clean, there is actually no logic in it, and the complete logic in in Java classes. Wicket also abstracts from the Servlet session, so that the developer never needs to actually touch the "naked" Servlet API.

Additionally Wicket has a lot of additional features like a validation framework, support for authorisation and authentication and the like. Wicket is additionally very Java-oriented, meaning that there is hardly any (XML) based configuration required to get a Wicket application up and running.

That said, the documentation is currently problematic and rather "example-driven". Also the examples are not particularly well documented and partly difficult to understand. Also to website and wiki is rather confusing from my point of view.

To get started I suggest to check out:
  • First check the Homepage. Unfortunately information there is rather brief. Also the examples are only a small extract of the actually available examples
  • Download the recent Wicket distribution or get it from the SVN. IN the distribution you also find a large number (of hardly documented) examples
  • The Framework documentation is an index about documentation on the Wiki.
  • The Wicket Tutorial (Platinum Solutions)
  • Wicket Javadoc
  • Additionally I highly recommend the Maven 2 archetype from the Jetty group to get started. I explained that in a recent post.
  • Additionally Wicket in Action is on the way for the patient ones.
My first impression about Wicket is a quite good one, however there are issues, that make me a little bit doubtful: one thing is the fact, that Wicket keeps a quite "fat" session, which might make problems with scalability.

On the conceptional level however, I am not sure if I like the HTML/Java duo with each page. Somehow I feel it is odd when I write something like this (from the Wicket documentation):



Why do I have to write additionally a html document then, where these two components appear again like so



Quite redundant, isn't it? In the Java class I made already clear, that I want a form and a text-field, so just render it!

I see that this attempt gives a lot of freedom how to render webpages. I am not sure though, if the better strategy in many cases might be to stick to the Swing concept of "Layout Managers". I.e. to refer to the example before: A layout manager (that I can select and customise) decides how the components are arranged on the page. As far as I see it, this is the strategy of the Google Web-toolkit. This approach avoids the beforementioned redundancy by also providing a clean separation between logic and presentation layer.

Comments anyone?

:-)

Tuesday, July 31, 2007

[Pub] IEEE CEC/EEE Conference: Event Mining Paper

This week I had the opportunity to attend at the IEEE CEC 2007/EEE 2007 conference in Tokyo to present our paper Event Cloud - Searching for correlated business events. This event includes the 9th IEEE Conference on E-Commerce Technology (CEC' 07) and the 4th IEEE Conference on Enterprise Computing, E-Commerce and E-Services (EEE ' 07).
The joint conference will focus on new technologies and methods that enable business processes to smoothly extend in a cross-enterprise environment, including solutions to facilitate business coalition in a flexible and dynamic manner over coming Next Generation Internet which provides ubiquitous, multimedia, and secure communication services.Conference Link
At this point I'm happy to announce that our paper has been chosen for the "Best Paper Award" for EEE '07.

Event Cloud was first introduced by my diploma thesis Efficient Indexing and searching in correlated business event streams and covered a proof of concept for managing and searching for correlated events by applying an indexing approach of events. This work included several architectural iterations with the result that an indexing approach was the most promising concept for such applications. Later on Roland Vecera introduced a full-blown prototype of Event Cloud, including several key features, in his diploma thesis Efficient Indexing, Search and Analysis of Event Streams.
Event Cloud is basically a solution that allows domain experts to search for business events and patterns of business events within a repository for historical events. We consider this repository as a cloud of events, which is used for searching and analysis purposes. Event Cloud processes events, thereby creating an index for events and correlations between events in order to enable an effective event search. It provides a historic view of events with drill-down capabilities to explore and discover different aspects of business processes based on event correlations. Event Cloud allows users to investigate events, such as picking up single events and displaying their content and discovering related events or event patterns.
For further details and related paper downloads please visit Senactive Competence Center.

[Tech] Webapplication "Quickstart"

Creating (Java, what else *g*) Web-Applications with a new framework is not always an easy task. Where to put which config file, which config options, how to make the build process correctly, how to start the application in the servlet container and how to make an eclipse project and the like. Yesterday (thank you Reinhard) I was pointed to a really great resource:

Webtide, the company behind the Jetty Servlet-Server project provides a set of archetypes for Maven to create "hello world" webapplications for a broad range of different Web-frameworks (Wicket, Struts, Tapestry, Spring, Webapp with ActiveMQ...).

What does that mean?

(1) you download the artefact you are interested in, e.g. Wicket, unzip it and call mvn install (to install it in your local repository)

(2) you call for example:

mvn archetype:create -DarchetypeGroupId=com.webtide -DarchetypeArtifactId=maven-archetype-Wicket -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=info.schatten -DartifactId=my-wicket-app

and the archetype creates a simple Wicket (or whatever archetype you selected) webapplication with Maven build settings, including the jetty plugin. So type:

(3) mvn jetty:run and the application start.

This is really a helpful set of artifacts to start from!

Tuesday, July 24, 2007

[Tech] Template Engine Stagnation?

Frank Sommers discusses several new attempts in template-engine design and implementations like String Template, the Rails approach, Velocity and the like. Gert Bevin introduces this article in TheServerside.com with the words:

"Template engines seem to be one of the most stagnant technologies in Java".

Actually this question is quite interesting for me, as I made the same observation over the last years. Maybe the answer is very simple though: The reason might be, because they are actually not often used and hence there is not much demand.

For XML related processing XSLT is a proven and powerful technology; Web-Development apparently moves away from template-based approaches as new frameworks like Wicket or Google Web Toolkit show. Then there are some minor application scenarios where template engines are used in the "backend" like generation of Java code by O/R mappers or generating SQL statements and the like. But most developers use strategies one abstraction layer above. Meaning: you do not put your SQL statements together with Velocity, you might use Hibernate or Cayenne.

[Pub] End of Hibernation

I wrote an article in the current iX magazine (German) about O/R mapping strategies. I hope some of you might read the article and might want to discuss some aspects here.

In short, I am discussing the significant differences between "the world of relations" and "the world of objects" and the strategies O/R frameworks like Hibernate and Castor try to overcome these. What seems simple at the first glance turns out to be very complex in many details. If you do not believe me, check out the size of the (very good) documentation of Hibernate. This is the meanwhile often discussed problem, that using Hibernate & Co requires excellent and detailed skills of that framework and the complexity of the undertaking is often underestimated by development teams.

The specific problem here, however, is that the lack of knowledge is not evident immediately. People think they have the framework under control and know whats happening and the mapping initially also might work fine, but during the runtime of the project it often turns out, that things are not so smooth as initially thought. Unfortunately severe problems and issues then bubble up at the worst of times. Very bad performance, severe memory problems, mapping issues, session problems and the like.

In the article I suggest to have a closer look to alternatives like the Spring jdbc templates or Apache iBatis or even to OO databases like db4o.

The bottom line is, even if some articles might suggest it, there is no single best or "default" solution. A good knowledge of the alternatives is required to choose the best framework for the specific problem.

p.s.: there are several articles in this blog dealing with related aspects, please check out the technology section or search for Hibernate, iBatis, Spring... I am honestly to lazy to link all of them here ;-)