⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extremeprogrammingwithatgdynamo.html

📁 极限编程 Extream Programing
💻 HTML
字号:
<head><title>Extreme Programming With Atg Dynamo</title></head><body><h1><img src="logo.gif"> Extreme Programming With Atg Dynamo</h1>Applying <a href="ExtremeProgramming.html">ExtremeProgramming</a> techniques to <a href="http://c2.com/cgi/wiki?AtgDynamo">AtgDynamo</a>.
<p><hr>
I was discussing this earlier with <a href="http://c2.com/cgi/wiki?JohnBrewer">JohnBrewer</a>.  It's not easy to do <a href="UnitTests.html">UnitTests</a> in Dynamo.
<p><em>How hard/time-consuming does that in fact turn out to be?</em>
<p>Well, first of all it's written in Java.  The JVM has a big lag time when loading up java objects, and the overhead of Nucleus (the internal Dynamo namespace) means that you're creating MANY objects and setting them.  When you have DCS and all the extras installed, you can wait a good 2 minutes just to get to the point where you can see a web page.
<p>Secondly, once you edit and compile a class, there's no way to get the JVM to read in the new class if it already has a previous class loaded.  You can get around some of this with ClassLoader<a href="http://c2.com/cgi/wiki?edit=ClassLoader">?</a>, but it's a pretty awful hack, and it doesn't save you from the problems of inconsistent state -- since Dynamo expects to be seeing certain Dynamo objects with certain properties, it doesn't feel well when you add objects with different properties.
<p>The fact that you have to restart Dynamo to load in a new class is probably the biggest complaint I have with the product.  But there's nothing you can do, 'cos it's a limitation of the JVM itself.
<p>This is obviously a big hit on <a href="UnitTests.html">UnitTests</a>, compared to the EaseOfUse<a href="http://c2.com/cgi/wiki?edit=EaseOfUse">?</a> in <a href="http://c2.com/cgi/wiki?SmallTalk">SmallTalk</a>.
<p>Then, once you have the system up and running you'd have to fake user input somehow with DynamoHttpServletRequest<a href="http://c2.com/cgi/wiki?edit=DynamoHttpServletRequest">?</a> and then firing off requests.	And if there's a bug, you'd have to bring the system down and wait another 2 minutes (this is my understanding of <a href="UnitTests.html">UnitTests</a> -- you don't continue testing past an invalid state?).  That time can really eat into you.
<p>I suppose a good way to do <a href="UnitTests.html">UnitTests</a> might be to use JHTML pages and write a droplet to look for expected bean states.  You could probably wire a good testing framework in Dynamo by having a property in each component which would call up a tester in doStartService to make sure it was internally consistent, but I don't see any functional difference between that and just ordinary assertions.
<p>Then, once you have the unit tests, you're essentially going to be simulating a user in order to check out all the possible code interactions.  I've found that clicking around randomly is actually a strong testing tactic (as opposed to following what I &quot;know&quot; is the rational way to go through the site).  I'm still not quite sure how you'd get code to emulate a user for you and input data for you (say, registering a user, getting a &quot;this username already registered&quot; error and then changing the name and trying again).  When you compare the code it would take to write this, it seems simpler to have it run through QA (because any code you write won't take advantage of the pathological pathways users are capable of).
<p><em>Have you looked at Meterware's <a href="http://c2.com/cgi/wiki?HttpUnit">HttpUnit</a>? It has classes to let <a href="http://c2.com/cgi/wiki?JavaUnit">JavaUnit</a> tests speak request/response natively, POST forms, interrogate DOMS and such. I'm busy learning Dynamo and I'm doing it via <a href="http://c2.com/cgi/wiki?HttpUnit">HttpUnit</a>. Except that I haven't got very far down that route, since <a href="http://c2.com/cgi/wiki?HttpUnit">HttpUnit</a> seems not to understand redirection.</em> --<a href="http://c2.com/cgi/wiki?KeithBraithwaite">KeithBraithwaite</a>
<p>I looked at <a href="http://c2.com/cgi/wiki?HttpUnit">HttpUnit</a> a long time ago, in conjunction with a C++ project I was interested in (I ended up doing manual testing because expect was incomprehensible to me).  It might work, but I haven't looked at it so I dunno.
<p>If you have any tips on using with Dynamo, please put it up on the page.
<em>As soon as I do I will.</em>
<p>How do you see output?
<p><em>It's an extention to JUnit, so you don't. You suck the DOM out of the Response and iterate over that assert()ing for whatever content you expect. I've put an example up on <a href="http://c2.com/cgi/wiki?HttpUnit">HttpUnit</a></em> 
<p>I know this isn't really extreme programming, but I think there are some assumptions behind <a href="ExtremeProgramming.html">ExtremeProgramming</a> that don't fit well within the context of a server environment... if you're building a project from scratch then XP is the way to go, but most people prefer not to do that.
<p>-- <a href="http://c2.com/cgi/wiki?WillSargent">WillSargent</a>.
<p><hr>
<p><em>I think there are some assumptions behind <a href="ExtremeProgramming.html">ExtremeProgramming</a> that don't fit well within the context of a server environment</em>
<p>Don't let Ron hear you say that. You're probably right, though. Anything that makes testing hard, or slows the test-code cycle will conflict with XP
<p><hr>
<p>Hopefully we can start to continue to expand this page. 
<p>In my new role I've been nominated to become the local Dynamo &quot;expert&quot;, and I'll certainly be wanting any Dynamo projects at AMS eCustomer Europe to be using as many XP practices are possible. --<a href="http://c2.com/cgi/wiki?KeithBraithwaite">KeithBraithwaite</a>
<p><hr>
I disagree that unit testing, and hence <a href="ExtremeProgramming.html">ExtremeProgramming</a>, is too hard to do with servers. 
I've just introduced one of our teams to the joys of <a href="http://c2.com/cgi/wiki?MockObjects">MockObjects</a>. It's a bit harder in <a href="http://c2.com/cgi/wiki?AtgDynamo">AtgDynamo</a>, rather than raw <a href="http://c2.com/cgi/wiki?JavaServlets">JavaServlets</a>, but not impossible. It really shows up where ATG should have used interfaces rather than classes.
<p><em>Which classes are you talking about?</em>
<p>The initial costs are a bit high, but not much more than a day or two. The interesting thing about doing so, is that it really forces you into understanding the Dynamo implementation. So far the team have found the switch a bit hard, but they really like the effect. --<a href="http://c2.com/cgi/wiki?SteveFreeman">SteveFreeman</a>
<p><em>It doesn't seem as if anyone is claiming that XP is </em>too hard<em> with servers, just that it is </em>harder<em>, and it's worth recognising that, and it would be nice to know (even qualitativley) how much harder.</em>
<p>When oh when [per <a href="KentBeck.html">KentBeck</a>] will we reserve our tight fists full of dollars for tools, libraries &amp; servers created only via <a href="http://c2.com/cgi/wiki?TestDrivenDesign">TestDrivenDesign</a>, so that just to test our own code thru these systems we don't need to bend over backwards and stick our heads up our butts? --<a href="http://c2.com/cgi/wiki?PhlIp">PhlIp</a>
<p>If anyone has wants to see Dynamo integrated with <a href="ExtremeProgramming.html">ExtremeProgramming</a>, they should send ATG a rationale of why this is a Good Idea.  They listen.  -- <a href="http://c2.com/cgi/wiki?WillSargent">WillSargent</a>
<p>it would be really phat if vendor's like ATG and <a href="http://c2.com/cgi/wiki?WebLogic">WebLogic</a> provided test suites and harnesses for their own product, maybe as part of their API?  preexisting tests for SQLStoreDBManager would encourage and aid developers to write proper tests for their own extensions.  come to think of it,  it would be great to start an instance up in test mode, and be able to exersize the system automatically.  given the all-Java architecture, this shouldn't be too difficult to do, but we all know that writing tests retroactively isn't the way to go. -- <a href="http://c2.com/cgi/wiki?SalvatoreSferrazza">SalvatoreSferrazza</a>
<p>I was just browsing the javadoc for Dynamo 4.5.1 and found no reference to atg.servlet.GenericServletRequest<a href="http://c2.com/cgi/wiki?edit=GenericServletRequest">?</a> or atg.servlet.GenericServletResponse<a href="http://c2.com/cgi/wiki?edit=GenericServletResponse">?</a> there.  The closest thing I saw was javax.servlet.GenericServlet<a href="http://c2.com/cgi/wiki?edit=GenericServlet">?</a>.  Are you looking @ an older/newer version of Dynamo?  I'd really like to start doing end to end unit tests of all my components within Dynamo, and anything that could help would be great.
<p><hr>
<p>I have done extensive testing in Dynamo by making some minor changes to 
JUnit.   Basically, I modified JUnit to to run inside of a Dynamo Servlet.   
It doesn't help testing the JHTML, but I can test all of the Form Handlers, 
Business Objects and property files, live in the server.   Also, I pass 
the &quot;request&quot; and &quot;response&quot; down to <a href="http://c2.com/cgi/wiki?TestCase">TestCase</a>.   Having these available 
means I can resolveName on the propery files and output test info to 
the browser.   By sending output to the browser, I don't have to 
search the dynamo.log file to try and find my test info.
<p>I have been planning on making similar changes to be able to run JUnit 
in a Servlet.   All this requires is by-passing main and running start.
-- <a href="http://c2.com/cgi/wiki?MarkStang">MarkStang</a>
<p>Also, given that the JhTml<a href="http://c2.com/cgi/wiki?edit=JhTml">?</a> is essentially a programming language, I've also started writing tests in it. I pass stuff into AtgDynamoDroplets<a href="http://c2.com/cgi/wiki?edit=AtgDynamoDroplets">?</a> and adjust rendered output accordingly. Succesful tests render a full stop (like JUnit) and failures render something large in red. By building up a hierarchy of page fragments, I can get quite a long way and see the result in a single page. --<a href="http://c2.com/cgi/wiki?SteveFreeman">SteveFreeman</a>
<hr>
Here is a more solid example of using GenericServletRequest<a href="http://c2.com/cgi/wiki?edit=GenericServletRequest">?</a>,it is not a documented class so use at your own risk.
<p>public void testSomeDynamoFeature(String pComponentPath) {
<PRE>   HeadPipelineServlet<a href="http://c2.com/cgi/wiki?edit=HeadPipelineServlet">?</a> head;
   head = (HeadPipelineServlet<a href="http://c2.com/cgi/wiki?edit=HeadPipelineServlet">?</a>)Nucleus.getGlobalNucleus()
          .resolveName(&quot;/atg/dynamo/servlet/pipeline/DynamoHandler<a href="http://c2.com/cgi/wiki?edit=DynamoHandler">?</a>&quot;,
                       Nucleus.getGlobalNucleus(), true)
  DynamoHttpServletRequest<a href="http://c2.com/cgi/wiki?edit=DynamoHttpServletRequest">?</a> request = ((HeadPipelineServlet<a href="http://c2.com/cgi/wiki?edit=HeadPipelineServlet">?</a>)).getRequest(null);
  response.setResponse(new GenericHttpServletResponse<a href="http://c2.com/cgi/wiki?edit=GenericHttpServletResponse">?</a>());
  response.setOutputStream(new ByteArrayServletOutputStream<a href="http://c2.com/cgi/wiki?edit=ByteArrayServletOutputStream">?</a>());
  <a href="http://c2.com/cgi/wiki?DynamoHttpServletResponse">DynamoHttpServletResponse</a> response = new <a href="http://c2.com/cgi/wiki?DynamoHttpServletResponse">DynamoHttpServletResponse</a>();
<p>  // component path is a string like &quot;/path/to/some/dynamo/component&quot;
  SomeClass<a href="http://c2.com/cgi/wiki?edit=SomeClass">?</a> someClass = (SomeClass<a href="http://c2.com/cgi/wiki?edit=SomeClass">?</a>)request.resolveName(pComponentPath);
  someClass.handleSomeTest(request,response);
</PRE>}
<p><hr>
<p>Here at ZEFER Pittsburgh we're in the midst of our first serious Dynamo project, and I have to say its one of the most amazing pieces of software I've ever encountered.  The ATG guys have built an incredibly flexible and extensible system. A great demonstration of the power of good design.  Anyway, we're running the project as XPish as we can, and hoping to work through the difficult <a href="http://c2.com/cgi/wiki?UnitTest">UnitTest</a> of the server etc. We'll let the group know if we come up with any good ideas.  Thanks for the hints gang!
-- <a href="http://c2.com/cgi/wiki?ToddJonker">ToddJonker</a>
<p><hr>
I'm glad some folks like ATG. I don't like it much at all. Of course, our project is writing an RMI app, not a web app. It really lacks good RMI support. .02
<hr><a href="http://c2.com/cgi/wiki?edit=ExtremeProgrammingWithAtgDynamo">EditText</a> of this page (last edited March 28, 2001)<br><a href="http://c2.com/cgi/wiki?FindPage&value=ExtremeProgrammingWithAtgDynamo">FindPage</a> by browsing or searching<p><font color=gray size=-1>This page mirrored in <a href="index.html">ExtremeProgrammingRoadmap</a> as of March 31, 2001</font></body>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -