<?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/"
	>

<channel>
	<title>BEKK Open &#187; domain-driven-design</title>
	<atom:link href="http://open.bekk.no/tag/domain-driven-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://open.bekk.no</link>
	<description>Et innblikk i hva som skjer i BEKK</description>
	<lastBuildDate>Fri, 11 May 2012 16:31:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Domain Driven Designed Flex?</title>
		<link>http://open.bekk.no/domain-driven-designed-flex/</link>
		<comments>http://open.bekk.no/domain-driven-designed-flex/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 09:22:32 +0000</pubDate>
		<dc:creator>Ole Christian Langfjæran</dc:creator>
				<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[domain-driven-design]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://open.bekk.no/?p=3683</guid>
		<description><![CDATA[Smells like shit and looks worse. At least that&#8217;s how I&#8217;ve related to it since I begun having some interest in Domain Driven Design and started reading up and using it in Java. The one big love I have for thinking domain driven is the notion of throwing my objects around everywhere in the application [...]]]></description>
			<content:encoded><![CDATA[<p>Smells like shit and looks worse. At least that&#8217;s how I&#8217;ve related to it since I begun having some interest in <a href="http://en.wikipedia.org/wiki/Domain-driven_design">Domain Driven Design</a> and started reading up and using it in Java. The one big love I have for thinking domain driven is the notion of throwing my objects around everywhere in the application and always being able to tell them what to do. A little like this</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">...
<span style="color: #000000; font-weight: bold;">var</span> ninja:Ninja = <span style="color: #000000; font-weight: bold;">new</span> Ninja<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
ninja.<span style="color: #006600;">meditate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
       .<span style="color: #006600;">levelup</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
       .<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Sweet and to the point if you ask me. Perhaps this is not directly named domain driven design but just plain Object Oriented Programming using the <a href="http://pragprog.com/articles/tell-dont-ask">Tell don&#8217;t ask principle</a>. Frankly I don&#8217;t care that much. Potato, potato. But what happens in save? One should guess there will be nullpointers all over that ninja if using some service/repository for saving him(or her). Or is it magically injected a repository using <a href="http://swizframework.org/">Swiz</a> or <a href="http://www.spicefactory.org/parsley/">Parsley</a> maybe? No. That won&#8217;t work. Swiz and Parlsey doesn&#8217;t have the skills to inject dependencies during simple instantiation of objects. Hardcode the services right into the Ninja? Well that&#8217;s just nasty in so many ways. And if you have some guys who is into that test driven development you&#8217;ll quickly get a taste of nasty.</p>
<h3>Why?</h3>
<p>Itemrenderers. Yes. These little guys. Every Flex developers first nightmare.<br />
<a href="http://open.bekk.no/wp-content/uploads/2010/11/ninjagrid.png"><img src="http://open.bekk.no/wp-content/uploads/2010/11/ninjagrid.png" alt="" title="NinjaGrid" width="480" height="84" class="alignleft size-full wp-image-3697" /></a><br />
This DataGrids dataProvider is a collection of Ninjas. Usually the itemrenderer for the Action column is implemented by the button either throw an Event containing the Ninja selected to do something with or injecting a service for Leveling-up and one for Prepare-for-mission into every itemrenderer. This causes most of the times a lot of duplicated code as well as hard-to-track code because you have to search the code for whom ever is set to eventListener for that event you&#8217;d be throwing. And injecting the services in every itemrenderer? Try looking at that performance when having a gazillion ninjas at your helm. </p>
<h3>Proposal?</h3>
<p>I say: Hello good ol&#8217; Singleton! Give the Ninjaclass reference to the LevelUpService. I recently started using something like this</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Ninja<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> levelUpService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:LevelUpService <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">return</span> ApplicationContext.<span style="color: #006600;">getObjectByType</span><span style="color: #66cc66;">&#40;</span>LevelUpService<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    ...
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> levelUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
         levelUpService.<span style="color: #006600;">levelUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The singleton(ApplicationContext) is just a selfmade class with static methods and a static final map which contains all the objects in the context.<br />
Or to say it in more understandable terms:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">dynamic</span> <span style="color: #000000; font-weight: bold;">class</span> ApplicationContext <span style="color: #66cc66;">&#123;</span>
    internal <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> objects:Dictionary = <span style="color: #000000; font-weight: bold;">new</span> Dictionary<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> addObject<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">object</span>:<span style="color: #66cc66;">*</span>, id:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>...<span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getObjectById<span style="color: #66cc66;">&#40;</span>id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#123;</span>...<span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getObjectByType<span style="color: #66cc66;">&#40;</span>clazz:<span style="color: #000000; font-weight: bold;">Class</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#123;</span>...<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>The various object/beans or whatever you would like to call them I usually create using Swiz/Parsley and then use the addObject to the context. Using this approach I can now <strong>tell</strong> the ninja what to do, not pass him around from class to class just so he in the end can be leveledup by a service. Also the ninja can add extra ninjatrix so that he update his own state. For example add a callbackfunction to the levelUp-method and then update an useful isLevelingUp flag. Everything behind the scenes for the itemrenderer and making it possible for every component to bind to the isLevelingUp.</p>
<h3>Sum up, drawbacks, example</h3>
<p>What I&#8217;ve kind of created here is a very small and very basic dependency injection framework. I believe it even would work on very small projects. The big drawback of this code is of course the rock hard reference to ApplicationContext. It means that wherever you want to use the Ninja class and code using the ApplicationContext is also used, you have to instantiate the ApplicationContext with the necessary objects/services. In tests you can just <a href="https://github.com/drewbourne/mockolate">mock it away</a>, but when bringing the code to other projects you&#8217;ll have to set up the ApplicationContext. Also, once you go down this path of singleton ApplicationContext, turning back in the future and throwing out your code and returning to event-throwing etc is quite a handful.</p>
<p>Anyways, how about how I implement the ApplicationContext? An example you say?<br />
Try <a href='http://open.bekk.no/wp-content/uploads/2010/11/TellDontAsk.swf'>Tell Dont Ask swf</a> for size. It&#8217;s an extremely simple Ninja-example showing injection of services and the ApplicationContext code. The code is zipped up and ready for you <a href="http://open.bekk.no/wp-content/uploads/2010/11/TellDontAsk.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://open.bekk.no/domain-driven-designed-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rent og pent med LTW</title>
		<link>http://open.bekk.no/rent-og-pent-med-ltw/</link>
		<comments>http://open.bekk.no/rent-og-pent-med-ltw/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 05:25:15 +0000</pubDate>
		<dc:creator>Ole Christian Langfjæran</dc:creator>
				<category><![CDATA[BEKK]]></category>
		<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[domain-driven-design]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[load-time-weaving]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://open.bekk.no/?p=1495</guid>
		<description><![CDATA[Jeg liker ren og pen kode akkurat like mye som hvilken som helst annen programmerer. Det kommer litt ekstra hjertebank av å se kode smellt sammen med minimal bruk av kodelinjer og like lettleselig som siste nummer av Donald Duck. Kodesnutter du bare kan trykke Ctrl+Print og levere rett til domeneeksperten og si &#8220;var det [...]]]></description>
			<content:encoded><![CDATA[<p>Jeg liker ren og pen kode akkurat like mye som hvilken som helst annen programmerer. Det kommer litt ekstra hjertebank av å se kode smellt sammen med minimal bruk av kodelinjer og like lettleselig som siste nummer av Donald Duck. Kodesnutter du bare kan trykke Ctrl+Print og levere rett til domeneeksperten og si &#8220;var det dette du hadde i tankene?&#8221;. Kildekode som hvem-som-helst kan komme når-som-helst og refaktorere hur-fort-som-helst. Jeg liker sånt:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> InternettFasade<span style="color: #009900;">&#123;</span>
...
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> leverAnmeldelse<span style="color: #009900;">&#40;</span>Anmeldelse anmeldelse<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> anmeldelse.<span style="color: #006633;">sendFaxTilAnsvarligPolitiDistrikt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                     .<span style="color: #006633;">sendEpostTilPolitiDistrikt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                     .<span style="color: #006633;">sendBekreftelseEpostTilAnmelder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                     .<span style="color: #006633;">lagre</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                     .<span style="color: #006633;">referanseNummer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Sterkt preget av min egen lille forståelse av <a href="http://en.wikipedia.org/wiki/Domain_driven_design">Domain Driven Design </a>så passer sånn type kode meg ypperlig. Noen vil sikkert arrestere meg og si at i DDD så er det ikke opp til entitetene selv å drive å lagre, men jeg liker nå det engang sånn. Skader det så mye også egentlig? Sikkert masse annet jeg har bommet på med DDD også. Når jeg først har slike fine entiteter/modeller så synes jeg det er storveis å bare sende de rundt omkring hos forskjellige fasader og servicer helt uten å tenke meg om de har injisert de riktige repositories/servicer/validatorer osv, osv. </p>
<p>Til å begynne med gjorde jeg injiseringen i forskjellige factories som populerte entitetene med det nødvendige. Etterhvert bli disse factories&#8217;ene ganske kompliserte. Selv fikk jeg i alle fall lyst til å ordne det slik at det var bare disse factories&#8217;ene som fikk lov til å opprette domenemodellene. Da først snakker vi om skikkelig kontroll. None shall pass og one factory to rule them all. Og straks har jeg litt ekstra uønsket kompleksitet og kode. Huff. Derfor ble jeg ganske interessert i å finne ut hva denne <a href="http://static.springsource.org/spring/docs/2.5.x/reference/aop.html#aop-aj-ltw">Spring load-time-weaving</a> var for noe. Og kunne det gjøre akkurat det samme som en factory? Bare behind the scenes? Joda. Såklart. Hvorfor hadde jeg ellers giddet å skrive denne bloggen? Here&#8217;s how!</p>
<h2>Hva?</h2>
<p>Load-time-weaving er i korttekst runtime instrumentering av klassene dine. Det er slik fancy <a href="http://en.wikipedia.org/wiki/Aspect_oriented_programming">AOP</a> som legger seg rundt objektene dine og slår inn straks noen prøver seg. Prøver seg i dette tilfelle med Spring-ltw er rett etter du har opprettet et AOP-instrumentert objekt. Jeg kan illustrere med et kodeeksempel</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Configurable
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Ansatt<span style="color: #009900;">&#123;</span>
    @Autowired
    <span style="color: #000000; font-weight: bold;">private</span> AnsattRepository repo<span style="color: #339933;">;</span>
    @Autowired
    <span style="color: #000000; font-weight: bold;">private</span> EpostService epostService<span style="color: #339933;">;</span>
    ...
    <span style="color: #000000; font-weight: bold;">public</span> Ansatt lagre<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        repo.<span style="color: #006633;">lagre</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Her har vi først fortalt at klassen skal instrumenteres runtime av Spring vha annoteringen <a href="http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/annotation/Configurable.html">@Configurable</a>. Det som skjer nå er at hver gang, og hvor som helst i koden, det kjøres en <strong>new Ansatt()</strong> så vil Spring hoppe inn og injisere EpostService og AnsattRepository fra konteksten sin. Det gjelder ikke bare koden du skriver, men også knæshe xml-to-java bibliotek og lignende. Så nå blir det fullt ut mulig å gjøre for eksempel dette:<br />
 <strong>new Ansatt(ansattNr).giSparken().sendSluttPakkePaaEpost().lagre();</strong></p>
<h2>Hvordan?</h2>
<p>Hvordan er like enkelt som å skrive new Person(). Vel.. Nesten da. Kors på halsen. Det første du må gjøre er å bruke Spring. Hvis du har slengt på @Configurable så mangler du en slik en i Spring contexten din:
</pre>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:load-time-weaver</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Da begynner Spring straks å mase om at den mangler en java-agent. Det er et annet ord for instrumenteringen som er det siste du må fikse. Det kan du gjør på forskjellige måter:</p>
<h3>Java argument</h3>
<p>For de fleste tilfeller må man sende inn java agenten som et java-argument. For eksempel for å starte den superenkle og populære Jetty sender du inn Spring sin java-agent gjennom Maven  slik(Linux):</p>
<p><strong>export MAVEN_OPTS="-javaagent:$HOME/.m2/repository/org/springframework/spring-agent/2.5.6/spring-agent-2.5.6.jar"</strong></p>
<p>Og da er det bare å mvn jetty:run</p>
<h3>Tomcat, GlassFish, Oracle OC4J, WebLogic</h3>
<p><div id="attachment_1761" class="wp-caption alignright" style="width: 140px"><img src="http://open.bekk.no/wp-content/uploads/2009/11/tomcat.gif" alt="Apache Tomcat" title="Apache Tomcat" width="130" height="92" class="size-full wp-image-1761" /><p class="wp-caption-text">Apache Tomcat</p></div>Med disse webserverne er det litt enklere da de har laget egne klasser for LoadTimeWeaving. For eksempel for Tomcat bruker du <a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.html">TomcatInstrumentableClassLoader</a>. Den slår du på per web-app med å legge til dette i META-INF/context.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Loader</span> <span style="color: #000066;">loaderClass</span>=<span style="color: #ff0000;">&quot;org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>For at dette skal fungere så må Tomcat innstallasjonen kjenne til klassen TomcatInstrumentableClassLoader. Dvs du slenger<br />
spring-tomcat-weaver.jar i lib katalogen til Tomcat, og vips - tilgjengelig java-agent! DET burde ikke være vanskelig å overbevise drift om å tillate!</p>
<h2>Testing</h2>
<h3>Eclipse</h3>
<p>Skal du teste at load-time-weaving koden din faktisk injiserer objektene som du håper må du også her tilby en java agent. Det gjør du ved å redigere vm argumentene til den testen eller koden du skal kjøre. Dette finner du under <strong>Run=>Run Configurations=>Arguments</strong><br />
Der mangler det en slik:<br />
<strong>-javaagent:"${USER_HOME}/.m2/repository/org/springframework/spring-agent/2.5.6/spring-agent-2.5.6.jar</strong></p>
<h3>Maven</h3>
<p>Ønsker du å kjøre enhets- eller integrasjonstester som bruker load-time-weaving så redigerer du argumentene for surefire-plugin slik at den instrumenterer likt Eclipse. Det kan du gjøre slik:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-surefire-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;forkMode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>once<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/forkMode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;argLine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			-javaagent:${settings.localRepository}/org/springframework/spring-agent/${spring.version}/spring-agent-${spring.version}.jar
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/argLine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;useSystemClassloader<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/useSystemClassloader<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Alt vel i paradis?</h2>
<p>Veeel... Det koster litt. Skal du opprette en drøss med objekter så går det atskillig raskere å gjøre det på gamlemåten med en Factory. En helt enkel test jeg gjorde viste at med en Factory fikk jeg laget 200 objekter på samme tid som det tok å lage ett @Configurable objekt. Så hvis du får en case med å opprette tusen på tusen av objekter med et hardt krav til responstid så må du kanskje være litt oppfinnsom. Personlig har jeg ikke erfart at load time weaving har gitt merkbart dårligere responstid.</p>
<p>En ting som kanskje er enda litt mer irriterende for deg som sitter og utvikler load-time-weavet kode er at du ikke kan bruke det sammen med ditt favoritt mock rammeverk. Den ene utsletter dessverre den andre og plutselig fungerer ingen tester. Det mock-rammeverket ditt trodde var et Person-objekt er ikke lengre et Person-objekt etter ltw. Nå er det et cglib objekt som utgir seg for å være et Person objekt. Personlig har jeg ikke funnet en smart måte å omgå dette på, og endt opp med å ikke teste med load time weaving men heller sørge for at enhets og integrasjonstester dekker det som dekkes skal slik at det blir middag.</p>
<p>For de som har lyst til å leke litt med load-time-weaving eller bare se et kjempeenkelt eksempel så har jeg snekret sammen et lite kodeeksempel her:<br />
<a href="http://github.com/judoole/ddd-ltw-spring">http://github.com/judoole/ddd-ltw-spring</a></p>
]]></content:encoded>
			<wfw:commentRss>http://open.bekk.no/rent-og-pent-med-ltw/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

