<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		
		<title>typo3-media.com: Latest TYPO3 Blog News</title>
		<link>http://www.typo3-media.com/</link>
		<description>Latest News of the TYPO3 Blog</description>
		<language>en</language>
		<image>
			<title>typo3-media.com: Latest TYPO3 Blog News</title>
			<url>http://www.typo3-media.com/fileadmin/tt_news_article.gif</url>
			<link>http://www.typo3-media.com/</link>
			<width></width>
			<height></height>
			<description>Latest News of the TYPO3 Blog</description>
		</image>
		<generator>TYPO3 - get.content.right</generator>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		
		
		
		<lastBuildDate>Sat, 16 May 2009 09:53:00 +0200</lastBuildDate>
		
		
		<item>
			<title>small Javascript Objects example</title>
			<link>http://www.typo3-media.com/blog/javascript-objects-example.html</link>
			<description>In addition to article &quot;Javascript object notation&quot; I still have a small example lieing...</description>
			<content:encoded><![CDATA[In addition to article &quot;<link record:tt_news:106>Javascript object notation</link>&quot; I still have a small example lieing around.
Its just a simple table element that is bind to a javascript object that is responsible for controlling the actions related to this table widget - the widgets with its javascript controller part are independend from each other. In theory they could delegate the actions in that widget to a coresponding controller on the server.
<b><link fileadmin/files/examples/javascript-objects.html _blank>To the example</link> </b>
There is one &quot;trick&quot; to mention. We need a way to bind the html element &quot;table&quot; to the object that should control this widget. With jQuery you can do this with the &quot;.data&quot; method - it allows you to bind any stuff to a html element.
So in this case - to ensure that on a click on the  &quot;change color&quot; link  the correct object answers - we just bind the object itself to the link element:
<pre id="line1">// register for clicks on the &quot;change color Link&quot;<br />this.registerEvents=function() { 				<br />	$('#'+this.id+' .click').data('object',this).click(function(event) { $(this).data('object').clickColorAction(); });<br />};</pre>]]></content:encoded>
			<category>pattern</category>
			<category>development</category>
			
			
			<pubDate>Sat, 16 May 2009 09:53:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>MVC - Part 2: &quot;TYPO3 mvcnews example&quot;</title>
			<link>http://www.typo3-media.com/blog/mvc-news-example.html</link>
			<description>We have T3DD and its time to publish the new release of the &quot;mvc&quot; extension together with...</description>
			<content:encoded><![CDATA[We have T3DD and its time to publish the new release of the <link http://typo3.org/extensions/repository/view/mvc/current/ _blank>&quot;mvc&quot; extension</link> together with a first version of an <link http://forge.typo3.org/projects/show/extension-mvcnews _blank>example extension</link>. <br /> 
<h3> Introducing the example:</h3>
 The extension &quot;mvcnews&quot; is planned as a normal news application with articles and categorys, articles can have comments and there can be downloads attached to the article. <br /> <br /> The requirements to the frontend are common: We need a article overview with the features: searchform, pagination and resultlist. Also we need a detailview of an article. That should be all for now.
<h3>Model</h3>
 So the domain model is pretty simple (only relevant parts are shown for now)
<img src="uploads/RTEmagicC_uml-mvcnews-ddd.jpg.jpg" height="297" width="300" alt="" /><br /> 
<h3> Controller</h3>
 Like explained above we need two frontend outputs: a listview and a detailview. We put this both in one controller, that has two actions: &quot;showlistAction()&quot; and &quot;showdetailAction()&quot;. Because the controller needs to access articles, it needs at least the articleRepository. With dependency injection its the best to let the articleRepository inject into the controller.<br /> <br /> With that its pretty easy to fill the showdetailAction with live: Its straight forward: 1. ask the repository for the article that should be displayed <br />2. pass it to the view, and return the view result.
<pre>/**<br />* detail action shows the single view of an object, if a detail view of an object is<br />* requested.<br />*<br />* @return string<br />*/<br />public function showdetailAction() {<br />   if (empty ( $this-&gt;arguments ['id'] )) {<br />    throw new InvalidArgumentsExcepton('no valid id given');<br />   }<br />   $this-&gt;view-&gt;setArticle ( $this-&gt;articleRepository-&gt;findById ( $this-&gt;arguments ['id'] ) );<br />   return $this-&gt;view-&gt;render ();<br />}</pre>
<h3>The detail view</h3>
Like shown above there needs to be a view that is able to render an article. And the view - of course - has to know the article it should render. Therefore the view has a &quot;setArticle&quot; method to set the article the view should render. 
Our detail view actually implements the phpTemplateView, so a template that belongs to that view can look like that:
<pre><br /><br />&lt;div id=&quot;objects&quot;&gt;<br /> &lt;h2&gt;&lt;?php echo $this-&gt;article-&gt;getTitle();&nbsp; ?&gt;&lt;/h2&gt;<br /> &lt;p&gt;&lt;small&gt;&lt;?php echo<br />$this-&gt;labels-&gt;get('field_category'); ?&gt;:&lt;?php echo<br />$this-&gt;article-&gt;getCategory()-&gt;getTitle();<br />?&gt;&lt;/small&gt;&lt;/p&gt;<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />&nbsp;&lt;p&gt;&lt;small&gt;&lt;?php echo<br />$this-&gt;labels-&gt;get('field_date'); ?&gt;:&lt;?php echo<br />$this-&gt;article-&gt;getDate(); ?&gt;&lt;/small&gt;&lt;/p&gt;<br />  &lt;div class=&quot;image&quot;&gt;<br />    &lt;?php &nbsp;&nbsp; &nbsp;echo $this-&gt;article-&gt;getImage();&nbsp;&nbsp; ?&gt;<br />  &lt;/div&gt;<br />  &lt;?php &nbsp;&nbsp; &nbsp;echo $this-&gt;article-&gt;getDescription();&nbsp;&nbsp; ?&gt;<br />&lt;/div&gt;<br /><br /></pre>
 There is one thing thats not perfect: In the view I expect that the getImage returns a Imagetag, and that the description is processed by the TYPO3 parseFunc_RTE stuff.&nbsp; There are two ways to solve that:
<ol><li>we could use viewhelpers (like $this-&gt;fieldRenderer-&gt;asImage(...)) to transform the imagepath to a imagetag for example.</li><li>we can use a presentationmodel and do the transformation of fields for the view there.</li></ol>
 (Btw.: we should not add logic to the domain model, because a imagetag is purely view related and has no meaning in the domain)<br /> <br /> We decide to go with version 2 - just because we might need this transformation in the listview again. 
The mvc framework offers a TCA <b>presentationmodel</b>, that does most of the transformations magic with the help of the TCA informations, so we just need to wrap a presentationmodel around our article object:
<pre>new tx_mvcnews_presentation_articlePresentationModel ( $this-&gt;articleRepository-&gt;findById ( $this-&gt;arguments ['id'] ), $this-&gt;configuration-&gt;get ( 'presentationModel.article.' ), 'tx_mvcnews_article' );</pre>
<h3> The showlistAction and the listview:</h3>
 For the listview we need to find a clean and flexible solution to:
<ol><li>get the correct collection of articles, that matches the search</li><li>render the output with: searchform, pagination and actual results.<br />   </li></ol>
 For the first problem we use a seperate <i>searchCriteriaObject</i>, that has all the informations for the current search - this object is build from the current arguments. Then we pass the <i>searchCriteria</i> to the articleRepository-&gt;findByCriteria method and all the application-specific searchlogic has to be part of this repository. So the call sequenz&nbsp; looks something like this:<br /> <img src="uploads/RTEmagicC_uml-mvcnews-sequenz.jpg.jpg" height="211" width="463" alt="" /><br /> <br /> For the second problem we use the pattern <i>compositeView</i>. Thats mainly a view that consits of other views - and just like the requirements say: we have three subviews: pagination, searchform and list. Of course all of this subviews require a model that they can render:
<ul><li>the paginationSubView has setter methods to provide the required informations for the pagination</li><li>the searchformSubView - well it needs a formmodel. The formmodel tells the searchForm which formelements it can render. The seperate formmodel is also greate to validate the users input before doing anything.</li><li>and finaly the listSubView needs the collection of articles that it should render.<br />   </li></ul>
 The main advantage of splitting your view into subviews is that you can reuse the views. So imagine you need the searchform as a standalone form, or you might need just the list of lastest articles -&gt; you can reuse the existing views.
<br /> This is how the class diagramm of the listview looks like:<br /> <img src="uploads/RTEmagicC_uml-mvcnews-views.jpg.jpg" height="247" width="300" alt="" /><br /> <br /> And finaly this is the output:<br /> <img src="uploads/RTEmagicC_mvcnews-listview.jpg.jpg" height="239" width="367" alt="" /><br /> <br /> 
<h3> Whats next?</h3>
 You can have a look in the example extension and see yourself how it works.
By now the example &quot;mvcnews&quot; has just a basic output without any advanced features, here is whats planned next:
<ul><li> add AJAX loading for searching and paginating</li><li>add more features like commenting and rating, that propably results in a richer domain model and more action methods in the controller.<br />   </li></ul>]]></content:encoded>
			<category>pattern</category>
			
			
			<pubDate>Fri, 15 May 2009 09:59:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>MVC - Part1: &quot;Introduction and History&quot;</title>
			<link>http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html</link>
			<description>
Everybody speaks about MVC - the de facto standard for building modern application. Here is a...</description>
			<content:encoded><![CDATA[
Everybody speaks about MVC - the de facto standard for building modern application. Here is a short article to the basics and history of MVC.
<h3>Short introduction to Model View Controller</h3>
MVC intention is to build applications in a modular way, where we have 3 general parts responsible for creating the output and allowing the interaction&nbsp; with the user: 
<h4> Model: </h4>
 In the context of the MVC the model has the data that is required to render things in the view. So it represents the data that are required for rendering. It also takes over the operation related to the domain.The model is used to do something and get the data. 
<h4> View:</h4>
 takes over the display of the applications state. A view takes care of „rendering the pixels on the screen“ and should be as dump as possible. Typically a view class understands one or more model(s) and outputs the information of that model. ( A view is not allowed to write in the model.) So the view is aware of the model and knows how to read the data out of it – but never the model should know something about the view!
<h4> Controller: </h4>
 It glues together Model and View, it controls the user interaction with the model and the view. (Its a thin layer that connects models with there views)<br /> <br /> 
<h3>The historic basic &quot;smalltalks-80&quot; classical MVC:</h3>
One of the first MVC framework was the smalltalks-80 MVC implementation in the 80s. Smalltalk is a pure objectoriented programming language, and the MVC concept was a key feature.<br /><img src="uploads/RTEmagicC_classical-mvc.jpg.jpg" height="204" width="230" alt="" /><br />It was designed for Desktopapplications and the main idea is to seperate the presentation from the domainmodel.<br />Controller and view do not know each other. Instead the view updates itself through observing the relevant model. Therefore the models needs to implement the observer pattern. Controller handles the userinputs and delegates the useractions to methodcalls in the models.<br /><br />A complete screen can be understand as a collection of widgets - each widgetelement consit of its own View and Controllerobject. 
<h4>Downsides of the smalltalks 80 MVC concept:</h4>
Usage of the Observer Pattern: You dont know whats going on by reading the code.<br />Complex Screens get really complex because of a hierarchie of widgets with own View and Controller part. Specially if you have the requirement to know about a user action in more controllers. <br /><br />Problem of handling logic that is only related to presentation =&gt; that is put into the view - so the view gets some logic which is not optimal.<br /><br />This MVC concept is not really relevant for typical Webapplications!<br /><br />
<h3>MVP vs MVC</h3>
The smalltalk developers recognized the downsides of the classical MVC concept and introduced a simelar concept called MVP (Model View Presenter).
<img src="uploads/RTEmagicC_mvp.jpg.jpg" height="276" width="300" alt="" />
The role of the presenter within MVP is to interpret the events and gestures initiated by the user and provide the business logic that maps them onto the appropriate commands for manipulating the model in the intended fashion. <br />While it is the view’s responsibility to display model data it is the presenter that governs how the model can be manipulated and changed by the user interface. This is where the heart of an application's behaviour resides. 
In many ways, a MVP presenter is equivalent to the MVC controller.<br />The main difference is that a presenter is directly linked to its associated view so that the two can closely collaborate in their roles of supplying the user interface for a particular model. This can be very handy at times and is one of the most obvious benefits over MVC where the application model only has an indirect link to its associated view. 
However the shortcut &quot;MVP&quot; is not so common like &quot;MVC&quot; but most of the MVC frameworks you find for webapplications follows more the MVP concept.
<h3>MVC for Webapplications</h3>
The concepts above were initialy developed for desktop applications. In desktop applications you have a direct connect between UI components and the responsible controller or presenter. In webapplications you normally dont have this: The HTML for a complete screen is sended to the browser. If the user do some actions in the UI a request is send to the webserver - this request has to be interpreted and normally the complete (updated) screen needs to be sended to the browser again.
<img src="uploads/RTEmagicC_mvc-for-web.jpg.jpg" height="122" width="300" alt="" />
The HTML for the complete screen can be understand as a set of widgets (or subviews). For example it can contain a &quot;mainmenu&quot;, a &quot;newslist&quot;, a &quot;basket&quot; etc. The webserver always needs to generate the complete view with all its subviews. 
A MVC Framework for webapplications therefore normally works this way:
<ul><li>The request that is send from the browser to the webserver is send to a front controller. This front controller builds a request object and starts the processing of this request.</li><li>That means Controller Objects are called (normally action methods in the controller that belongs the current request. This process is called &quot;dispatching&quot;) and this controllers are responsible to return the correct response. Like normal controllers they do:<ul><li>The controller loads/modify model objects</li><li>Pass the model to a view</li><li>calls the view &quot;render()&quot; method to get the response.</li></ul></li><li>Normally the view that is returned to the browser consist of a hierarchie of subviews and/or widgets.</li></ul>
<b>MVC Frameworks for webappications:</b>
<ul><li>http://flow3.typo3.org - the upcoming framework for TYPO3 5.0</li><li>http://typo3.org/extensions/repository/view/mvc/current/ - extension enables MVC based plugin on top of the CMS TYPO3 4.x</li><li>http://framework.zend.com/ - powerful collection of PHP5 classes and modules, includes also a full featured MVC framework</li></ul>]]></content:encoded>
			<category>news</category>
			<category>pattern</category>
			
			
			<pubDate>Sun, 15 Mar 2009 12:21:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>running FLOW3 with PHP 5.3.0 on mac</title>
			<link>http://www.typo3-media.com/blog/flow3-on-mac.html</link>
			<description>Just some small notes about how to run FLOW3 on a mac.</description>
			<content:encoded><![CDATA[Just some small notes about how to run FLOW3 on a mac.
<h3>Installing PHP 5.3.0beta1</h3>
FLOW3 requires PHP 5.3 in the current version. Macport is a greate tool (like apt*) for compiling and upgrading software. So the first thing you need to do is download: http://www.macports.org/.
After downloading and installing macport you can use the port commands to download and install new software with its dependencies. For PHP 5.3 you can use this commands:
<pre>cd /opt/local/bin<br />sudo ./port selfupdate -f<br />sudo ./port install php5-devel +apache2 +macosx +mysql5 +sqlite</pre>
More details on <link http://guide.macports.org/.>http://guide.macports.org/.</link> 
<h3>Installing FLOW3</h3>
You can get the current version from SVN: svn co https://svn.typo3.org/FLOW3/Distribution/trunk/.
]]></content:encoded>
			<category>news</category>
			
			
			<pubDate>Sat, 28 Feb 2009 08:21:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>Dependency Injection in TYPO3 4.x</title>
			<link>http://www.typo3-media.com/blog/dependency-injection-for-typo3.html</link>
			<description>What is dependency injection
Its a concept following the IoC (=Inversion of Control)...</description>
			<content:encoded><![CDATA[<h3>What is dependency injection</h3>
Its a concept following the IoC (=<link http://martinfowler.com/articles/injection.html#InversionOfControl>Inversion of Control</link>) principle.&nbsp;
In object oriented programming most of the objects needs other objects in order to solve the task. Normally this might be done simply this way:
<pre>$object= new class_i_need();</pre>
That means your class depends on another class. And it gets the dependency itself. If you want to Unit Test this class you (more or less) cannot really test this class alone because you will also depend on the dependency. 
Dependency injection means that the object itself is not responsible of getting the instances it needs - instead it is &quot;injected&quot; from outside.
The most common way is constructor injection - the first step therefore is to explicit request the dependency in the constructor of your class:
<pre>class foo {  <br /> public function __construct(class_i_need $object) {<br />   $this-&gt;object=$object;  <br /> }<br />}</pre>
So now the class cleary describe the dependency - and whoever wants to instanciate this class needs to pass the correct object instance. This way you allready can build better Unit Tests for this class - using Mock or Stub objects.
The next step is that a framework is responsible for resolving the dependency, so creating a instance of your class would look something like:
<pre>$myFooInstance=tx_picocontainer_IoC_manager:create('foo');</pre>
The framework knows all the available classes and is responsible for resolving the dependency. So it will inject a &quot;class_i_need&quot; instance to the &quot;foo&quot; class and return a correct instance.
<h3>The extension &quot;picocontainer&quot;</h3>
http://typo3.org/extensions/repository/view/picocontainer/current/
It includes the PHP implementation of picocontainer:&nbsp;www.picocontainer.org 
The extension offers basic dependency injection. The usage itself is simple:
<ol><li>you need to register your classes to the &quot;IoC manager&quot;</li><li>then you can ask the manager for instances, and it will resolve the dependencies (if it can).</li></ol>
For usage you need to distinguish between singleton classes (only one instance of a class required) and prototype classes:

<pre>//registering a singleton class<br /> tx_picocontainer_IoC_manager::registerSingleton(CLASSNAME)<br />//getting a singleton instance<br />$object=tx_picocontainer_IoC_manager::getSingleton(CLASSNAME);<br />//registering a prototype class:<br />tx_picocontainer_IoC_manager::registerPrototype(CLASSNAME); <br />//get a new instance:<br />$object=tx_picocontainer_IoC_manager::create(CLASSNAME)</pre>
The registration can be done directly in the head of your class code, or on a central place in your extension.

]]></content:encoded>
			<category>news</category>
			<category>pattern</category>
			
			
			<pubDate>Wed, 28 Jan 2009 14:42:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>Domain Driven Design - a brief introduction</title>
			<link>http://www.typo3-media.com/blog/domain-driven-design-introduction.html</link>
			<description>
Domain Driven Design
Domain Driven Design (DDD) is an approach of how to model the core logic of...</description>
			<content:encoded><![CDATA[
<h2>Domain Driven Design</h2>
<p class="align-left"><img style="float: left;" src="uploads/RTEmagicC_books-ddd.png.png" height="169" width="128" alt="" />Domain Driven Design (DDD) is an approach of how to model the core logic of an application. The term itself was coined by Eric Evans in his <link http://books.google.com/books?id=7dlaMs0SECsC&dq=domain+driven+design _blank>book &quot;Domain Driven Design&quot;</link>. The basic idea is that the design of your software should directly reflect the Domain and the Domain-Logic of the (business-) problem you want to solve with your application.  That helps understanding the problem as well as the implementation and increases maintainability of the software.<br /> </p>
<p class="align-left">The <link http://www.domainlanguage.com/ddd/index.html _blank>Domain Driven Design</link> approach introduces common principles and patterns that should be used when modeling your Domain. There are the &quot;building blocks&quot; that should be used to build your domain model and principles that helps to have a nice &quot;supple design&quot; in your implementation.</p>
This article tries to introduce some of the concepts shortly and  should inspire to read more. But reading this article still requires some minutes - so take your time :-)
<h3>Basics</h3>
The Developer never knows enough about the problem. But the domain experts know their domain and the developer has to understand it. The domain experts know rules of their business process but often they are not aware using them because it is natural for them. Therefore &quot;knowledge crunching&quot; is required to identify a proper domain model (DM).
A common language between users (domain experts) and developers is required that helps to understand the tdomain and the&nbsp; problem.
The domain model offers a simplified, abstract view of the problem. It can have several illustrations: speech / UML / code. Defining the domain model is a cyclic process of refining the domain model. The DM grows and changes because knowledge grows during implementation and analysis!
Of course the domain model must be useable for implementation. In practice there are so many analytic Models which are not implemented ever =&gt; you have to find one which can be implemented in design!
<img src="uploads/RTEmagicC_analysis.jpg.jpg" height="92" width="351" alt="" />

<h3>Ubiquitous Language</h3>
   In order to understand the problem area (domain) of your application a common language should be used to describe the problem. The goal is that this language (and the common vocabulary in it) can be understood by the developers and the domain experts (e.g. the client). 
<ul></ul>
<ul><li>The DM is the backbone and it uses terms of the &quot;ubiquitous language&quot;</li><li>Therefore no translation between developers and domain experts - as well&nbsp; between developers itself are required. </li><li>During the analysis the ubiquitous language should be used to describe and discuss problems and requirements. If there are new requirements it means new words enter the common language...</li></ul>
Speak in ubiquitous language (like a foreign language) 
<ul><li>Try to explain scenarios loud with the use of the model and the ubiquitous language</li><li>Try to explain scenarios more simple/better (find easier ways to say what you need to say). That helps refining the model.</li></ul>
<h3>UML and DDD</h3>
Common is the use of class-diagrams to describe the domain model.
<ul><li>Use of UML class diagrams to  sketch the main classes.&nbsp;</li><li>Do not go to draw every class you going to code =&gt; keep overview of the main stuff!</li><li>Use structure (packages and subpackages). Use freetext to explain constrains and relations. </li><li>Simplify the class diagram when you use it to talk with domain experts (better a diagramm is useful than standard compliant)</li></ul>
“comprehensive UML of entire object model fails to communicate or explain; they overwhelm reader with details”
<b>Therefore use simplified diagrams of conceptual important parts – that are essential to understand. (Present a skeleton of ideas)</b>
<h3>Layered Architecture</h3>
<img style="float: left;" src="uploads/RTEmagicC_layered.jpg.jpg" height="150" width="90" alt="" />The basic principle for software that is build with domain driven design is to use a layered architecture. Where the heart of the software is the domain model. Basic principles of layered architecture is that a layer never knows something about the layers above. That also mean the domain layer -as the heart of the application- is responsible for all the business logic but should never be &quot;dirtied&quot; by view requirements&nbsp; for example. <br />(MVC or MVP Pattern fits perfectly into that principle)


<h2>Main Domain Model elements (building blocks)</h2>
The main elements of a domain model are &quot;<b>entities</b>&quot;, &quot;<b>values</b>&quot; and &quot;<b>services</b>&quot;. They are connected with <b>associations</b> (relations). Common pattern like &quot;<b>repositories</b>&quot; and &quot;<b>factories</b>&quot; helps completing the model.
<h3>Associations between elements</h3>
Avoid many association and use only a minimum of relations because they decrease maintainability!
<ul><li> impose a traversal direction instead of a bidirectional (bidirectional means both objects can only exist together -&gt; ask if this is really the case)</li><li> adding qualifier, effectively reduces multiplicity: If you have&nbsp;much associations and/or multiplicity&nbsp;for both ends of the association, it can be a sign that a class is missing in your model.</li><li>eliminate nonessential associations</li></ul>
In sourcecode a association can be for example: a function that querys / some internal array / a collection object / just a reference ...
<h3>Entitys</h3>
= Object which is primary defined by its identity (not by attributes). For example &quot;Person&quot;, &quot;Car&quot;, &quot;Costumer&quot; or &quot;BankTransaction&quot;.
<ul><li>has continuity through live cycle</li><li>object defined by its own not by attributes</li><li>keep the class definition simple =&gt; focus on live cycle</li><li>be alert to requirements that require a matching through attributes (because of possible problems with the need for identity)</li><li>use of some Identifier (IDs) is often useful</li></ul>
<h3>Values</h3>
=describe the characteristic of a thing and identity is not required. “we care what they are not who or which”. For example &quot;address&quot;, &quot;color&quot; ... 
<ul><li>value objects are allowed to reference an entity</li><li>often passed as parameter in messages between other objects</li><li>they are immutable! Ideally the only have getter methods and their attributes are set during construction (constructor method).</li><li>make them a “whole value”&nbsp; - means a conceptual whole (e.g. address)</li><li>identity gives freedom in design – we don’t need to care of identity: we can simple delete and create new ones if required.</li></ul>
A good example is &quot;color&quot; that can be implemented as value object. That means it is an object that represents a certain color. Since value objects are immutable it is not allowed to change the color object. So if you need to get a color that is lighter than another color: You throw the old color away and build a new color - that is possible because you don't need to take care about identity. (Typically implemented as method&nbsp;in a colorService or colorFactory class for example)
<h3>Service</h3>
“...if a single process or transformation in domain is not a natural responsibility of an entity or value =&gt; make it a standalone service with a nice interface.&quot;<br /><br />  A service decouple entities and values from client (client in this case= the object thatwant to use another object) and therefore. They define an easy interface to use in client objects.
A service should
<ul><li>be stateless</li><li>be defined in the common language</li><li>use entity/value objects as parameters</li></ul>
A service should not be mixed with other layers:
<ul><li>be&nbsp;mixed with responsibility of infrastructure or system layer</li><li>be mixed with the application layer. For example export or import is not part of the domain layer (an export or import fileformat has no meaning in the domainlayer – they belong to application)</li></ul>
<h3>Modules</h3>
“If your model tells a story a modul is a “chapter””
<ul><li>helps understanding of large systems</li><li>low coupling between modules</li><li>independent development possible</li><li>if you group objects in a modul you want others to think of this objects together =&gt; group by meaning in the domain layer</li></ul>
<h3>Aggregates</h3>
It is difficult to guarantee the consistency of changes in a model with many associations. Aggregates helps to limit dependencies.
<img src="uploads/RTEmagicC_aggregate.jpg.jpg" height="152" width="344" alt="" />
An aggregate is a group of objects that belong together (a group of individual objects that represents a unit). Each aggregate has a aggregate root. The client-objects only &quot;talk&quot; to the aggregate root. 
<ul><li>Invariants and rules have to be maintained. The aggregate root normaly takes care of invariants.</li><li>cluster entities/values into aggregates and define boundaries around each.</li><li>One entity is the aggregate root and controls all changes and access to the objects inside</li><li> Delete have to delete complete boundary</li></ul>
<h3>Factory</h3>
“a car do not build itself” - a car is an useful and powerful object because of its associations and behavior, but to overload it with logic for creating it&nbsp; is unlikely!
A factory hides logic for building objects - this is especially relevant for aggregates!<br />A factory can be implemented as a seperate object or also as a embedded factory method.
<h4>Factory Method:</h4>
 Instead of a seperate factory object - a factory method can be located in existing elements: for example in an aggregate root or in a host class where it is natural (e.g. createOrder method in a BookingClass). 
<h4><b>Constructors</b></h4>
Factory functionality should only be located in the constructor if creation is simple and if there are good reasons. A constructor should always be atomic (never call other constructors).<br /><br />
<h4>A good factory:</h4>
<ul><li>is atomic (you need to pass all parameters that are need to build a valid &quot;thing&quot;)</li><li>are predictable</li><li>not allowed to give wrong results (instead throw exception)</li><li> the factory will be coupled to its arguments, therefore carefully choose the parameters:<ul><li> there is the danger of too much dependencies - better use parameters that are allready in the conceptual group or in dependencies allready</li><li>use abstract types as parameter</li></ul></li><li>the factory is responsible for invariants… (maybe delegate it)</li><li>there are also factories for reconstitution </li></ul>
<h4>Entity factory</h4>
Factories for entities takes just essential attributes that are required to make a valid entity or  aggregate. Details can be added later if they are not required by an invariant. The factory knows from where to get the identifier for an entity.
<h4>Value factory</h4>
Since value objects are immutable a factory or factory method for a value object takes the full description as parameters.
<h3>Get references of entities and objects:</h3>
To do anything with an object you need to have a reference to it:
So how to get it? There are several options:
<ol><li>build a new object - e.g. with the help of a&nbsp;factory</li><li>reconstitution of an object (relevant when the id is known - done by the factory)</li><li>traversal between objects, means to ask other objects for objects. For example that have to be used for inner aggregates of course.</li></ol>
But there are some entities that need to be accessible through search based on attributes. One way to deal with this is the &quot;query and build&quot; techniquebut&nbsp;this&nbsp;tends on a too technical focus and views objects as datacontainer (that is not optimal for DDD).&nbsp;That&nbsp;is where&nbsp;repositories&nbsp;enter the scene...
<h3>Repositories</h3>
For each object where you need global access create a repository object that can provide the illusion of an in memory collection of all objects of that type. Setup access through a well knows global interface.
A Repository typically has methods for add, remove and find (=select based on some criteria). Advantages:
<ul></ul>
<ul><li>Decouple client from technical storage</li><li>Performance tuning possible</li><li>Communicate design decisions related to data access</li><li>keep model focus</li><li>dummy implementation for unit testing is possible.</li><li>Repositories can hide the OR mapping.</li></ul>
If the repository is responsible for retrieving a certain entity that is build by a factory, the repository normally calls the &quot;reconstitution&quot; method of the factory.
<h2>Bigger picture</h2>
&nbsp;<img clickenlarge="1" src="uploads/RTEmagicC_ddd.jpg.jpg" height="411" width="366" alt="" />
<sup>This diagram (taken from the book) is an overview showing the parts of domain driven design.</sup>
Beside the building blocks Eric Evans also pointed out principles that should help to have a supple design in the implementation. One of the main goal of a supple design is that you have code where the developers love to work with - because it is understandable, logic, maintainable and extendable. This are some of the the principles:
<ul><li>classes should have an &quot;intention revalving interface&quot;: names of classes and methods  should explain clearly what they do. </li><li> methods shouldn't have side-effects: As much as possible should be query (no change to the state of the model). Commands should be clear and simple.</li><li> If there are unavoidable sideeffects they should be made explicit through assertions. (e.g. state post-conditions and invariants)</li><li>conceptual contours: <i>&quot;Decompose design elements (operations, interfaces, classes, and aggregates) into cohesive units, taking into consideration your intuition of the important divisions in the domain. Observe the axes of change and stability through successive refactorings and look for the underlying conceptual contours that explain these shearing patterns. Align the model with the consistent aspects of the domain that make it a viable area of knowledge in the first place.&quot;</i></li><li>where logic use simple &quot;standalone classes&quot; with a certain functionality, that is easier to understand and better to maintain (e.g. because you have less dependencies)</li><li>closure of operations, simple means a method should answer with the same object/datatype which it takes as parameters. You should use this where possible because no new dependencies are introduced when using this method.</li></ul>
DDD supports the agile paradigm and  ideally goes hand and hand with refactoring, test driven development and an agile project management like scrum.

<h2>More to read</h2>
<link http://www.amazon.de/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=cm_lmf_tit_1 _blank>Buy the book :-)</link>
or download an extract: http://domaindrivendesign.org/books/PatternSummariesUnderCreativeCommons.doc 
<h3>Domain Driven Design in practice</h3>
<ul><li> There is a sample application to show how the implementation with domain driven design can work. It is the example application for cargo (used also in the book from Eric Evans): <link http://dddsample.sourceforge.net>http://dddsample.sourceforge.net/</link></li><li>There is also a good article abould DD in practice with a demo application for download: http://www.infoq.com/articles/ddd-in-practice &nbsp;</li></ul>

<h3>Links</h3>
<ul><li>The homepage of Domain Driven Design is www.domaindrivendesign.org - it is maintained by the leaders in this area like Eric Evans and Jimmy Nilsson.</li><li>Recently a interesting interview was published there: http://domaindrivendesign.org/events/qcon2008SF/eric_evans/index.html</li><li>New book from Martin Fowler: http://martinfowler.com/dslwip/</li><li>http://www.domainlanguage.com/ddd/index.html </li></ul>


]]></content:encoded>
			<category>news</category>
			<category>pattern</category>
			
			
			<pubDate>Wed, 07 Jan 2009 13:36:02 +0100</pubDate>
			
		</item>
		
		<item>
			<title>New Imagemap Extension</title>
			<link>http://www.typo3-media.com/blog/imagemap-plugin-for-typo3.html</link>
			<description>A few months ago one of our customers complained about the Imagemap solution he had. The most...</description>
			<content:encoded><![CDATA[A few months ago one of our customers complained about the Imagemap solution he had. The most annoying fact was that the existing extensions from TER did not work properly with Workspaces. Now this has changed :)<br />&nbsp;<br />It took a while but now we can offer a completely new Imagemap extension which integrates seamlessly into the normal TYPO3 Backend without XCLASSes, with workspace support and with -as we hope- increased usability. Another improvement of the extension is that the created links are also reported to the TYPO3 refindex.<br />&nbsp;<br />The extension provides a new content type &quot;ImageMap&quot; which works on top of the normal image type; the only difference is an additional field wich can be edited with a wizard (compareable to the Colorpicker Wizard). The image in the wizard is rendered as if it was rendered in the Frontend, therefore every effect and option from the normal image element (or extension for this element) can be used in connection with the Imagemap! 
The Implementation of the User-Interface is based on jQuery and is a good example for object-oriented JavaScript solutions.<br />&nbsp;<br /> At the moment there are still some features which are awaiting implementation- If you want to review or test the current solution you can download it from the TER (http://typo3.org/extensions/repository/view/imagemap_wizard/ ) or directly via SVN from Forge (<link http://forge.typo3.org/projects/show/extension-imagemap_wizard/>http://forge.typo3.org/projects/show/extension-imagemap_wizard/</link>).  <br />Sugesstions are always welcome.<br /><br />]]></content:encoded>
			<category>news</category>
			
			
			<pubDate>Thu, 04 Dec 2008 10:36:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>Javascript objects: notation, prototype...</title>
			<link>http://www.typo3-media.com/blog/javascript-object-prototype-notation.html</link>
			<description>since the UI of common webapplications requires more and more javascript its time to summarize some...</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
Since the WEB 2.0 revolution we have it back: the heavy usage of JavaScript for websites and online-applications. We have AJAX and all these beautiful JavaScript frameworks like JQuery and Co - which helps building &quot;rich client&quot; online applications.
Most online application developers are familar with developing server side applications and using approved patterns and practices, such as &quot;OOP&quot;, &quot;MVC&quot;, &quot;MVP&quot; and &quot;Unit-Testing&quot;,  to ensure maintainable and clean code.
However since the UI of common webapplications requires more and more JavaScript its time to summarize some of the tricks for that good old scripting language.
<h3>Did you know? </h3>
<ul><li>JavaScript has no classes - but&nbsp;objects - which can be manipulated during &quot;runtime&quot;</li><li>objects can inherit from other objects</li><li>functions - and in fact nearly everything in JavaScript as well - are objects</li><li>all function objects have special properties like  prototype or caller</li></ul>
<h2>Literal Notation for creating new objects</h2>
A simple object is created with the {} notation. <br />That's the shortest example - creating a variable and assigning an empty object to it:
<pre>//create new object:<br />var myobj = {};</pre>
 Properties and functions can be added to that object with member operators: either the &quot;dot notation&quot; or the &quot;bracket notation&quot; (its both the same):
<pre>//create new simple property with dot notation<br />myobj.name = &quot;Mustermann&quot;;<br />//create a function &quot;getName&quot;<br />myobj.getName = function() {return this.name};<br />//use the braket notation<br />myobj['firstname']=&quot;Max&quot;</pre>
The same can be written in a more readable way - the following code will have exactly the same result. Properties and functions are written inside the {} brackets - separated with a comma (this syntax is also known from JSON):
<pre>var myobj = {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name: 'Daniel',<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; firstname: 'Max',<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; getName: function() {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return this.name;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;  <br />}</pre>
<b>What happens here:</b>
<pre>var myobj2=myobj;<br />myobj2.name='foo2';<br />alert(myobj.getName());</pre>
The variable myobj2 gets the reference to the object in myobj. Therefore changing the name with &quot;myobj2.name&quot; also changes the name in myobj - and the code will alert &quot;foo2&quot;. That means creating a new object in this way is not possible (there are ways to copy simple objects - but functions are the better way to create object instances)
<h2>More about objects</h2>
 In JavaScript nearly everything is a object. So &quot;function&quot;, &quot;Array&quot;, &quot;Math&quot;... are standard JavaScript global objects that are available in the global scope. Each object in JavaScript has certain common methods and properties. Even the environment of your JavaScript code is in a so called &quot;global object&quot;. You can add subobjects and sub-properties to your object as shown above. The current context object can be accessed with the keyword &quot;<link https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/this_Operator _blank>this</link>&quot;. 
<h3>Functions are more advanced objects</h3>
<pre>var myadvobj= function() { return 'hello world'};</pre>
This code creates a function object and assign this to the variable myadvobj. The syntax above is exactly the same as the better known: &quot;<i>function myadvobj() {&nbsp; return 'hello world';}</i>&quot;.  As allready mentioned, functions are just objects with more possibilities than the simple object shown above, the function itself is the constructor function of the object. function objects have a number of predefined properties and methods (the most interesting one is &quot;prototype&quot; - thats useful to create new objects). Also the <i>&quot;new&quot; </i>operator is available for function objects and allows to create new object instances.
<h3>Using function objects and the prototype property</h3>
Lets start with that example:
<pre>var myadvobj= function() { <br />  this.name='my default name';<br />  return 'hello world'<br />};</pre>
That code created the functionobject &quot;<i>myadvobj</i>&quot; -&nbsp; the prototype property now has an object with the methods and properties of that function object:
<pre>console.log(myadvobj.prototype);</pre>
Creating new objects of the type &quot;myadvobj&quot; is easy:
<pre>var obj1=new myadvobj();</pre>
  What happens is that the prototype property of &quot;<i>myadvobj</i>&quot; is used to create a new object <i>&quot;obj1&quot;</i>. Note that <i>&quot;</i><i>obj1&quot; </i>is no function object anymore - it's an object instance. That means something like this is <b>not </b>possible:
<pre>var obj2= new obj1(); //gives an error</pre>
To understand the prototype property look at the following example. Since functions are also objects you can also add methods on the fly:
<pre>myadvobj.subFunction=function() {return 'hello 1'};</pre>
You can do this for the prototype Object as well:
<pre>myadvobj.prototype.subFunction2=function() {return 'hello 2'};</pre>
What happens now:
<pre>var obj=new myadvobj(); //create instance of function object with new operator<br />alert(obj.subFunction()); // returns error - the function does not exist for the instance<br />alert(obj.subFunction2()); // returns &quot;hello2&quot;<br /><br /></pre>
<h3>Inheritance</h3>
There are several ways of implementing inheritance. With the prototype property we have the basis for implementing inheritance - for example the begetObject (by Douglas Crockford):
<pre>function begetObject(o) {<br />  function F() {}<br />  F.prototype = o;<br />  return new F();<br />}<br />var childObject = begetObject(parentObject);</pre>
For more information please <link http://www.javaranch.com/journal/2008/10/Journal200810.jsp#a1 _blank>read this article</link>
<h2>Conclusion: Singletons and Prototypes&nbsp;</h2>
Just  like in normal OOP, there are objects in JavaScript where only one instance is required (=singleton), and others where&nbsp;more instances are required (e.g. prototype).
Thus, if you only require one instance use the simple object notation - if you require more instances of a object use the function-objects and the new operator.
]]></content:encoded>
			<category>pattern</category>
			
			
			<pubDate>Wed, 05 Nov 2008 20:20:00 +0100</pubDate>
			
		</item>
		
		<item>
			<title>TYPO3 4.0 to 5.0</title>
			<link>http://www.typo3-media.com/blog/typo3-4-to-5.html</link>
			<description>Outcome of the Transition Days. Robert Lemke published a interesting article related to the T3TD08.</description>
			<content:encoded><![CDATA[&quot;After T3CON08 21 developers, most of them member of the TYPO3 core team, met for one week to discuss possible strategies for a smooth migration from version 4 to 5. The outcome is a new joint roadmap, visionary new features for both branches and a unified core team with a common vision for future versions of TYPO3.&quot;
After the <link http://www.yeebase.com/blog/post/go-with-the-flow-typo3-kernteams-arbeiten-in-zukunft-noch-staerker-zusammen/2107/>motivated post</link> from Martin Herr related to the T3TD08 also <link http://flow3.typo3.org/news/0/1/>Robert Lemke published a article</link>  related to the outcome of the TYPO3 Transition Days 2008. Both a must read for TYPO3 enthusiast.
<h3>Related Posts:</h3>

<link http://www.yeebase.com/blog/post/go-with-the-flow-typo3-kernteams-arbeiten-in-zukunft-noch-staerker-zusammen/2107/>Go with the FLOW (german)</link>
<link http://flow3.typo3.org/news/0/1/>Article from Rbert Lemke on the FLOW3 Homepage</link>
http://typo3.org/development/roadmap/ 
http://typo3.org/development/roadmap/berlin-manifesto/
http://typo3.org/teams/core/communication-guidelines/
<link http://www.yeebase.com/blog/post/go-with-the-flow-typo3-kernteams-arbeiten-in-zukunft-noch-staerker-zusammen/2107/></link>]]></content:encoded>
			<category>news</category>
			
			
			<pubDate>Fri, 24 Oct 2008 23:36:00 +0200</pubDate>
			
		</item>
		
		<item>
			<title>T3CON08 - TYPO3 Conference Review</title>
			<link>http://www.typo3-media.com/blog/typo3-conference-t3con08.html</link>
			<description>The 4th international TYPO3 conference is over - with about 450 visitors it was the biggest...</description>
			<content:encoded><![CDATA[The 4th international TYPO3 conference is over - with about 450 visitors it was the biggest TYPO3 conference ever. For the first time the location of the conference was Berlin&nbsp; - to be more concrete &quot;Hotel Berlin-Berlin&quot;. In my opinion the location was great - nice rooms and chillout areas and good food.
As usual the keynote was held by Kasper - this time talking about the words &quot;Passion&quot;, &quot;Purpose&quot; and &quot;Personal&quot;... You can view a recording of the keynote below.
<h3>Talks and Best Paper Award</h3>
There were many interesting <link http://t3con08.typo3.org/presentations/schedule_70.html>talks</link> - many of them related to the upcoming PHP Framework <link http://flow3.typo3.org>FLOW3</link> and the next generation of TYPO3. It's good to see more and more people inspired by TDD, DDD &amp; Co.
The Best Paper Award this year went to<br /> 
<ol><li>Usability concepts for &quot;Backend&quot; interfaces (Jens Hoffmann)</li><li>Going global with TYPO3 (Andreas Otto, Daniel Pötzinger and Daniel Zielinski)</li><li><span class="author">Karsten Dambekalns</span></li></ol>
I was very surprised that the seconde place went to our talk about the Localisationmanager of TYPO3.
<img src="uploads/RTEmagicC_CIMG1201p.jpg.jpg" height="199" width="300" alt="" />
<sup>the L10N Team: Daniel Zielinski, Andreas Otto, Kasper Skårhøj and Daniel Pötzinger</sup>
<h3>TYPO3 Certification</h3>
There was also a first test session for the TYPO3 certification (any details are confidential :-)). It looked promising: the questions are a good mix: some related to basic TYPO3 knowledge and some which require more advanced experience or contained dangerous traps :-). For more information and dates for the first tests see: <link http://certification.typo3.org/.>http://certification.typo3.org/.</link> 

Personally, it was great to meet all the people again and to have a lot of interesting talks. Looking forward to the next TYPO3 event...]]></content:encoded>
			<category>news</category>
			
			
			<pubDate>Mon, 13 Oct 2008 10:02:00 +0200</pubDate>
			
		</item>
		
	</channel>
</rss>