Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, February 27, 2013

Vaadin add-on Timeline vs Vaadin Charts add-on comparison


Introduction

For a recent project I had to evaluate the Vaadin Charts and Timeline add-ons for their capabilities.

Setup
- Vaadin 7.0.1
- Vaadin Charts 1.0.0
- Vaadin Timeline which is included in Vaadin Charts since Vaadin 7.0

Requirements
- Be able to see data for 90 days, and the same data but then per week (same graph, just other view).
- Be able to click on a bar and perform some action like retrieving other data based on the selected bar.
- Customizable three code coloring stacked bars.
- Display more details when hovering over a bar.


Comparison

Timeline

This type of graph is very flexible and elaborate in the ways it can display data. It has a "selection bar" below the actual graph so you can determine the values being displayed in the graph above it. See below for a screenshot:



You can try it out yourself in an online demo here and here.

Pros

- The graph is scrollable thus no worries about the bars/lines getting too close to each-other.
- You can zoom in and out, also with your mouse.
- Different charts (graph modes) provided by default, changeable in one click: line, bar and scatter.
- A quick zoom per period (1d, 5d, 1w, 5m etc).

Cons

- Can't attach any action to clicking on a bar. What you can do is react on the area selected with the selection bar, so a work-around might be to have the user select exactly one bar to mimic a kind of "clicking" on that bar. And then take the appropriate action.
- You can only show days on the x-axis it seems. You can't show a bar per week for example (thus one bar representing 1 week). A work-around might be to create your own Zoom period for 1 week, which is quite easy to do.
- Currently as of this writing there are at least two bugs regarding hovering: the timeline moves down a few pixels when hovering for the first time, and the stacked bars have a hovering problem.


Untested

- Can you also add an hover-over tooltip to the bars?


Chart
This type of graph does not have the fancy zooming possibilities, but has more possibilities regarding customization and reacting to events. See below screenshot for an example:


You can try it out yourself here.

Pros

- The bars are clickable and that event can be handled, indicating the x and y of the item clicked.
- The graph is more customizable; for example the numbers in the bars can be removed.
- Different values (like week number) on the x-axis is probably possible (still out for investigating).
- All data is always visible in the current view.
- Customizable hover-over tooltip.
- Does not have the two (smaller) timeline bugs.

Cons

- No horizontal scrollbar or similar, thus for example showing 90 days looks quite "cramped", see the above screenshot. When making the browser smaller, day numbers start to overlap. Do-able, but not optimal. A horizontal scrollbar would be great!
- No space for showing a full date at the bottom. As a work-around the actual date could be added to the tooltip when hovering over a bar (in the screenshot it only says 26).
- No zooming.
- No out-of-the-box other graph modes (i.e like in the Timeline those are provided with it always).


Conclusion

For the project we chose the chart because it is a bit more customizable and the ability to click on a bar and do something with that event was most important requirement.


Sunday, May 2, 2010

Best of this Week Summary 26 April - 02 May 2010

  • Google's Chief Java Architect Josh Bloch "discusses many of the problems facing the Java community, including the ineffectiveness of J2ME, licensing problems, Java 7's late ship date, and even the JCP issues that James Gosling often opined about. He points out that these problems predate the Oracle acquisition of Sun, so everyone should just stop pointing their fingers at Larry Ellison."

  • Another Getting Started blogpost for a Mahout-Taste based movie recommendation engine, which uses Wicket as presentation layer.

  • Martin Fowler explaining Inversion of Control and suggesting to call it the Dependency Injection pattern. Notes that the Service Locator pattern can also remove the dependency, just as the DI pattern tries to. Describes which of these options to use. Finally he also gives pros/cons for constructor vs setter injection. Also pros/cons for configuration in the code or via configuration files.

  • Several Javascript performance-optimization tips taken at JSConf 2010.

  • An article "which looks at various storage mechanisms - JDBC, JPA, JavaSpaces, Java Content Repository, MongoDB, and DB4O, primarily - from the perspective of how good they are at CRUD operations and queries". The conclusion is that there is no one "best" mechanism, each has its own best application.

Sunday, April 18, 2010

Best of this Week Summary 12 April - 18 April 2010

Sunday, February 21, 2010

Best of this Week Summary 15 February - 21 February 2010

  • Expected that Mozilla uses Agile everywhere, and definitely on its flagship Firefox? Think again, only recently they started to combine Agile and more traditional Waterfall as their new development model, dubbed "Lorentz".

  • Tips for hardening your Tomcat installation. Other implementation guides, not only limited to Tomcat (also for example WebLogic) tips from U.S. DOD DISA (Defense Information Systems Agency) can be found here.

  • Always interesting to at least quickly browse through: a review of the 1993 code of Doom. And more "today": the code of Doom for the iPhone reviewed.

  • Think you know Javascript? Try one of these quizes!

Sunday, January 24, 2010

Best of this Week Summary 11 January - 24 January 2010

Sunday, December 13, 2009

Best of this Week Summary 07 December - 13 December 2009

Sunday, November 29, 2009

Best of this Week Summary 17 November - 29 November 2009

Sunday, November 15, 2009

Best of this Week Summary 09 November - 15 November 2009

Sunday, November 1, 2009

Best of this Week Summary 26 October - 01 November 2009

Sunday, October 11, 2009

Best of this Week Summary 05 October - 11 October 2009

  • A quite in-depth article on creating highly-scalable components in Java. Described are the ideas used to create the concurrent Java components in the Amino Library Project (a set of concurrent building blocks).

  • Another SOA Design Pattern sample chapter from Thomas Erl' book "SOA Design Patterns": "Service Governance Patterns, comprising a number of 8 patters. Compatible Change and Version Identification deal with service versioning. Termination Notification addresses the final phase of a service, it’s retirement. Service Refactoring explains how to deal with changing service contracts. Service Decomposition, Proxy Capability, and Decomposed Capability include techniques needed to express coarse-grained services through multiple fine-grained ones. Distributed Capability helps increasing service scalability through processing deferral."

  • To ESB or not to ESB? Including a nine points checklist. Note that the article is from the creator of Mule (a lightweight ESB). Check also the comments here.

  • Interesting hack to reduce startup latency for mobile devices with HTML5: put the Javascript code in comments (thus /* */), such that is immediately downloaded but not evaluated. Then to load it when needed, parse the text, strip out the comment-tags & do an eval().

Sunday, August 9, 2009

Best of this Week Summary 3 August - 9 August 2009

Saturday, July 4, 2009

Best of this Week Summary 29 June - 05 July 2009

Sunday, March 29, 2009

Best of this Week Summary 23 March - 29 March 2009

  • Need to know whether a collection is modified concurrently, which causes the ConcurrentModificationException? Check this handy wrapper solution here.

  • The second article in the Transaction strategies series. "Using examples from the Spring Framework and the Enterprise JavaBeans (EJB) 3.0 specification, explained is how the transaction models work and how they can form the basis for developing transaction strategies ranging from basic transaction processing to high-speed transaction-processing systems".

  • For the Amazon EC2 now a free AWS Eclipse plugin is available. It facilitates remote development, deployment, and debugging Java applications on Amazon Web Services.

  • Three common mistakes to avoid when implementing XML and webservices: don't make your messages too large, don't create too fine-grained services, and don't forget to create an XML schema.

  • Javascript is getting more and more important the last couple of years, so here's a bunch of best practices and efficiency tips.

Sunday, March 15, 2009

Best of this Week Summary 09 March - 15 March 2009

  • A table-based quick review of the following RIA frameworks: GWT 1.5, Laszlo 4.2, pure Javascript and Flex 3.2.

  • A short introduction on how ActionScript 3 differs (and not) from Java.

  • A wiki constructed with over four dozen architects: 97 things every software architect should know. Also now available as a book. It includes advice such as:

    • Don't Put Your Resume Ahead of the Requirements (Nitin Borwankar)

    • Chances Are, Your Biggest Problem Isn't Technical (Mark Ramm)

    • Communication Is King; Clarity and Leadership, Its Humble Servants (Mark Richards)

    • Simplicity Before Generality, Use Before Reuse (Kevlin Henney)

    • For the End User, the Interface Is the System (Vinayak Hegde)

    • It's Never Too Early to Think About Performance (Rebecca Parsons)


  • An introduction to Object Oriented CSS.

  • Sample chapter from Thomas Erl's latest SOA Design Patterns book, and an interview with him. He "talks about the main benefits of having a pattern catalog, SOA and Web services, the current state of SOA, the difference between SOA and service orientation, and the role of patterns in SOA adoption".

  • A series of five articles on setting up a Java Wicket project and implementing a frontend with it.

  • Handy piece of (alpha) software to test IE8 RC1, IE7, IE6 and IE5.5 on Vista and XP. Note that it looks like Microsoft is releasing IE8 this coming week, so get ready...

Sunday, March 8, 2009

Best of this Week Summary 02 March - 08 March 2009

Sunday, March 1, 2009

Best of this Week Summary 17 February - 01 March 2009

  • A relatively new type of mashups are so called clipping mashups. Instead of building a mashup against some official API, a clipping mashup just parses the final content in the presentation, thus including CSS, Javascript etc. Links can be rewritten, new elements injected. The presentation doesn't have to follow for example portal JSR-168 standards.
    An example use case would be that you could use it to (temporarily) fix a bug in a system (not necessarily owned by you) until the official next release comes out.

  • Eight architectural styles described. Handy overview including which one could be when appropriate.

  • Summary of migration project from JDBC to Hibernate. Valid comment at the bottom is that iBatis might be a better solution when you have to work from an existing schema.

  • Additional tips and articles for the Wicket in Action book. For example this article on how to do a partial Ajax repaint of newly created repeater items (e.g adding 1 row dynamically to a table or list with a "+" button). This in contrast to rendering all rows in a table when repainting the WebMarkupContainer as in the example described here.

  • Nice step-by-step introduction to asynchronous processing in Java 5 using Futures, ExecutorServices, CompletionService, Callback interfaces and ThreadPools. Here's part 2 where it's being used in combination with Javascript to improve the user experience.

Sunday, January 25, 2009

Best of this Week Summary 20 January - 25 January 2009

Sunday, January 18, 2009

Best of this Week Summary 12 January - 19 January 2009

Saturday, January 3, 2009

My clients are getting thicker and thicker: MVC implementation shift

Last week I stumbled over this interesting article on the potentially changing Model View Controller architecture implementations. (Sidenote: here's the more subtle distinction between MVC1 and MVC2 described. And here's an article on the ambiguity of the term and pattern MVC.)
An example logical diagram of MVC2 is shown below:


For quite some years, the general practice was to generate HTML as result of the View, with the browser rendering it and being the thin web client. These days though, more and more the web client is getting heavier ("fatter") because of all the Javascript being used for AJAX, SPI and, in general, more logic on the web client.
The article takes a look at the different approaches to MVC implementations:

  1. the HTML-only approach;

  2. the HTML+Javascript "basic" approach; some of the Model's "business logic" is duplicated on the client;

  3. the "AJAX" approach; partial views can be updated, the view consists of multiple HTML fragments, Javascript creates the View, not the application server;

  4. and the full-blown Javascript-only ("a la gmail") approach; Javascript in the browser creates the views, near-complete responsibility for the Model business rules in the web client (browser), the web client would be the Controller.

The approaches range from, at the one extreme end, the definitive "thin client", and at the other extreme end, the definitive "thick client"." Example frameworks that can easily facilitate the last option are Google Web Toolkit (Java to Javascript) and Pyjamas (Python to Javascript). Below GWT's architecture diagram is displayed. Note the (relatively) limited application server procedures, part of the Model, preferably only performing basic validation, security, etc.


The new MVC2 diagram for the above mentioned fourth approach would look something like this:

Included in the article is also how you could split up work in a team between people working on the View and Model parts.

I do not completely agree with the statement in the beginning of the article that says "The Web client takes care of keystrokes and mouse movements: the Web browser application itself is the Controller". I'm reading this as: the browser is the controller. Though, when you look at the first picture, that is not what the Controller is supposed to be.
But, in general the whole potential movement of going to thick clients is an interesting one to keep an eye on.
Other pros for thicker Javascript-based clients (not mentioned in the article) are:
  • Easier distribution of new versions than in the old days with fat clients like Visual Basic, where you had to make sure all clients got updated;

  • Easy opening up of your SOA webservices. The fat client could directly access them;

  • Easier mashup possibilities at the View layer via Javascript;

  • Potentially a large improvement in scalability: the client processing power is used as much as possible, the application server only performs several basic checks;

  • The Javascript generator/builder takes care of browser compatability.


Several cons are though:
  • Potentially quite significant longer page loading times when the Javascript all has to be loaded at once;

  • If not designed correctly, there could be significant extra network traffic;

  • Being dependent on the Javascript generator/builder when a browser is (not anymore) supported (though an opensource framework allows you to build it yourself if really needed).

Sunday, December 21, 2008

Best of this Week Summary 15 December - 21 December 2008