A short bandwagonesque view on python and ruby.
Monday 18 September 2006 @ 1:52 pm
Filed under:

[bandwagonesque mode on]

Back in the nineties OO Developers were either hard core c++ hackers or a more modest but effecient python programmers (or maybe japanese lone wolf ruby writers). Nowadays, script language practitioners are called script-kiddies and real developers use Java or C#. Ten years ago programming was all about compiling your human readable files into native machine code, today we talk about managed execution. Meanwhile dynamic langauges have always been subject to native interpreters, which during the years have been optimized in every possible dimension to get them performing. But also this niche of software development is moving. 2006 will be known as the year microsoft shipped IronPython and sun brought in the JRuby developers (Does that mean after the movement from sourceforge to codehaus, the project will move again to java.net???) Within a few years C# and java developers will become the old fashioned hackers and the rest of the programming population does OO in a more dynamic way. Want to follow the buzz?, see google’s visualizations here and here (and probably in the future here also) 

[bandwagonesque mode off]

By the way, do not forget to attend the JRuby on Rails Javapolis session this year. And another by the way, and that is why I used the bandwagonesque tags, non-mainstream languages and the concept of managed execution is not something new. Boo  and Groovy are just two codehaus examples but I think Scala and Nice are also worth mentoning. And as a final by the way, this slightly sceptical view on scripting languages just made me realise I started my career ten years ago with the most underappreciated scripting language in existence :-)

— By Okke van 't Verlaat   Comments (1)   PermaLink
what you describe, is a mess not an environment.
Sunday 10 September 2006 @ 9:49 pm
Filed under:

Sometimes a simple one liner found deep down in some active message forum thread is worth a seperate blog entry.

> Apollo is cross-platform desktop technology mix that
> allows you use Flex/xHTML/Ajax/PDF on desktop, use
> filesystem, DBs, networking and so forth.

“what you describe, is a mess not an environment.”

This quote, coming from (yet another) Javalobby discussion about the future of java on the desktop, hits the nail right on the spot. Due to the lack of a decent environment for application distribution we’re trying to fullfil the needs of richness with a mess of browser techniques that make application development look ancient again. We have spoiled our end users with the most fabulous human-being to machine interfaces and meanwhile, due to some rediculous narrowminded views on how end-users are allowed to access applications (actually do their job), we have been selling ‘no, sorry, not possible, technically unattainable’ for too many years. And instead of looking at a feasible solution for this problem, which indeed must be found in an environment and not in a trick, we keep on messing around with whatever technique as long as it is applicable within a browser. At this years JavaOne, Aerith has shown what is possible. The future of Java on the desktop is not a question, it is an idle void waiting to be filled. Maybe it is time to replace the internet browser for the sake of richness?

— By Okke van 't Verlaat   Comments (3)   PermaLink
Having fun with Spring AOP II
Wednesday 6 September 2006 @ 5:42 pm
Filed under:

After my initial explorations of the AspectJ-support offered by Spring, someone (actually, I think it was google again) pointed me to this article about the drawbacks of proxied aop. A good read written by Vincent Partington that shows the internals of  how and why a proxy based aop framework can ignore your carefully injected aspects. A ‘must-be-aware-of’ for every Spring 2.0 user!

One commenter on Vincent’s entry suggested one could use the not so stunning but efficient AopContext.getCurrentProxy() call instead of refering to the ‘this‘ pointer. Besides being not beautiful (actually it is butt ugly but that’s a matter of taste which reminds me that programming just like cooking is actually all about (good) taste), getting hold of a proxied twin is in complete contradiction with all principles of aop: Code and cross cutting concerns should be seperated. The fact code needs to be aware of being proxied is more a showstopper than a workaround.

Nevertheless, once accepted this contradictious aproach, the idea came in mind to address this as just an aspect of implementation, an architectural constraint so to speak: ‘Every class or method that is subject of being proxied must be aware of its proxy object‘ (Note, I still do not agree with this rather bold statement, it is just a hypothetical aspect that I’m using for the sake of the nation to have some fun with Spring AOP). How can such an aspect being implemented using Springs AOP features?
First of all, somehow a mechanism must be in place to denote proxy aware classes. To do so, I introduced a special annotation:

public @interface Proxied {}

And of course some point cuts reflecting the usage of this annotation are required:

@Pointcut(”@within(com.logicacmg.acsa.annotations.Proxied)”)
public void withinProxiedType() {}

@Pointcut(”@annotation(com.logicacmg.acsa.annotations.Proxied)”)
public void executingProxiedMethod() {}

The first pointcut refers to classes declared with the @Proxied annotation, the second one refers to the execution of methods decorated with this annotation. Note the subtile difference, the second pointcut gives a fine grained approach were to intercept and were not.

After the pointcut definitions, it is time for some goofy advice how to deal with the proxied execution of methods:

@Before(”(withinProxiedType() || executingProxiedMethod()) && this(proxy)”)
public void beAwareOfProxiedExecution(JoinPoint jp, Object proxy) throws Throwable {
  // ….. ????
}

A dirty (but what the hack, the whole problem smells) trick injecting the proxy into the usual suspecious subjects can be used at the // ….. ???? location. And for that, I’ve mixed the advice with some reflection sugar under the assumption every proxy aware class has declared a member field called ‘proxy’. The code is to long to post here but without field caching and exception catching it looks like this:

jp.getTarget().getClass().getField(”proxy”).set(jp.getTarget(), proxy);

Instead of using ((MyService)AopContext.getCurrentProxy()).someMethod it is now possible to use this.proxy.someMethod and as a bonus not every but only an exclusive set of classes is effected.

So what have I learned from this expedition? Well, not so much about the dangers of proxied aop, the previously mentioned article already let me frown. And not so much about proxy awareness either, that seems to be some kind of wicketness by nature. But more about the possibility to define annotations and put the actual semantics of these annotations in seperate aspects. And whether that is evil or not, is probably again a matter of taste. But at least it is a funny and even elegant way of processing annotations using Spring AOP.

 

Attached Files:


— By Okke van 't Verlaat   Comments (1)   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
GWT and IDEA, a happy marriage ?
Monday 24 July 2006 @ 4:56 pm
Filed under:

During the JavaOne, I already blogged about both GWT and IntelliJ. Today, I finally found a bit of time to start playing. While Teamserver has been renamed (renaming is not the right word, they brought it to the market and needed a sounding name) to TeamCity my attention was caught by the upcoming IDEA (their IDE) 6.0 release called Demetra and especially by the included GWT support (which has been available as plugin for a while). I’ve never used their IDE although during the years I’ve heard a lot of good rumours about it.

So, I downloaded the thing, registered for an evaluation license and off I was. And indeed within minutes I had my first GWT application up and running. Well, not actually within minutes, the first hour I was a bit overwhelmed by the amount of buttons, menu items and icons shown on screen. But after I found out about some of the basic concepts, everything seemed to go pretty smooth.

What I especially liked is the way IDEA generates service interfaces and implementations for remoting purposes. After starting a new (empty) gwt module, it is pretty straightforward to add entry points and to add remote services. Programming the ping-pong game between client and server is relatively simple. But I must say, it still is a bit primitive (nothing really fancy, just point and shoot so to say) but imho it looks like a good start. Of course it is waiting for graphical orchestration of client-server calls, a good gui builder and even some scaffolding tools for basic operations. And then maybe, while both GWT and IDEA are evolving, within just a few years, we’re developing web applications exactly the way we have been developing fat clients back in the nineties.

By the way, for those who are bound to their eclipse ide (3.2) and are already using the webtools platform (1.5), the exact same functionality can be found in the Googlipse plugin.

By the way, for those who still ask why to use GWT I have a pretty simple answer: It is a very elegant way to write a web application that manages state at the front (the gui) and in the back (your beloved rdbms for example) but can be completely stateless in between. But I agree inmediately, this is nothing but a matter of taste.

— By Okke van 't Verlaat   Comments (0)   PermaLink
Java podcasts
Wednesday 12 July 2006 @ 8:40 am

I have a new lease car. Like many other people, I have to go through the traffic jams that block up the highways here in the Netherlands every morning and every evening.I often listen to the radio while I’m in the car. The CD player in my new car has written “mp3″ on it with small letters - it can play MP3 files from CD-ROMs. This gave me an idea: I should find out how podcasting works, I could find some interesting podcasts, put them on a CD and listen to them while I’m in the car.

Podcasting works with RSS news feeds. The news messages in the RSS feed contain links to audio files. You can use a program like Juice to subscribe to RSS feeds and download the audio files, which you can then listen to on your computer, put on your MP3 player or on a CD.

So now I wanted to find some interesting podcasts. This article on O’Reilly’s OnJava website has links to some podcasts about Java.

So far I’ve downloaded a few of the podcasts from Java Posse (RSS podcast feed). There were a few interesting interviews, one with the product manager of Google who is responsible for the Google Web Toolkit, and one with some of the guys on the Swing team at Sun. They were talking about Aerith, a cool Swing demo program that they showed on JavaOne to demonstrate that you can make great looking applications with Swing (although it wasn’t easy to make a program like Aerith).

EclipseZone currently has a series of podcasts about the Eclipse Callisto release - it’s a series of ten podcasts, in which they’re interviewing people from each of the ten projects that are in Callisto.

If you know any other interesting podcasts, let me know!

— By Jesper de Jong   Comments (4)   PermaLink
JavaOne 2006: Google web toolkit takes down the new petstore
Wednesday 17 May 2006 @ 11:09 pm
Filed under:

The blueprints are back, The Petstore is back and Google smashes them exactly one hour later. What I’m talking about? This morning Sun did a presentation of their new Blueprints for Web 2.0 (sorry, it is not my choice of words) Applications. And to support their technical vision (what else is a generic blueprint) they reincarnated their Petshop. A lot of Dojo based bling bling, a lot of not easy to understand javascript and of course JSF. I also attended a session by Bruce Johnson and Joel Webber, both from Google, who presented their vision and their tool support for AJAX applications. Two complete different visions, two complete different worlds. Sun’s vision is all about their standards (JSF, EJB3), Google’s vision is focused on the regular web developer who do not understand the hairy javascript constructions needed to get a fancy interface. Sun’s vision does not look at the end-user experience at all (that is up to the developer). Google instead gives the developer the right instruments to support seamless end-user practice.

Google’s web toolkit has shown the light only one day ago and the blog-o-sphere is already filled with articles explaining what it is and what it does. So I’m not going into details (yet again standing behind a conference terminal and my back starts hurting) but I was pretty impressed by their innovative approach (They compile Java code into javascript!), their support for browser history aware ajax applications and their support for RPC (not only java based, in theory you can define the UI using Java, compile it to javascript and provide a PHP backend for service calls). The only practical problem I found after a quick scan through their website is the way they licenced the stuff. The javascript widget libraries are open source (apache based) but the actual compiler is as closed as an unlockable safe deposit box.

Of course, I’m writing this down just a few minutes after their marvelous act so the presented material still needs to land down smoothly in my java wasted brain but I’m already under the impression Sun’s blueprints might need a complete refresh.

— By Okke van 't Verlaat   Comments (0)   PermaLink
The StaleStateException, diving into hibernate to get around it
Monday 1 May 2006 @ 9:02 am
Filed under:

HibernateWho hasn’t seen the StaleState or NonUniqueObject exceptions while doing persistency with Hibernate? They tell you there might be a problem in your software design but according to their names, no clue what can be wrong. Here’s a simple �what is happening and ho to get around it’ recipe to solve this.
The StaleStateException describes the inconsistency of your objects versus the state of these objects in your database. This exceptions typically occurs when deleting an object that already was been deleted in the database. Therefore the exception will be something like:


Batch update returned unexpected row count from update….
Incorrect usage of your un-save strategy of your class will be the cause of this exception. Your application is not properly implemented considering your data manipulation saving strategy.


Example:
Suppose School and Student are common classes in your application. In two views school and student relationship can be adjusted. Only in one view the adjustment is saved by user interaction (push the save button). So in case of a deletion, the objects are deleted from the session but not directly saved. When flushing the Session, Hibernate will try to synchronize the state with the database and that will fail. The org.hibernate.jdbc.BatchingBatcher will check the expected row count and throws the exception. Mixing sequence scenarios with Junit is the best way to tackle this issue before functional testing.

NonUniqueObjectException will be thrown when two different instances of the same Java class with a particular identifier are in the scope of a single Session. The simple solution is not to load an object to the session if there is already a reference. Call the saveOrUpdateCopy at the beginning of a transaction to avoid this exception (or merge in Hibernate3).
Another possible issue can be the definition of your mappings. Make your relations unidirectional, this prevents loading from childs object also the parent object
Or by not deleting all objects used in a bidirectional association, for example


parent.getChildren().remove(child);
child.removeParent(parent);


May these tips help in your dive :-)

Resources:
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/StaleStateException.html
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/NonUniqueObjectException.html
http://www.jroller.com/page/maximdim?entry=hibernate_batch_update_returned_unexpected (demonstrate the StateStateExeption with a Junit test)
http://www.hibernate.org/116.html (hibernate common faq)

 

 

— By Wido van der Burg   Comments (0)   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
Duncan Mills speaks on Guru4Pro
Thursday 23 March 2006 @ 3:40 pm
Filed under:

As Okke stated earlier, Duncan Mills has made a visit to the Netherlands to speak on an event called Guru4Pro. Guru4Pro is a series of presentations given by knowledgable guru’s. The first of these presentations was given by Duncan Mills of Oracle. Duncan has been working in the field for 18 years in total, of which 14 years for Oracle. Duncan started on the support department but quickly switched to product development. Currently he is developing the ADF framework, the framework we use for application development.

The presentation was called ‘The rise (and rise) of the meta-framework’. The presentation gave a clear view into the world of frameworks and meta-frameworks. Duncan first started by explaining what a framework exactly is. His view is that every (competent) developer will build there own convenience libraries to make their own life easier. I personally like the comment “If your developers aren’t constantly developing their own libraries to make their job easier, you should fire them and hire others.” It make the point clear that deep down everybody should be thinking about extracting the ‘dumb’ and ‘easy’ stuff and letting libraries do that for you. However a library, or a set of libraries isn’t a framework…

A framework is a complete solution for a specific problem, a point solution. Good examples are Toplink, Hibernate, Struts, JSF, EJB, Spring, etcetera. Frameworks should be applicable for more than one solution, they should be flexible enough to solve the problem every time for each application you make. A good framework at least.
Duncan further stressed the criteria he feels a (good) framework should fill (i list here only a few):

  • Coverage and depth: a framework should do everything you need. If it won’t (say your persistence framework cannot do updates) you won’t use it
  • Documentation & User guidance: a good framework should just give you a set of API’s. If the framework is to succeed you need to explain the framework in documentation and it should provide guidance in the way to solve problems, the right way
  • Infrastructure not generation: a framework provides the plumbing, it does not generate code. If you just generate code you’ll have problems during maintenance. Frameworks abstract and solve the problems
  • Pluggability: the meta-framework should work with different frameworks. And it should work exactly the same
  • And last but not least ‘a cool name’: has anybody heard of the Oracle MVC framework? No, but Spring rings bells. Spring is a cool name

After defining what a framework was, Duncan gave the term ‘meta-framework’ a meaning. A meta-framework is a framework that combines all kinds of frameworks to provide a complete solution. The meta-framework should integrate the frameworks and make sure they work together correctly. The developer using the meta-framework should be able to do things in a consistent way without bothering about the underlying frameworks.

Duncan gave an example using the Oracle ADF framework (the new one based on JSF) and Oracle JDeveloper 10.1.3. First he wizarded two kinds of datasources together. Nobody will be to overly impressed by an IDE that can give you a wizard that can generate your persistence layer. However he created a persistance layer based on Toplink and EJB 3.0 session beans, next to that he created another persistance layer based on Oracle Business Components. Next we went on to the UI. Duncan showed that using the meta-framework and abstractions that Oracle ADF gives the developer to possibility of using data sources as just a source of data without thinking about the implementation. He could drag-and-drop the Toplink and EJB based data on a JSF page the same way as the Oracle BC based data. After that he showed how to integrate those two sets of data and synchronize them. You could now browse the department data (via the Toplink and session EJB) and see the relevant employee list (via Oracle BC) and without much ado those two different data sources were combined. Personally i found this a really good demo, it was pleasing to see something else than the usual slick sales manager click-through. Duncan later told me he only thought up this demo a few hours before the presentation; he also thought it was good the show something closer to reality.

After the Oracle ADF demo the presentation went on over meta-frameworks. The only other framework that comes close to meta-frameworkness was Spring. Both Oracle ADF and Spring come close, but neither are there completely yet. Both meta-frameworks revolve around their key-ability to glue frameworks together. Oracle ADF used the ADF Model Binding layer and Spring uses the bean factory. Spring for example has better security support than Oracle ADF, but Oracle ADF has better tool support.

The last part of the presentation was about trends that are comming. The latest trend is that the standards are behaving differently and comming up to par with proprietary (not in the sense of ownership, but in the sense that it isn’t the standard) frameworks. JSF has come to replace Struts. EJB 3.0 is comming for Toplink and Hibernate. Duncan explained that when the standards are getting better, the frameworks will be getting thinner and thinner and finally will fade as a framework a become an implementation of the standard. Meta-frameworks are rising and will rise in the future.

One of the most enlightning things were the challenges Duncan named. He said that meta-frameworks have a few (few?) challenges ahead. One of the challenges is debugging. Debugging should be abstracted just as development is. Why should you be thrown in the framework source code when you only created a XML to configure something? You shouldn’t, Duncan formulated this very eloquently by stateing (cannot produce the exact quote but it was something like) ‘Frameworks have recognized the debugger, debuggers have yet to return the favour’. Dbuggers will have to become ’smarter’ or maintenance will be problematic.
Another challenge that we developer and i myself am constantly struggling with is State Management. At the moment the only problem i have with state management is the fact that i have a heck of a problem because users want to use that ‘back button’ in their browser. They also want to use the ‘Open in new window/tab’ functionality and have the application react correctly. With our applications it isn’t working. Fortunately the meta-framework developer has also recognized this problem and is working on it. This was one of my most pleasant surprises: They (they is Oracle here) actually have a (good) clue about the problems in facing when using their product (framework) and they are working on it!

As all presentations end, this one was also concluded with a refreshing drink and talk in the internal bar at LogicaCMG (yes, the cafeteria actually also has a small bar. Big plus for any employer)

A few collegaes and i also had the pleasure to meet Duncan before the presentation and the next day to talk about all sorts of stuff. We could talk freely about the pro’s and cons of the Oracle ADF framework and hear what Oracle is doing with it. Duncan is very knowledgable about the framework and is a real pleasure talking about it. You can really fell that he has a passion for the work he is doing and that he believes this is the right way to go.

I would like to thank Duncan again for his presentation and would recommend everybody to attent a presentation of Duncan if they can.

You can download the presentation here. It contains the slides including comments written by Duncan to explain the story fully.

PS. [shameless plug]Look at the Guru4Pro presentations. They are free to attend, you’ll like them.[/plug]

Links
Duncan Mills’s Weblog
The slides and comments of the presentation given by Duncan
Guru4Pro

— By Robert Willems of Brilman   Comments Off   PermaLink
« Previous PageNext Page »

Menu


Sha256 mining

Blog Categories

Browse by Date
July 2007
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031EC

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