<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>André Pareis</title>
	<atom:link href="http://apareis.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://apareis.wordpress.com</link>
	<description>COMPUTER SCIENCE, PHILOSOPHY AND ANYTHING</description>
	<lastBuildDate>Mon, 02 Jan 2012 13:40:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='apareis.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/46f2246127a0d59c26c4429e814ba7a2?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>André Pareis</title>
		<link>http://apareis.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://apareis.wordpress.com/osd.xml" title="André Pareis" />
	<atom:link rel='hub' href='http://apareis.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Play module &#8220;associations&#8221; 1.0 released</title>
		<link>http://apareis.wordpress.com/2011/07/26/play-module-associations-1-0-released/</link>
		<comments>http://apareis.wordpress.com/2011/07/26/play-module-associations-1-0-released/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 21:00:45 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[play-framework]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=276</guid>
		<description><![CDATA[Today I have released version 1.0 of the play [associations] module. I would like to elaborate a bit more on the rationale for this module. Imagine the following simple model: public class Forum { @OneToMany(cascade=CascadeType.ALL, mappedBy="forum") public List&#60;Post&#62; posts; }  public class Post { @ManyToOne public Forum forum; } In model management there are 3 &#8230; <a href="http://apareis.wordpress.com/2011/07/26/play-module-associations-1-0-released/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=276&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I have released version 1.0 of the play [<a title="associations" href="http://www.playframework.org/modules/associations" target="_blank">associations</a>] module. I would like to elaborate a bit more on the rationale for this module.</p>
<p>Imagine the following simple model:</p>
<pre>public class Forum {
    @OneToMany(cascade=CascadeType.ALL, mappedBy="forum")
    public List&lt;Post&gt; posts;
} 
public class Post {
    @ManyToOne
    public Forum forum;
}</pre>
<p>In model management there are 3 phases, creation, manipulation and deletion. Under normal conditions (read play without associations module) these would be implemented like this:</p>
<h3>1. Object creation and association creation</h3>
<pre>Forum forum = new Forum();
Post post = new Post();
forum.posts.add(post);
post.forum = forum; // don't forget this
forum.save(); // using CascadeType.ALL etc. this will cascade</pre>
<h3>2. Manipulation of existing objects</h3>
<pre>Post post = ...
post.forum.posts.remove(post); // don't forget this
Forum forum2 = new Forum();
forum2.posts.add(post);
post.forum = forum2; // don't forget this
forum2.posts.add(post);
forum.save(); // cascades
forum2.save(); // cascades</pre>
<h3>3. Deletion of objects</h3>
<pre>// this can be accomplished using
public class Forum {
  @OneToMany(cascade = CascadeType.ALL, orphaneRemoval = true)
  public List&lt;Post&gt; posts;
}
Post post = ...
post.forum.posts.remove(post);
post.forum = null; // don't forget this
forum.save();</pre>
<p><em><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;white-space:normal;font-size:13px;">Now fast forward to an implementation *with* the associations module, this all gets much easier and intuitive to write:</span></em></p>
<h3>1. Object creation and association creation</h3>
<pre>Forum forum = new Forum();
Post post = new Post();
forum.posts.add(post);
forum.save(); // using CascadeType.ALL etc. this will cascade</pre>
<h3>2. Manipulation of existing objects</h3>
<pre>Post post = ...
Forum forum2 = new Forum();
forum2.posts.add(post);
forum.save(); // cascades
forum2.save(); // cascades</pre>
<h3>3. Deletion of objects</h3>
<pre>Post post = ...
post.forum = null;
forum.save();</pre>
<p><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;white-space:normal;font-size:13px;">IMO this is much more intuitive. If you add a post to a forum, you&#8217;d expect that the previous forum does not reference it any more, wouldn&#8217;t you? Also, if you make a change on one side, you&#8217;d expect that the corresponding change on the other side is also made, wouldn&#8217;t you?</span></p>
<p>And this is exactly what this module provides, complete management of all JPA two-sided associations.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=276&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2011/07/26/play-module-associations-1-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>
	</item>
		<item>
		<title>Transparent Bi-directional Associations in Play</title>
		<link>http://apareis.wordpress.com/2011/07/22/transparent-bi-directional-associations-in-play/</link>
		<comments>http://apareis.wordpress.com/2011/07/22/transparent-bi-directional-associations-in-play/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 11:40:42 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[play-framework]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=270</guid>
		<description><![CDATA[Do you find writing code like this cumbersome and error prone? forum1.posts.remove(post); post.forum = forum2; forum2.posts.add(post); Wouldn&#8217;t it be much easier if you could just write post.forum = forum2; and the system handles all the wiring and rewiring for you? With the benefit of eliminating errors like &#8220;detached entity passed to persist&#8221; and such? I &#8230; <a href="http://apareis.wordpress.com/2011/07/22/transparent-bi-directional-associations-in-play/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=270&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Do you find writing code like this cumbersome and error prone?</p>
<pre><code>forum1.posts.remove(post);</code>
<code>post.forum = forum2;</code>
<code>forum2.posts.add(post); </code></pre>
<p>Wouldn&#8217;t it be much easier if you could just write</p>
<pre><code> post.forum = forum2; </code></pre>
<p>and the system handles all the wiring and rewiring for you? With the benefit of eliminating errors like &#8220;detached entity passed to persist&#8221; and such?</p>
<p>I have created a play module that does just that. Whenever you invoke one of the operations that changes a part of the association from whichever side, then the module completes this operation on all other affected parts. This includes not only the new target and its opposite reference, but it also manages to unlink a target object from its current associated object. All hassle free and safe. It works on <code>@OneToOne</code>, <code>@OneToMany</code> and <code>@ManyToMany</code> associations.</p>
<p>There are no dependencies introduced in your code. The module enhancer works on all properties of your @Entity classes having a &#8220;mappedBy&#8221; attribut on the @OneToOne, @OneToMany or @ManyToMany annotation. You do not need to declare anything else. The presence of the module is sufficient.</p>
<p>You can check it out at <a href="https://github.com/pareis/associations">https://github.com/pareis/associations</a> and as soon as available in the play modules repository.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/270/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/270/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=270&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2011/07/22/transparent-bi-directional-associations-in-play/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Develop a Facebook App on Your Local Server using SSH</title>
		<link>http://apareis.wordpress.com/2011/06/09/how-to-develop-a-facebook-app-on-your-local-server-using-ssh/</link>
		<comments>http://apareis.wordpress.com/2011/06/09/how-to-develop-a-facebook-app-on-your-local-server-using-ssh/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 21:14:04 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=258</guid>
		<description><![CDATA[When you develop for facebook you usually run you app on your developer machine and connect a test app in Facebook with the local installation. Once finished, you put the final app onto some dedicated server and connect the real Facebook app to that. So setting up the local development environment usually includes some network &#8230; <a href="http://apareis.wordpress.com/2011/06/09/how-to-develop-a-facebook-app-on-your-local-server-using-ssh/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=258&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you develop for facebook you usually run you app on your developer machine and connect a test app in Facebook with the local installation. Once finished, you put the final app onto some dedicated server and connect the real Facebook app to that. So setting up the local development environment usually includes some network setup, for instance as described here: <a href="http://www.insidefacebook.com/2007/07/16/how-to-local-facebook-app-development/">http://www.insidefacebook.com/2007/07/16/how-to-local-facebook-app-development/</a> However, I find these router and network setup design troublesome and I also want something that is flexible, especially when I switch from desktop to mobile development.</p>
<p>If you have access to a dedicated, root or v-server on the internet, you can achieve a very easy network setup using ssh port forwarding. You basically use the internet box as the target url for your Facebook app and forward some port from that internet port to your local test web server over the ssh tunnel. By doing so, you are totally mobile, you can open the port on the internet box from anywhere you want.</p>
<p>So, let&#8217;s say you configured your facebook app &#8220;myapp&#8221; like this:</p>
<p><a href="http://apareis.files.wordpress.com/2011/06/pastedgraphic-3.png"><img class="alignnone size-full wp-image-259" title="pastedgraphic 3" src="http://apareis.files.wordpress.com/2011/06/pastedgraphic-3.png?w=750" alt=""   /></a></p>
<p>You see in this example that facebook will tell your browser to load the iframe content from the URL <a href="http://my-domain.com:9090/">http://my-domain.com:9090/</a> that is on port 9090. So you need to forward this port 9090 to your developer machine.</p>
<p>In order to forward ports on public network interfaces you will mostly need to enable the &#8220;GatewayPorts&#8221; option in the ssh server of you internet box. This is a setting in the /etc/ssh/sshd_config (Debian):</p>
<p>just add the following line to /etc/ssh/sshd_config:</p>
<pre>GatewayPorts yes</pre>
<p><span class="Apple-style-span" style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;white-space:normal;font-size:13px;">and</span></p>
<pre>/etc/init.d/ssh restart</pre>
<p>Then you can start forwarding the port to your local machine. Just issue an</p>
<pre>ssh -R '*:9090:localhost:9000' me@my-domain.com</pre>
<p>It will look like you just only logged into the remote machine but in addition to that, a tunnel has been opened from port 9090 remote to port 9000 local. So if you have something listening on your local machine on port 9000, i.e., your development web server, than you can point the browser to your facebook app:</p>
<p><a href="http://apps.facebook.com/myapp">http://apps.facebook.com/myapp</a></p>
<p>and it will display the content as retrieved via the tunnel (9090) from your local machine (9000). As soon as you close the ssh connection, the tunnel will also be gone and you can then initiate the same ssh connection from you laptop if you are going outside.</p>
<p>The biggest benefit of this solution is that you will never have to change IP addresses anywhere, not in the facebook app setting, not at dyndns etc. This is especially useful if your IP address changes frequently like on mobile internet.</p>
<p>Pretty simple, and no need to configure multiple apps for multiple environments. Just move and reconnect via ssh. If you want, you can easily do the next step and put a web server like Apache or nginx on the internet box. From there you can reverse proxy from a certain virtual host (e.g., dev.my-domain.com) to your forwarded port on the same machine (9090). In a setup like this, you would not need to enable the &#8220;GatewayPorts&#8221; option in the ssh server, because then it would be sufficient to listen only on the local interface (127.0.0.1:9090). Such a setup would be a little closer to most production setups with load balancers and such.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/258/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=258&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2011/06/09/how-to-develop-a-facebook-app-on-your-local-server-using-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2011/06/pastedgraphic-3.png" medium="image">
			<media:title type="html">pastedgraphic 3</media:title>
		</media:content>
	</item>
		<item>
		<title>Beware of this: play framework&#8217;s cascaded save() only works on loaded collections</title>
		<link>http://apareis.wordpress.com/2011/04/26/beware-of-this-play-frameworks-cascaded-save-only-works-on-loaded-collections/</link>
		<comments>http://apareis.wordpress.com/2011/04/26/beware-of-this-play-frameworks-cascaded-save-only-works-on-loaded-collections/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 19:47:59 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[play-framework]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=250</guid>
		<description><![CDATA[I am currently developing a web application using the really excellent play framework. If you are a web developer with some Java background I strongly encourage you to give it a try. However, play has taken a little different or let&#8217;s better call it an additional approach to control object synchronizations with the underlying database. &#8230; <a href="http://apareis.wordpress.com/2011/04/26/beware-of-this-play-frameworks-cascaded-save-only-works-on-loaded-collections/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=250&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am currently developing a web application using the really excellent <a href="http://www.playframework.org/">play framework</a>. If you are a web developer with some Java background I strongly encourage you to give it a try.</p>
<p>However, play has taken a little different or let&#8217;s better call it an additional approach to control object synchronizations with the underlying database. Whereas JPA manages a loaded object graph and automatically persists any changes upon transaction completion, play has <a href="http://www.playframework.org/documentation/1.2/jpa#save">changed this behavior</a> (&#8220;Explicit save&#8221;) to give the beginner more control over what is going on with the objects. This extension turns the implicit save mechanism into an explicit one where the developer is in control to call save() on the changed objects. This save() will in turn cascade (if for instance the CascadeType.ALL annotation option is present) to the reachable objects.</p>
<p>This might in the first place seem clever because you get control back but I have mixed feelings about it because there are cases where it does just not work as easily as expected.</p>
<p>As an example, imagine a 3-level parent-child object model.</p>
<pre>@Entity
public class Item extends Model {

 @OneToMany(cascade = CascadeType.ALL, orphanRemoval=true, mappedBy="item")
       @OrderBy("createdAt")
 public List&lt;Position&gt; positions = new ArrayList&lt;Position&gt;();
}

@Entity
public class Position extends Model {

 public Date createdAt = new Date();
 public int quantity;

 @ManyToOne public Item item;

 @OneToMany(cascade = CascadeType.ALL, orphanRemoval=true, mappedBy="position")
 @OrderBy("createdAt")
 public List&lt;Order&gt; orders = new ArrayList&lt;Order&gt;();
}

@Entity @Table(name="Ordr")
public class Order extends Model { 
 public Date createdAt = new Date();
 public int quantity;

 @ManyToOne public Position position;
}</pre>
<p>So far nothing complicated. But now imagine you are loading (for performance reasons) objects from the lowest level (Order) and manipulate the parent object (i.e., the Position).</p>
<pre>public void dostuff(Item item) {

 // load orders according to some important criteria
 List&lt;Order&gt; orders = Order.find("position.item = ? order by createdAt", item).fetch();

 // manipulate the parent of the order (the Position)
 Order order = extractImportantOne(orders);
 order.position.quantity += 200;

 item.save();
}</pre>
<p>Intuitively I would assume that the manipulated Position object is updated in the database through the Item.positions cascade settings. But this is not the case here! The reason is that the collection Item.positions has not been populated from the database. Thus, play sees an unintialized PersistentCollection and will simply ignore to cascade.</p>
<p>One solution to the problem would be to touch the cascading collection:</p>
<pre> item.positions.size();
 item.save();</pre>
<p>This will make sure the &#8216;positions&#8217; collection will be considered during the following call to save(). With pure JPA on the other hand, such a call to do the trick would never be necessary and also the call to save() could be avoided, because JPA knows all loaded and changed objects and automatically updates the database.</p>
<p>This is why I have very mixed feelings about play&#8217;s extended persistence API. It works well in simple cases but for more complex models it might be better to switch back to plain JPA mode.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/250/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=250&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2011/04/26/beware-of-this-play-frameworks-cascaded-save-only-works-on-loaded-collections/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>
	</item>
		<item>
		<title>Why I completely dropped Qt and QtWebKit from my Hybrid App</title>
		<link>http://apareis.wordpress.com/2010/04/22/why-i-completely-dropped-qt-and-qtwebkit-from-my-hybrid-app/</link>
		<comments>http://apareis.wordpress.com/2010/04/22/why-i-completely-dropped-qt-and-qtwebkit-from-my-hybrid-app/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 16:15:09 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[hybrid apps]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[QtWebKit]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=230</guid>
		<description><![CDATA[In my recent articles I described certain aspects related to the use of QtWebKit in a hybrid C++ application. In the meantime, it turned out that Qt and QtWebKit are not such a good bet as I thought they would be at the beginning. Here&#8217;s why: Apple First and foremost, the most interesting question in &#8230; <a href="http://apareis.wordpress.com/2010/04/22/why-i-completely-dropped-qt-and-qtwebkit-from-my-hybrid-app/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=230&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my recent articles I described certain aspects related to the use of QtWebKit in a hybrid C++ application. In the meantime, it turned out that Qt and QtWebKit are not such a good bet as I thought they would be at the beginning. Here&#8217;s why:</p>
<h3>Apple</h3>
<p>First and foremost, the most interesting question in a hybrid app written in C++ is: where do you want it to run? In my case, it is on Mac OS X in the first place, then on Windows and very likely also on Apple&#8217;s iPhone or iPad. However, this puts me in a situation where I have to decide which subset of these platforms I support primarily and which ones secondarily as there is no such thing as a common layer to access all of them from a single code base. It is either a combination of Mac OS X and Windows via the Qt port or a combination of Mac OS X and iPad/iPhone that can go as the primary target.<br />
<a href="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-24-48.png"><img class="alignnone size-full wp-image-231" title="bildschirmfoto 2010 04 22 um 22 apr 15 24 48" src="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-24-48.png?w=750" alt=""   /></a></p>
<p>For a certain time, I concentrated on the first combination as shown above while hoping that time works for me and somebody ports Qt to the iPhone, and there already is a project for that at <a href="http://www.qt-iphone.com/Introduction.html" target="_blank">http://www.qt-iphone.com/Introduction.html</a>. But, in the meantime, Apple introduced iPhone OS 4.0 and *bam* there will never be such a thing, because <a href="http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler" target="_blank">http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler</a> <em>&#8220;and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited)&#8221;</em>, a rule introduced by Apple which is actually targeted against Adobe and its Flash technology but will also affect Qt, especially because that comes from Nokia, another one of Apple&#8217;s (future arch) rivals. This means that Qt can never be the common layer on all of my targeted platforms. Given that, and the fact I target Mac OS X first, Windows second, and that I also tend to shift Windows one step further down and promote the iPad version instead which completely changes the porting picture:<br />
<a href="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-25-00.png"><img class="alignnone size-full wp-image-232" title="bildschirmfoto 2010 04 22 um 22 apr 15 25 00" src="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-25-00.png?w=750" alt=""   /></a></p>
<p>This looks much cleaner now as it provides unified, access to all Apple platforms. For Windows and Android Google Chromium is a good choice.</p>
<p>But what about Qt in general?</p>
<h3>Qt / Nokia</h3>
<p>The first part was the rational part, here comes the emotional one:</p>
<p>In the recent weeks I had enough time to dive into the details of Qt in all aspects. Its visual quality, its API quality, its implementation quality and the quality and structure of their development process. My conclusion from that is that it is the wrong way of doing things as evaluated from a broader perspective.</p>
<p>What is very important in a visual app is visual quality. Qt does a good job in replicating functionality of controls on each addressed platform. But, it can never, by its nature, take care about the special controls certain platforms offer because then it wouldn&#8217;t be cross-platform any more. By driving the GUI via Qt controls, an application loses the capability to provide the eye-candy to the platform user like he is used to. The most prominent example of this is Google Maps which is based on Qt and which totally lacks platform L&amp;F on the Mac up to a degree where it certainly loses style. In Google Maps this is not so important as interaction with the Earth requires a special user interface anyway and the rest of the app is unimportant, but it shows how difficult it is even for Google to provide attractive visual quality on the platform. Gaining access to the platform specialities is difficult as everything is hidden by Qt in private implementations. You have no chance to do &#8220;that special thing&#8221;.</p>
<p>Qt has a comprehensive &#8220;fat&#8221; API that consumes everything from all platforms and which has to take care about the specialities on all platforms, which is of course its nature but which is also very difficult to maintain and to improve over years. Development of Qt is distributed across Europe with Nokia focussing on minimizing cost not maximizing quality. Their development centers are mostly in cheaper Eastern Europe and they try to cooperate with educational institutions. This might be a legacy from Trolltech but is still in place and shows that quality is not their first concern.</p>
<p>So far I have touched Qt releases 4.5, 4.6 and 4.7 and came across older API documentations. From there I can tell that many things they have done are not very well and strategically thought out. They introduced too many APIs doing similar things and deprecating previous ones (QML, QtQuick, Scripting with QtScript and in QtWebKit, Qt3 vs. Qt4, QGraphicsScene, QItemView, QtDesigner, QtCreator). To me this is too much feature driven and dictated by the progress of other market players. Then I saw these super new technologies contrasted by very basic demo videos in YouTube showing excitement over very basic features which is not very professional &#8211; you can check out their channel on <a href="http://www.youtube.com/user/QtStudios">http://www.youtube.com/user/QtStudios</a> to get an idea. What I want as a consumer of platform technology building a commercial grade application is that the selected platform is very stable and well thought out. But there is just too much noise coming from Qt and to make matters worse, none of the new features really feels final, it feels more like work in progress and you can never know how long something survives. Last not least, one day down the road Nokia might become a rival again to Apple just as relevant as Google now is. Economically speaking, Nokia already is, but Apple sees Google as its main competitor, not Microsoft and not Nokia. They are just not in the same technology league any more. Apple and Google have the brains now.</p>
<p>Don&#8217;t get me wrong, the Qt guys are doing a good job and they surely do it with a lot of enthusiasm, all I want to say is that Qt is just not the best bet in a commercial hybrid application. That is why I gave up on it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=230&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/04/22/why-i-completely-dropped-qt-and-qtwebkit-from-my-hybrid-app/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-24-48.png" medium="image">
			<media:title type="html">bildschirmfoto 2010 04 22 um 22 apr 15 24 48</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/04/bildschirmfoto-2010-04-22-um-22-apr-15-25-00.png" medium="image">
			<media:title type="html">bildschirmfoto 2010 04 22 um 22 apr 15 25 00</media:title>
		</media:content>
	</item>
		<item>
		<title>Accessing the Original WebKit API in QtWebKit Hybrid Apps</title>
		<link>http://apareis.wordpress.com/2010/03/23/accessing-the-original-webkit-api-in-qtwebkit-hybrid-apps/</link>
		<comments>http://apareis.wordpress.com/2010/03/23/accessing-the-original-webkit-api-in-qtwebkit-hybrid-apps/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 12:29:36 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[hybrid apps]]></category>
		<category><![CDATA[QtWebKit]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=202</guid>
		<description><![CDATA[Everybody wraps WebKit For each and every port of WebKit, be it Safari, Chrome, QtWebkit, there is always a wrapper around the WebKit object model. These wrappers function as language mappers, e.g., in case of Safari C++ API is mapped to Objective-C, and as a simplification layer around the complex WebKit API. The first case &#8230; <a href="http://apareis.wordpress.com/2010/03/23/accessing-the-original-webkit-api-in-qtwebkit-hybrid-apps/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=202&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Everybody wraps WebKit</h3>
<p>For each and every port of WebKit, be it Safari, Chrome, QtWebkit, there is always a wrapper around the WebKit object model. These wrappers function as language mappers, e.g., in case of Safari C++ API is mapped to Objective-C, and as a simplification layer around the complex WebKit API. The first case makes total sense, as no developer familiar with Cocoa and Objective-C will like to take an excursion (back) to C++. On the other hand, the Chrome port as well as the Qt port expose a C++ API towards their developers and completely hide the WebKit API despite that this is also already written in C++. Within the C++ universe, I do not understand why the original WebKit API is such a bad bet and must be hidden under all circumstances (I derive this from the fact that everybody hides it)? Is it really that evil?</p>
<p>WebKit API is very stable as it is a reflection of HTML and XML and all the things used in the browser for years and which do rarely change, so a dependency should be acceptable. The only benefit is that the Qt developer works solely with the Qt API or the Chromium developer with a Chromium API. This is ok in case of very simple integration with WebKit, like displaying some external web content in an otherwise traditional application or when implementing a browser. But not in a hybrid application! In a hybrid application I want much more control over the internals of the browser. I do not consider it evil. I consider it as a very nice work horse doing most of the rendering and layout work. I want to reference DOM elements from my application and I want the DOM to interact with my application. I want to replace the excessive use of JavaScript found in Web 2.0 apps with excessive C++ – I do not want JavaScript in a hybrid app, I want C++ only!</p>
<p>In case of QtWebKit, how hard is to get access to the original WebKit API? It is very hard, as the necessary headers are all eliminated from the QtWebKit API and all WebKit symbols are local in the compiled DLL or OS X framework However, I have taken the pain and hacked me into it. The steps required to expose the WebCore API via QtWebKit are:</p>
<h3>Get the source tree from Qt git</h3>
<p>You will need to build from source. So, get it from <a href="http://qt.gitorious.org/qt">http://qt.gitorious.org/qt</a> and switch to the desired branch or tag.</p>
<h3>Configure Qt just as normal</h3>
<p>configure it but do not run make now!</p>
<h3>Adjust the compiler flags for WebCore</h3>
<p>run the following commands in the source tree</p>
<pre>sed -i -e 's/-fvisibility=hidden//g' src/3rdparty/webkit/{Web,JavaScript}Core/Makefile.*
sed -i -e 's/-fvisibility-inlines-hidden//g' src/3rdparty/webkit/{Web,JavaScript}Core/Makefile.*</pre>
<p>(or change these the Makfiles manually) This will compile WebCore in way to expose all internal symbols later in the DLL or framework.</p>
<h3>Gain access to the WebKit API</h3>
<p>In src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h make QWebElement::m_element public</p>
<p>This is just one way to do it (see later for an alternative)</p>
<h3>Build Qt</h3>
<p>Now run the normal make; make install</p>
<h3>Add WebKit header files and defines to your .pro file</h3>
<p>The application code needs to include the WebCore header files.</p>
<pre>DEFINES += QT_SHARED ...
release:DEFINES += NDEBUG
INCLUDEPATH += /Users/andre/src/qt/git/src/3rdparty/webkit/WebCore/bridge/qt \
    /Users/andre/src/qt/git/src/3rdparty/webkit/WebCore/page/qt \
    ...</pre>
<p>This is a very shortened version to save space here. See the full set of defines in this file: <a href="http://apareis.files.wordpress.com/2010/03/myapp-pri.doc">myapp.pri</a></p>
<p><a href="http://apareis.files.wordpress.com/2010/03/myapp-pri.doc"></a>The order is important. Replace /Users/andre/src/qt/git with the home of your Qt source tree. Some defines are very important and some might be just optional, I just took all of them from the effective compile command when Qt was built.</p>
<h3>Include WebCore headers in application code</h3>
<pre>#include &lt;WebCore/html/HTMLElement.h&gt;
#include &lt;WebCore/platform/text/PlatformString.h&gt;
#include &lt;WebCore/platform/text/CString.h&gt;
#include &lt;WebCore/svg/SVGElement.h&gt;
...</pre>
<h3>Alternative access to QWebElement::m_element</h3>
<p>Instead of changing the visibility of the &#8220;m_element&#8221; member from private to public, it would also be possible to use a fake subclass in the application code with a public member m_element like here:</p>
<pre>class HackWebElement: public QWebElement {
public:
WebCore::HTMLElement *m_element;
};</pre>
<p>and then gain access to it by down-casting a QWebElement to a HackWebElement:</p>
<pre>QWebElement webElement = ...;
HackWebElement *hwe = (HackWebElement*)&amp;webElement;
// now we can access hwe-&gt;m_element</pre>
<p>You can also use your preferred method to access a private member in C++ <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Using the WebKit API</h3>
<p>Now I can do fancy stuff with the WebKit API. Here is an example where I create an SVG element programmatically, i.e., without the need to have WebKit parse some HTML (or XML in this case):</p>
<pre>WebCore::QualifiedName svg("svg", "svg", "http://www.w3.org/2000/svg");
RefPtr&lt;WebCore::SVGElement&gt; nel = WebCore::SVGElement::create(svg, hel-&gt;document());
WebCore::String s = nel-&gt;tagName();
debug(string(s.utf8().data()));
if(nel) {
    debug("it's a WebCore::SVGElement!!!");
}</pre>
<h3>Conclusion</h3>
<p>So far, I have only gained initial access to the internal browser DOM as a first step. This way I can create DOM elements programmatically. In the future, I will experiment with event handlers on DOM objects written in C++ in order handle all UI events in the C++ part of my application. This will reduce the browser part to act as a pure layout and rendering engine which I think should be its sole role in a hybrid application.</p>
<p>Regarding the little &#8220;hacky&#8221; approach I can say that there is only one place on the whole application code where access to WebKit is gained. This can be in the document, in the frame, or like here in the general element. From then on, no further hacks are required, it is just used and QtWebKit is not needed any more.</p>
<p>I would also wish that in ports like QtWebKit the WebCore API is preserved and exposed to the application developer. I think there are 2 aspects in a WebKit port: One is the physical rendering and display and the other one is the kind how WebKit embeds into the application and is access. Both concerns should be considered separately and I want to be free to consume only the first one and live with the original in the latter one.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=202&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/03/23/accessing-the-original-webkit-api-in-qtwebkit-hybrid-apps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>
	</item>
		<item>
		<title>Advanced Object Lifecycle in OO Systems applied to implementations in C++</title>
		<link>http://apareis.wordpress.com/2010/02/23/advanced-object-lifecycle-in-oo-systems-applied-to-implementations-in-cpp/</link>
		<comments>http://apareis.wordpress.com/2010/02/23/advanced-object-lifecycle-in-oo-systems-applied-to-implementations-in-cpp/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 11:44:42 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[object-oriented]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=175</guid>
		<description><![CDATA[C++ certainly provides sophisticated mechanisms to create and destroy objects via it&#8217;s constructors and destructors. There are, however, certain aspects to these which make them hardly usable in advanced OO systems. First and foremost, a C++ constructor implementation lacks one very important feature: polymorphic calls! In a constructor, a call to a virtual function of &#8230; <a href="http://apareis.wordpress.com/2010/02/23/advanced-object-lifecycle-in-oo-systems-applied-to-implementations-in-cpp/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=175&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>C++ certainly provides sophisticated mechanisms to create and destroy objects via it&#8217;s constructors and destructors. There are, however, certain aspects to these which make them hardly usable in advanced OO systems. First and foremost, a C++ constructor implementation lacks one very important feature: polymorphic calls! In a constructor, a call to a virtual function of the object constructed, is not a polymorphic call but a call to the method as overridden at the level of the class currently constructing the object! This makes it impossible to give the more abstract constructor information from the more concrete class. Imagine you have a UI element that need size information during construction, but that size information can only be provided by it&#8217;s specific subclasses, then you will need to implement a 2-phased approach with construction first and using (displaying in this case) second.</p>
<p>C++ constructors also lack in contrast for instance to Java the possibility to call another constructor from the same class. You can only call constructors from super classes. This makes it harder to initialize a large number of members because the initializers have to be implemented redundantly in every constructor. Without a code generator this is very error prone.</p>
<p>There is another problem which is the rather weird logic of which members get initialized and which do not. If you don&#8217;t have a constructor which initializes pointers, then these pointers are not initialized to 0. However, if a class uses some struct as a member and this struct has a pointer as member, then this pointer <em>is</em> initialized to <span style="font-family:'Courier New';">0</span>.</p>
<p>So, a general approach to get over all these problems would be to not use constructors at all and delegate all responsibilities to some generic virtual methods. Let&#8217;s first look at the requirements to an OO lifecycle in general:</p>
<p><strong>Cr<span style="font-weight:normal;"><strong>eation</strong></span></strong></p>
<ul>
<li>Create all mandatory child objects upon creation of the parent</li>
<li>If an instance requiring a parent element is created, the parent is already present</li>
</ul>
<p><strong>Transfer Ownership </strong></p>
<ul>
<li>Take a partial tree out of an object tree and connect it to a different object tree (reparenting)</li>
</ul>
<p><strong>Deletion</strong></p>
<ul>
<li>Isolate a subtree and destroy it</li>
</ul>
<h3><span style="font-weight:normal;font-size:13px;">These requirements can be translated into a general lifecycle model in OO systems:</span></h3>
<p><a href="http://apareis.files.wordpress.com/2010/02/slide171.png"><img class="alignnone size-full wp-image-177" style="margin-top:10px;margin-bottom:10px;" title="slide171" src="http://apareis.files.wordpress.com/2010/02/slide171.png?w=750" alt=""   /></a></p>
<p>Objects are, once allocated via operator new() in an intermediate state &#8220;allocated&#8221;, where they can be attached to a parent object, i.e., the parent becomes known to the child and can be used in the subsequent init() call which initializes the object structure in it&#8217;s depth. Instead of deleting an object via operator delete() it is destroyed by the destroy() method. In the destroy method, all child objects get destroyed and all destroyed objects are returned to the object pool as isolated instances. Only the pool deletes these instances if needed. Instances are never created via operator new() directly, they are always obtained from the pool via the factory method <span style="font-family:'Courier New';">instance()</span> of the class. This factory method creates a new instance if none is found to be recycled from the pool. Both the default constructor and the destructor are declared as private to ensure the sole usage of the factory method.</p>
<p>This would further lead to the 2 virtual methods <span style="font-family:'Courier New';">init()</span> and <span style="font-family:'Courier New';">destroy()</span> to be implemented on each class level. These methods would have the following behavioral characteristics:</p>
<p><a href="http://apareis.files.wordpress.com/2010/02/bildschirmfoto-2010-02-23-um-23-feb-12-28-40.png"><img class="size-full wp-image-178 alignright" title="bildschirmfoto 2010 02 23 um 23 feb 12 28 40" src="http://apareis.files.wordpress.com/2010/02/bildschirmfoto-2010-02-23-um-23-feb-12-28-40.png?w=750" alt=""   /></a></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><span style="font-family:'Courier New';"><strong>init()</strong></span></p>
<ul>
<li>is called only after business parent has been set</li>
<li>is the constructor equivalent</li>
<li><span style="font-family:'Courier New';">init()</span> calls <span style="font-family:'Courier New';">super::init()</span> first, just like a constructor</li>
<li><span style="font-family:'Courier New';">init()</span> initializes members of the class</li>
<li><span style="font-family:'Courier New';">init()</span> can be called repeatedly</li>
<li>memory allocation is a separated concern</li>
<li><span style="font-family:'Courier New';">init()</span> is virtual</li>
<li><span style="font-family:'Courier New';">init()</span> can call virtual methods</li>
</ul>
<p><strong> </strong></p>
<p><span style="font-family:'Courier New';"><strong>destroy()</strong></span></p>
<ul>
<li>is called before business parent is removed</li>
<li>is the destructor equivalent</li>
<li><span style="font-family:'Courier New';">destroy()</span> first resets own members</li>
<li><span style="font-family:'Courier New';">destroy()</span> calls <span style="font-family:'Courier New';">super::destroy()</span> second like a destructor</li>
<li><span style="font-family:'Courier New';">destroy()</span> can be called repeatedly</li>
<li>memory deallocation is a separated concern</li>
<li><span style="font-family:'Courier New';">destroy()</span> is virtual</li>
<li><span style="font-family:'Courier New';">destroy()</span> can call virtual methods</li>
</ul>
<p><strong> </strong></p>
<h3><span style="font-weight:normal;">Conclusion</span></h3>
<ul>
<li>Constructors/destructors are not needed any more, except for memory allocation</li>
<li>Instances are created in the pool only (i.e., in the class)</li>
<li>Objects have either a business parent or are referenced by the pool during destroy()</li>
<li>objects are returned to the pool</li>
<li>if objects do not have a business parent, then a parent is also not needed for initialization</li>
</ul>
<p>These feature improve the handling of complex object structures in a meta-driven OO environment applied to C++. In fact, they are so generic that they can be easily adapted in a completely different programming and runtime environment. There are, of course, some drawbacks which is basically the more complex protocol for initialization and the implementation of the object pool.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=175&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/02/23/advanced-object-lifecycle-in-oo-systems-applied-to-implementations-in-cpp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/slide171.png" medium="image">
			<media:title type="html">slide171</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/bildschirmfoto-2010-02-23-um-23-feb-12-28-40.png" medium="image">
			<media:title type="html">bildschirmfoto 2010 02 23 um 23 feb 12 28 40</media:title>
		</media:content>
	</item>
		<item>
		<title>Embedding 2D Drawing Objects in QWebView</title>
		<link>http://apareis.wordpress.com/2010/02/18/embedding-2d-drawing-objects-in-qwebview/</link>
		<comments>http://apareis.wordpress.com/2010/02/18/embedding-2d-drawing-objects-in-qwebview/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:11:55 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[hybrid apps]]></category>
		<category><![CDATA[qwebview]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=161</guid>
		<description><![CDATA[One question not so easily answered is how to display high-frequently updated dynamic content in a QWebView. QWebView is a great tool to build hybrid web applications in C++. But because it is basically only a port of WebKit and Qt tries to wrap and encapsulate as much as possible, it is also only a &#8230; <a href="http://apareis.wordpress.com/2010/02/18/embedding-2d-drawing-objects-in-qwebview/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=161&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One question not so easily answered is how to display high-frequently updated dynamic content in a QWebView. QWebView is a great tool to build hybrid web applications in C++. But because it is basically only a port of WebKit and Qt tries to wrap and encapsulate as much as possible, it is also only a plain web browser, just capable of displaying content that comes in HTML form. What if you want to display content within a web page like a stock chart or even a video&#8230;?</p>
<p>The options WebKit browsers offer are basically:</p>
<ul>
<li>&lt;object&gt;, &lt;embed&gt;, &lt;applet&gt;: they each require you to implement a specific API and in case of applet even a different programming language</li>
<li>html 5.0 canvas: this is interesting, however, it requires JavaScript to program against it which might be to slow due to frequent parsing; it would be much more interesting if a QWebElement style wrapper would be available for drawing directly from C++</li>
<li><a href="http://code.google.com/p/nativeclient/">http://code.google.com/p/nativeclient/</a> is very interesting in normal browsers, but not in a hybrid application, as it is just another form of the &lt;object&gt; tag</li>
</ul>
<p>This is why I have been thinking about a different approach, which is closer to the machine&#8217;s (i.e., Qt&#8217;s) drawing and came up with this idea:<br />
<a href="http://apareis.files.wordpress.com/2010/02/slide18.png"><img class="alignnone size-full wp-image-162" style="margin-top:10px;margin-bottom:10px;" title="slide18" src="http://apareis.files.wordpress.com/2010/02/slide18.png?w=750" alt=""   /></a></p>
<p>Here we place a special, empty &lt;div&gt; in the document which can later be accessed by it&#8217;s ID using a QWebElement. We overwrite the QWebView::render() method and check if the region overlaps our dynamic content as specified by the QWebElement::geometry() data. The actual dynamic content can for instance be pre-rendered into an internal buffer, which we can use later as the source of a pixel copy operation towards the QWebKit paint device. Whenever our dynamic content changes, we can force a repaint via QWebView::repaint() exactly on the region that has changed.</p>
<p>Architecture-wise this just means that the main presentation layer of the hybrid app is not accessed in an outbound fashion only. I have no problem with that, as long as the dynamic content can be displayed and the module doing that can later be replaced with some less &#8220;hacked&#8221; approach&#8230;</p>
<p><strong>03/05/2010 Update</strong>: HTML 5.0 Canvas is working in QWebView. I don&#8217;t know to what exact extent but some initial drawing tests completed successfully.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=161&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/02/18/embedding-2d-drawing-objects-in-qwebview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/slide18.png" medium="image">
			<media:title type="html">slide18</media:title>
		</media:content>
	</item>
		<item>
		<title>Alternative Hybrid Application Architecture</title>
		<link>http://apareis.wordpress.com/2010/02/09/alternative-hybrid-application-architecture/</link>
		<comments>http://apareis.wordpress.com/2010/02/09/alternative-hybrid-application-architecture/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 08:54:03 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[hybrid apps]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=153</guid>
		<description><![CDATA[In my recent article (Not So Easy) Hybrid Applications with Qt, WebKit and JavaScriptCore I reflected my opinion on the problems associated with the current Qt scripting APIs QtScript and WebKit Script. I&#8217;d like to depict the differences between both again: QtScript and QtWebKit both use the same JavaScriptCore but from different code copies and &#8230; <a href="http://apareis.wordpress.com/2010/02/09/alternative-hybrid-application-architecture/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=153&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my recent article <a href="http://www.pareis.com/2010/01/28/not-so-easy-hybrid-applications-with-qt-webkit-and-javascriptcore/">(Not So Easy) Hybrid Applications with Qt, WebKit and JavaScriptCore</a> I reflected my opinion on the problems associated with the current Qt scripting APIs <em>QtScript</em> and <em>WebKit Script</em>. I&#8217;d like to depict the differences between both again:</p>
<p><a href="http://apareis.files.wordpress.com/2010/02/slide04.png"><img class="alignnone size-full wp-image-154" title="slide04" src="http://apareis.files.wordpress.com/2010/02/slide04.png?w=750" alt=""   /></a></p>
<p>QtScript and QtWebKit both use the same JavaScriptCore but from different code copies and by wrapping them both with completely different APIs. In the meantime, I have also crosscheck current status at Qt and Nokia&#8217;s scripting plans. There are two separate issue tracking databases, one at Nokia for Qt development in general and one at <a href="http://webkit.org">webkit.org</a> tracking the Qt WebKit port progress. Here are the 2 relevant entries:</p>
<ul>
<li><a href="http://bugreports.qt.nokia.com/browse/QTWEBKIT-2">http://bugreports.qt.nokia.com/browse/QTWEBKIT-2</a></li>
<li><a href="https://bugs.webkit.org/show_bug.cgi?id=31863">https://bugs.webkit.org/show_bug.cgi?id=31863</a></li>
</ul>
<p>I left my comment on the first one as I am still afraid that the Qt developers might come up with even a 3rd API. If that 3rd API is a unified API which can be used for QtSCript as well as in QWebKit scripting then it&#8217;d be fine. Given the comment I received from Kent on the first one, I hope for the best.</p>
<p><strong>Alternatives</strong><br />
So far on that, but I want to focus now on the alternatives to the QWebKit based approach to building hybrid &#8211; i.e., Web enabled &#8211; applications in C++. First of all, WebKit in itself is an outstanding HTML rendering engine, both in performance and portability, both of which features I wouldn&#8217;t want to lose. That&#8217;s why I seek a solution based on WebKit, which could look like in this diagram:<br />
<a href="http://apareis.files.wordpress.com/2010/02/slide02.png"><img class="alignnone size-full wp-image-155" title="slide02" src="http://apareis.files.wordpress.com/2010/02/slide02.png?w=750" alt=""   /></a></p>
<p>The first and most important change is that whilst WebKit is still in it, it is not wrapped by Qt any more. Using the WebKit API directly, I would have access to the complete publicly available functionality in WebKit via e.g. HTMLElement and HTMLFrame classes. This would be to a great advantage. On the con side, I would lose Qt&#8217;s additional features from the wrapper classes, but I think they weren&#8217;t that many so that should be no big deal. Most of the customization would have been done using overridden event handling functions of the QWebView anyway and not via signals/slots as there aren&#8217;t many of them available (yet).</p>
<p>However, there are 2 big question marks associated with this architectorial picture:</p>
<ol>
<li>How can WebKit be used in a standalone way?</li>
<li>Could I get rid of Qt completely then?</li>
</ol>
<p>Q1 is not easily answered. If you look at the WebKit project structure you will find that it&#8217;s very much interwoven with the different ports like Safari or Chrome at the source code level. Port specific functions are partially included in the kernel and the same or more applies to the build process. WebKit is not a library that you can just consume. All ports are centrally built on WebKit&#8217;s environment and good builds are consumed by the browser vendors as a whole including the vendor specific extensions to whatever extend they want those to have public. You can get an impression here: <a href="http://build.webkit.org/waterfall">WebKit Buildbot: Waterfall Display</a> To make it worse, the whole WebCore engine is nearly completely undocumented in the source code. Only some public introductory documents are available in their <a href="http://trac.webkit.org/wiki">Wiki</a> or perhaps something more advanced on the <a href="http://www.chromium.org/">Chromium Homepage</a>. But nonetheless, a port should be possible, though with quite some effort, in a way to render to the underlying OS&#8217;s platform Grahics2D subsystem.</p>
<p>Although I am miles aways from making any achievement on this I have a better picture on the answers to question #2:<br />
<a href="http://apareis.files.wordpress.com/2010/02/slide07.png"><img class="alignnone size-full wp-image-156" title="slide07" src="http://apareis.files.wordpress.com/2010/02/slide07.png?w=750" alt=""   /></a></p>
<p>Qt&#8217;s feature rich functionality provides an experience to the C++ application developer which is at about the same level as the Java runtime library is to the Java developer. Which means: it will be hard to replace.</p>
<p>In the picture above I have created two possible scenarios for the replacement of certain aspects of Qt my application is making use of. It will &#8211; though not effortlessly &#8211; be possible to continue living without Qt either by consuming some functional equivalent from boost or by implementing a proprietary replacement. I have mixed feelings about boost, even though I consider it the right approach to utilize templates to be as syntactically clean as possible in C++, this excessive use of templates does not really lead to intuitively readable code which makes me reluctant and I tend, given the meta-driven approach I am implementing anyway, to replace of the Qt functionality by proprietary code making use of my meta level elements.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=153&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/02/09/alternative-hybrid-application-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/slide04.png" medium="image">
			<media:title type="html">slide04</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/slide02.png" medium="image">
			<media:title type="html">slide02</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/02/slide07.png" medium="image">
			<media:title type="html">slide07</media:title>
		</media:content>
	</item>
		<item>
		<title>Rationale for HTML in native applications</title>
		<link>http://apareis.wordpress.com/2010/01/29/rationale-for-html-in-native-applications/</link>
		<comments>http://apareis.wordpress.com/2010/01/29/rationale-for-html-in-native-applications/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 20:07:49 +0000</pubDate>
		<dc:creator>Andre Pareis</dc:creator>
				<category><![CDATA[Softwarearchitektur]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[hybrid apps]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://apareis.wordpress.com/?p=142</guid>
		<description><![CDATA[In my last article (Not So Easy) Hybrid Applications with Qt, WebKit and JavaScriptCore, I explained my thoughts on the limitations of the scripting capabilities built into Qt&#8217;s WebKit port. One of the options to build a nice web based UI within a native C++ application would be to use WebKit directly. Before I elaborate &#8230; <a href="http://apareis.wordpress.com/2010/01/29/rationale-for-html-in-native-applications/">Continue reading <span class="meta-nav">&#187;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=142&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my last article <a href="http://www.pareis.com/2010/01/28/not-so-easy-hybrid-applications-with-qt-webkit-and-javascriptcore/">(Not So Easy) Hybrid Applications with Qt, WebKit and JavaScriptCore</a>, I explained my thoughts on the limitations of the scripting capabilities built into Qt&#8217;s WebKit port. One of the options to build a nice web based UI within a native C++ application would be to use WebKit directly. Before I elaborate on that in an upcoming article, I would like to explain why this would be worth considering at all.</p>
<p>Here&#8217;s a picture of how I see current state of the art in UI development:</p>
<p><a href="http://apareis.files.wordpress.com/2010/01/slide3.png"><img class="alignnone size-full wp-image-143" title="slide3" src="http://apareis.files.wordpress.com/2010/01/slide3.png?w=750" alt=""   /></a></p>
<p>Over the course of the last 15-20 years software engineers focussed on the provisioning of higher level windowing toolkits on top of the very low level UI libraries like X11 and WINAPI. These higher level toolkits tried to provide some consistent look &amp; feel to the end user, sometimes across platforms. They all lack, however, one essential feature: style. This is a direct result of providing a prepackaged look which can hardly be changed by the application developer. And this lack of style is a result of lack of flexibility.</p>
<p>On the other hand, people love style which is the reason why they prefer the web, i.e., HTML based UIs over native UIs in many cases. Engineers cannot provide style because they mostly love their particular toolset and fight with other engineers whose one&#8217;s is best.</p>
<p>The question is: Who can provide style? One possible answer is: Graphical designers can! With HTML, they can not only create good looking user interfaces, but they can also create different UIs for different target audiences, which makes HTML so attractive across all industries. The required flexibility is only achievable with HTML or with special interfaces based on very low level drawing capabilities like OpenGL in computer games and it is hardly imaginable to create each and every user interface from scratch like computer games. This leaves HTML as the most attractive solution.</p>
<p>Given that, my #1 goal is to provide as much as HTML in a native application as possible, because only then I can consume stylish designs created by graphical designers in a quality which only graphical designers are able to produce.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/apareis.wordpress.com/142/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/apareis.wordpress.com/142/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/apareis.wordpress.com/142/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=apareis.wordpress.com&amp;blog=8653142&amp;post=142&amp;subd=apareis&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://apareis.wordpress.com/2010/01/29/rationale-for-html-in-native-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d13684d476141052441650d38fa2735d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">apareis</media:title>
		</media:content>

		<media:content url="http://apareis.files.wordpress.com/2010/01/slide3.png" medium="image">
			<media:title type="html">slide3</media:title>
		</media:content>
	</item>
	</channel>
</rss>
