NEWS: Cheap Topamax Propecia Credit report bureau Credit card application. Cheap Claritin Cheap Topamax Anafranil My credit score for Free credit report online no membership Allegra Why is your credit score is important Equifax free copy of credit report? Instant credit approval cards Xenical Your credit score VPN dialup, Low interest credit cards with instant approval Cialis Soft Tabs Credit union annual meeting reports, Levitra Vs Viagra All 3 credit scores Neurontin. Anualcreditreport.com Buy Clomid Buy Female Viagra Effexor Buy Levaquin Prozac Buy Viagra Soft + Cialis Soft Cheap Yerba Diet: Codeine Cheap Clarinex Atacand Cheap Augmentin Celtic Frost Ringtones Online Acomplia Phentermine Hcl Cheap Yerba Diet Cialis Vs Viagra Check credit reports Buy Hoodia Gordonii HG p57! Debt consolidation for credit card and vehicle loan ics Credit card application for? Premarin Instant approval low interest credit cards: Buy Arimidex Flomax Paxil Selena Ringtones Cheap Cozaar! Discover secured credit card, Remove credit card debt. Annual credit report free Client dns openVPN Credit card debt Free Real Ringtones Amoxil Student credit card debt statistic? Zocor Cheap Colostrum 800 Clean your credit report! Ambien Credit cards 0 apr. Average national credit score Xenical Inderal! 500 credit score? Repairing credit score 2004 card college credit debt mae nellie statistics student, Penis Growth Pills! Consolidate credit card debts Atarax Avalide Buy Cymbalta Deltasone! Victoria secret credit card application, Best credit score! Free credit report gov Xanax Online Cheap Desyrel. How to increase credit score, Dynamic ip VPN Zoloft! Card applications for bad credit Cheap Valtrex. Affect credit score Trimox Virgin credit card application VPN setup About credit reports? Alprazolam Low apr interest credit cards: Application card credit interest low Celexa? Real estate investing information free credit report score Cheap Allegra. Setup VPN, Buy Coreg Soma Transunion credit reporting agency! Effexor Cheaper credit card uk Arimidex Bad credit instant approval credit cards My credit report Cheap Cialis Soft Tabs. Famvir Buy Diovan Online business credit report? Credit report and Card collection credit debt law Cialis Dosage Exelon Cheap Cephalexin? Instant approval student credit cards Online capital one zero apr credit card application Anonymous internet Levaquin Improve my credit score 635 credit score? Landlord credit report Credit reporting bureau Levitra Fix my credit report! Cheap Imitrex Cephalexin Low interest credit cards visa fixed apr Egg credit card application, Card credit debt negotiation settlement Average credit scores. Juniper credit card application Buy Hoodia? Credit reporting in Cheap Celebrex Tramadol Propecia Uk Risperdal Cheap Ultram Credit reports for landlords Credit report .com Norvasc Viagra Free instant credit report with no credit card: Online Viagra + Cialis + Levitra. Avoiding student credit card debt Buy Acomplia? Cheap Viagra Your credit score in. Xanax Bars Cheap Soma Viramune: Zovirax Allegra? Credit card consolidation company: Xanax Side Effects Application card chase check credit status Exxon credit card application Freecreditreports? Danazol Low credit score loans Cheap Protonix Hytrin Credit cards us instant approval Card credit debt divorce Cheap credit reports, Buy Viagra Professional Exelon Cheap Kamagra How to raise my credit score Prevacid Best apr credit cards? Synthroid: Levitra Buy Lexapro Ditropan About credit reports Free credit report no membership online Lorazepam Mint credit card uk Buy Plavix Cheap credit report Naprosyn Retin Card credit debt pay Hytrin Remeron Lexapro Dispute credit reports Propecia Results Poor credit score Tramadol Ambien Low fixed interest apr credit cards balance transfers Cardura Credit score definitions VPN setup xp! Inderal Instant approval credit cards for bad credit Rimonabant Cheap Avandia Cheap Propecia! Cheap Lisinopril. Lorazepam 5 Maxaquin VPN tunneling Unsecured credit card application Herbal Phentermine! Buy Clomid Credit cards no apr Maxaquin Meridia Buy Ultracet Mobic Singulair Zyban: Credit card offer Buy Glucophage Gas credit card application Chase redit card srevices Buy Zanaflex Imdur, Annual creditreport.com: VPN 635 credit score? Cheap Viagra Soft + Cialis Soft One credit card application: Didrex Free credit report gov Buy Viagra + Cialis Risperdal Lil Flip Ringtones Cialis Ceftin VPN dialup Meridia Stop credit card applications Maxis Caller Ringtones Biaxin Paxil Best ways to eliminate credit card debt Transunion credit reporting agency 0 credit card application Ambien, Out my credit score Hyzaar Adalat Beacon score credit report History transunion credit report Cheap Cialis Deltasone Cheap Cozaar Avandia Low fixed apr cards for low credit Neurontin Lowest apr credit cards Credit report with score Amoxil No apr no annual fee low interest credit cards Cialis Premarin Debt credit cards settlements! VPN setup xp On credit scores Buy Viagra Jelly? Zocor Chase manhattan credit card application Buy Motrin How to raise my credit score Cheap Zocor: American express credit card application: Lasix Credit score car loan, Credit card deal maker Cheap Capoten Imovane Cipro Ultracet Card credit debt student Cialis Soft Tabs Credit card application bad! Credit cards with 0 apr Buy Zyban! Slimfast Free Mp Ringtones Lipitor Credit card debt consolidation information Credit free improve score Credit scores mortgage Clarinex Credit report Free instant credit report online! Credit card debt remover Credit reporting agencies addresses Set up VPN Adipex Online Scores credit card fraud Instant capital one 0 interest credit card application Credit cards offering 0 Cialis Soft Tabs Cheap Tramaden Cheap Wellbutrin SR Buy Cialis Propecia Online VPN setup. Phentermine! Cheap Cialis Jelly Business credit report repair! Card credit debt grant help pay Diazepam: Deltasone Household bank credit card application Cheap Levaquin Risperdal Clean your credit report Butalbital Cheap Nizoral. Atarax! National free credit report Apr for credit cards Lexapro Credit reporting system: Credit reporting bureau. Credit card application for people with bad credit Online capital one 0 interest credit card application Valtrex? Credit card reporting: Motrin Cheap Feldene Norco Evista Lamisil Celtic Frost Ringtones Buy Sumycin Good credit score Instant approval card applications credit cards. Cheap Zyloprim Prozac Wellbutrin Score federal credit union How do i get my free annual credit report, Phentermine Hcl Imdur Credit card application forms Cheap Casodex Buy Soma, Eminem Ringtones Fioricet Atarax Levitra Online Fioricet Codeine Cheap Flonase! Cheap Phentrimine Cheap Amaryl, Card credit debt elimination scam Credit bureau score Calan Risperdal Improve credit score fast Levitra Online, Tamiflu Credit reporting service Tramadol Buy Kamagra, Fosamax? Cardura Credit cards no apr Scores credit Instant credit card approval applications Credit scores online Cialis Vs Viagra Motorola Ringtones: Instant approval bad credit cards Equifax free copy of credit report Free instant credit report online Mobic Instant approval credit cards for bad Zyban VPN tunnel! Cheap Clomid! Buy Cleocin Norvasc! Nolvadex Credit report mortgage leads. For credit score Florida free credit report Cheap Viagra + Cialis + Levitra? Low apr credit cards uk? Online Ultram, Mosquito Ringtones: Alprazolam 2mg Cheap Neurontin Biaxin Cialis Credit card application with instant approval? Credit score Phentermine Online? Fair credit reporting act summary Ativan Online Viagra + Cialis Interest rate credit score No credit checks instant aproval credit cards, Zoloft Buy Protonix Deltasone Contivity VPN, All 3 credit scores: Clarinex, Cheap Ditropan Plavix Cialis Professional Lipitor Cheap credit card processing Uk online credit card application? Credit card application bad credit Credit card deal maker, Motrin Claritin Credit reporting services VPN client. Buy Viagra Soft Tabs Buy Zoloft Your credit score in, Buy Zyrtec Zocor Three credit reporting agencies Levaquin Herbal Phentermine Online Rimonabant Clean up your credit report, Exelon, Credit reports for landlords Actos Zetia Annuel credit report Raising your credit score, Commonwealth bank credit card application Online Zithromax Glucophage No credit instant approval credit cards Mortgage credit reports? Credit card application Buy Lisinopril: Soma Baclofen How to improve my credit score Trw credit reports Cheap Evista Carisoprodol Credit score values: Protect yourself Voltaren Best credit report Interest rate credit score Ambien Tramadol Online Card credit debt debt negotiation reduction service Credit card debt consolidation Caverta Propecia Diovan Credit plus score Buy Doxycycline Zyrtec? Carisoprodol. Can i get a free credit report fico score. Credit card deal 0 Is 700 a good credit score Caller Ringtones Cialis Uk Credit cards instant approval, Zyban Flonase My credit report for Norco Cheap Viagra Soft + Cialis Soft Allegra Credit score online Credit card applications for bad credit Valium Cheap Cephalexin Low interest apr credit cards T Mobile Ringtones. 025 apr balance transfer credit cards in canada Free credit score check! Bactrim Accept credit card payment Buy Viagra! Capoten Phentermine Diet Pills Arimidex Credit reporting companies. Zoloft Credit score to. Indocin! Elavil Cingular Ringtones Propecia? Baclofen Credit card application bad! Credit scores meaning Usa credit card company Instant approval bad credit unsecured credit cards Effexor Your credit report Install VPN O apr credit cards Credit score in Guaranteed instant approval credit cards Luvox Buy Nolvadex Relient K Ringtones Alprazolam Xanax Business credit report repair Lil Wayne Ringtones? Free access to credit reports Credit score definition. Viagra For Women Lozol Altace Credit score simulator! Valtrex! Effexor Zestril: Us credit cards interest low apr 0 Soma Three credit scores To credit reporting Xanax Xr Free credit report com Cheap Plavix Cheap Neurontin? O apr credit cards. Secure VPN Avalide Bactroban Cheap Elavil Pravachol Xanax Cheap Buspar Card credit interest low? Best credit cards and low apr Credit credit card applications? Cialis Dosage Hoodia Buy Plendil Credit card processing offer Credit cards 1.99 apr ny Levaquin Imitrex 50 Cent Free Ringtones: Propecia Results: Allegra Credit report questions Credit bureau scores? Mac os x VPN Cheap Cialis Professional Soma All 3 credit scores! Cialis Generic. Debt consolidation versus credit card payment Ultram Credit score codes Viagra Singulair Xenical: Three credit reports Xenical. Valtrex Effexor Raising your credit score Credit card applications for Online Cialis Jelly: Danazol Tofranil Tramadol Cod Average credit card debt in america Anafranil Debt reduction solution credit card Business card consolidation credit credit debt debt finances Synthroid Your credit report Lipitor Credit reporting bureau! Ipsec VPN Set up VPN, Buy Viagra Soft + Cialis Soft Lowest fixed apr credit cards: Buy Effexor My credit scores Federal credit reporting act! Application card credit instant response? My annual credit report! Propecia Uk Buy Diflucan Internet VPN xp Cheap Cipro: Card collection credit debt law Vantage credit score Cheap Herbal Phentermine Zoloft Plavix Cheap Avodart Protect yourself Online Viagra Soft + Cialis Soft, Actos Apr for credit cards? Boost credit score Feldene Ultracet Ambien VPN security: Fix credit score Luvox Cardura Lexapro Credit cards online application Nextel Ringtones VPN tunnel Dave Hollister Ringtones Credit card applications instant approval, Instantly instant free online credit report! Instant free credit report! Tramadol Credit plus score? Canada credit card application. Adderall How to read credit scores Cheap Lexapro Card con consolidate credit debt! Credit cards instant approval, Federal credit reporting Nexium: Zestril: Online Female Viagra Credit plus score Cheap Amaryl Instant approval credit cards for: Instant approval credit cards bad credit Phentermine! Cheap Viagra + Cialis Repair credit score Fixed low apr credit cards Instant approval cards! Yerba Diet Cheap Actos Credit cards mwith low apr Accutane For credit score Hytrin Online Cialis Soft Tabs Kamagra Instant approval credit cards applications Lamictal Out my credit score Diazepam 5mg Premarin VPN server Low credit score loans Accutane Unsecured credit card applications Famvir Washington mutual credit card application Credit report bureau Viagra Uk No credit score mortgage Fica credit score Adipex Totally free credit report: Zoloft Online Viagra Jelly Cheap Claritin: Inderal Protect yourself Cheap Zovirax? Cialis Drug Bactrim Chevron credit card services Federal law one free credit report yearly: Augmentin Motrin Instant approval credit cards for people with bad credit. Meaning of credit scores Inderal Trw credit reports Premarin Cialis Drug. Cheap Danazol Copy of credit report Download Free Ringtones Zovirax Student credit cards with no apr Perfect credit score! Xenical Cheap Feldene Cicsco VPN Credit score of, Zetia Cardura Three credit reports Credit score check Cheap Lipitor. Zyrtec VPN connection? Arava? Differin Boost your credit score, Nolvadex! Parlodel Instant credit card application, A credit report Valtrex Fico credit scores, Torn up credit card application Buy Lamisil, Gas credit card application Singulair Parlodel Open VPN Lamisil? Lorazepam, Card credit debt option reduction No credit card application. Cheap Prednisone, 5 Online student credit card application Interest rate credit score! Accept credit card payment? Cheap Augmentin Instant approval credit cards applications Credit score Buy Tramadol Cheap Acomplia Buy Evista Setup VPN Cell Phone Ringtones: Credit score of Credit score definition. Online Phentrimine Imuran Credit report and scores Prilosec 025 apr balance transfer credit cards Buy Motrin Zyban Risperdal Lotensin Vantage credit score Tramadol Adipex Secured credit card application Tramadol, Aristocort! Linksys VPN Propecia Canada New Ringtones? Effexor Instant free credit report Credit report dispute form! Pink Floyd Ringtones! Cibc credit card application: Buy Lexapro Cheap Cardura Mysoline Cheap Clarinex Instant approval credit cards? Propecia N Sync Ringtones Buy Phentrimine! Cheap Cialis Professional. Buy Zyrtec Cheap Zyban, Three credit reporting agencies. Cheap Lamisil? Xanax Lortab, Cialis Uk. Card credit debt forgiveness settlement. 3 bureau online credit report Secured credit card applications Carisoprodol Soma VPN Credit cards with instant approval Lipitor Credit card transfer offers Lipitor Search high limit credit cards instant online approval Transunion credit reports. Credit reporting laws. Copy of my credit report Canada credit card application Credit card debt termination Diovan Free government credit report? Dance Last Ringtones Flagyl ER Phentermine Propecia Drug! Bad credit instant approval 0 balance tranfer credit cards Online Viagra Free credit rating report Open VPN Check credit scores Levitra Vs Viagra Alprazolam Xanax Free Cingular Ringtones History transunion credit report: Rimonabant, Low fixed apr credit cards: Diazepam Valium Acomplia Fioricet With Codeine Free consumer credit report VPN download Alprazolam Xanax Average credit scores Credit score reports: Valium Celebrex: Buy Zocor Trans union free credit report Credit reporting in Darude Ringtones VPN server Viagra For Women Kamagra Card credit debt eliminate forgiveness? Buy Herbal Phentermine? 0 apr credit card application, Buy Ceftin! Free Mp Ringtones. San diego credit score needed to get a mortgage Loans credit score Instant approval bad credit unsecured credit cards Nolvadex Online Phentrimine? Best intoductory apr credit cards Information credit report Walmart credit card application. No apr credit cards Tylenol Lorazepam? Acomplia Boost credit score:

Data Access Object with Lucene

Posted by shrikant.joshi on April 29th, 2006

Data Access Object (DAO) is a popular J2EE pattern that is used for accessing and manipulating data in a database independent way. The DAO encapsulates the persistence mechanism and the application component can use the DAO without bothering about the specifics of the persistence implementation. In addition to this, the application can use the abstract factory pattern to gain flexibility. This is achieved by introducing a DAOFactory that supplies DAOs for a given persistence mechanism. The DAOFactory in turn uses a factory method so that a concrete DAOFactory can be supplied.

DAOs can also be useful when the application uses a text store and search tool like Lucene. Lucene is a popular text indexing and searching library.

I am using TextDAO to handle the CRUD methods using Lucene. A map is passed with name/value pairs as data from the application. One of them points to a document that contains text to be searched. All of the names (fields) are used in the search using MultiFieldQueryParser. A ValueList is returned on search. Since, there is no ‘update’ method in Lucene, I implemented it using a delete followed by create. You can download the code with eclipse project.

The key to the solution is that the app does not know if we use text search library like Lucene or a database. It is a matter of simply changing the DAO if we intend to store the data in a relational database.

Conventional wisdom and MVC

Posted by shrikant.joshi on March 27th, 2006

Model-View-Controller or MVC is probably the most talked-about pattern, but it is also the least understood pattern. Number of UI frameworks address and enforce clear separation between these components. But, when it comes to practice (and deadline pressures), we see a lot of implementations not using it correctly. Of course, it is a different matter that, the proper usage of the MVC pattern ultimately (and even in short term) reduces the implementation time along with making the system flexible, extensible and more maintainable. I am not going to talk much about how the MVC pattern works but here is a short description for that.
A controller handles gestures coming from view and calls the appropriate actions on the model. The model represents business objects and processes. The view is responsible for rendering the model and also handling the change events originating from the model.
In a well designed application, it is possible to replace any of the component without impacting other components. The clear division of responsibility is the key here. It is the modularity that provides robustness and interchangeability much like the hardware components.
RoR and ZendFramework have been creating a buzz lately with a claim to simplify the software development while still enforcing a modular design. I decided to write my first PHP program using ZendFramework. I looked at the samples and realized that these have fallen thro' the cracks. They do not follow MVC even though the framework that they aim to demonstrate emphasized the pattern. Didn't I tell you?
Well, I decided to take one of the REST client examples and refactor it to use MVC. It turned out to be a pretty simple exercise. That is exactly what led me to this blog entry.
ZendFramework depends on conventions to decide the controller and action. This makes it very easy to use. A bunch of frameworks especially in C++ or Java world, do not use this technique of using conventions to simplify the development. A simple naming convention does wonders here.
Refactored Yahoo search sample
You can check out the working of this sample here.
We first create a dispatcher which sets up the view and controller directory and then dispatches the actions. Each request is broken down into controller and action. e.g. /yahoo/search is sent to YahooController to execute searchAction method. Here is the code for dispatcher or front controller:

PHP:
  1. set_include_path(get_include_path().PATH_SEPARATOR.':/path/to/zend/library');
  2.  
  3. include 'Zend.php';
  4.  
  5. function __autoload($class)
  6. {
  7. Zend::loadClass($class);
  8. }
  9.  
  10. $view = new Zend_View;
  11. $view->setScriptPath('views');
  12. Zend::register('view', $view);
  13.  
  14. $controller = Zend_Controller_Front::getInstance();
  15. $controller->setControllerDirectory('controllers');
  16. $controller->dispatch();
  17. ?>

I created a YahooController to handle all actions related to webservices provide by Yahoo. An IndexController handles all the requests that do not have a controller. The YahooController first creates the model. This can be done with a delegate for a more realistic case. Then, the model is made available to the view and then simply ask the selected view to render itself. I created a simple theme which decides on which view to render. Here is the code for YahooController:

PHP:
  1. Zend::loadClass('Zend_Controller_Action');
  2.  
  3. class YahooController extends Zend_Controller_Action
  4. {
  5. public function indexAction()
  6. {
  7. $this->_redirect('/yahoo/search');
  8. }
  9. public function searchAction()
  10. {
  11. $filterReq = new Zend_InputFilter($_REQUEST);
  12. $keywords = $filterReq->noTags('keywords');
  13. $theme = $filterReq->noTags('theme');
  14. if (empty($theme)) {
  15. $theme = 'boy';
  16. }
  17.  
  18. $yahoo = new Zend_Service_Yahoo('zendtesting');
  19.  
  20. try {
  21. $view = Zend::registry('view');
  22. $view->title = 'Yahoo Search';
  23. $view->keywords = $keywords;
  24.  
  25. if (!empty($keywords)) {
  26. $imageResults = $yahoo->imageSearch($keywords, array("results" => 5));
  27. $webResults = $yahoo->webSearch($keywords);
  28. $newsResults = $yahoo->newsSearch($keywords);
  29.  
  30. $view->imageResults = $imageResults;
  31. $view->webResults = $webResults;
  32. $view->newsResults = $newsResults;
  33. $view->searchPerformed = TRUE;
  34. } else {
  35. $view->searchPerformed = FALSE;
  36. }
  37.  
  38. echo $view->render($theme.'/view_yahoo_search.php');
  39. } catch (Zend_Service_Exception $e) {
  40. <p style="color: red; font-weight: bold">An error occured, please try again later.</p>
  41. ';
  42. echo $e;
  43. }
  44. }
  45.  
  46. public function noRouteAction()
  47. {
  48. $this->_redirect('/');
  49. }
  50. }?>

The view is responsible for displaying the model. Each theme will show the content in different way. Here is the code for a view in one theme:

HTML:
  1. <!DOCTYPE html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <style type="text/css">
  3. html, body {
  4. margin: 0px;
  5. padding: 0px;
  6. font-family: Tahoma, Verdana, sans-serif;
  7. font-size: 10px;
  8. }
  9.  
  10. h1 {
  11. margin-top: 0px;
  12. background-color: darkblue;
  13. color: white;
  14. font-size: 16px;
  15. }
  16.  
  17. form {
  18. text-align: center;
  19. }
  20.  
  21. label {
  22. font-weight: bold;
  23. color: blue;
  24. }
  25.  
  26. img {
  27. border: 0px;
  28. padding: 5px;
  29. }
  30.  
  31. #web, #news {
  32. float: left;
  33. width: 48%;
  34. margin-left: 10px;
  35. }
  36.  
  37. #image {
  38. margin: 10px;
  39. border: 1px dashed grey;
  40. background-color: lightgrey;
  41. text-align: center;
  42. }
  43.  
  44. h2 {
  45. font-size: 14px;
  46. color: grey;
  47. }
  48.  
  49. h3 {
  50. font-size: 12px;
  51. }
  52.  
  53. p {
  54. color: blue;
  55. }
  56.  
  57. #poweredby {
  58. clear: both;
  59. }
  60. </style>
  61. </head>
  62. <h1>Yahoo! Multi-Search</h1>
  63. <form action="/yahoo/search" method="post">
  64.  
  65. <label>Theme: <select name="theme"><option value="boy" selected>Boy</option><option value="girl">Girl</option></select></label>
  66.  
  67.  
  68. <label>Search For: <input type="text" name="keywords" value="<?php echo $this->keywords; ?>"></label>
  69. <input type="submit" value="Search!">
  70.  
  71. </form>
  72.  
  73. <?php
  74. if (($this->searchPerformed) && ($this->imageResults->totalResults()> 0)) {
  75. echo '
  76. <div id="image">';
  77. echo '
  78. <h2>Image Search Results</h2>
  79. ';
  80. foreach ($this->imageResults as $result) {
  81. echo "<a xhref='{$result->ClickUrl}' title='$result->Title'><img xsrc='{$result->Thumbnail->Url->getUri()}'></a>";
  82. }
  83. echo '</div>
  84. ';
  85. }
  86.  
  87. if (($this->searchPerformed) && ($this->webResults->totalResults()> 0)) {
  88. echo '
  89. <div id="web">';
  90. echo '
  91. <h2>Web Search Results</h2>
  92. ';
  93. foreach ($this->webResults as $result) {
  94. echo "
  95. <h3><a xhref='{$result->ClickUrl}'>{$result->Title}</a></h3>
  96. ";
  97. echo "{$result->Summary}
  98. [<a xhref='{$result->CacheUrl}'>Cached Version</a>]
  99.  
  100. ";
  101. }
  102. echo '</div>
  103. ';
  104. }
  105.  
  106. if (($this->searchPerformed) && ($this->newsResults->totalResults()> 0)) {
  107. echo '
  108. <div id="news">';
  109. echo '
  110. <h2>News Search Results</h2>
  111. ';
  112. foreach ($this->newsResults as $result) {
  113. echo "
  114. <h3><a xhref='{$result->ClickUrl}'>{$result->Title}</a></h3>
  115. ";
  116. echo "{$result->Summary}
  117.  
  118. ";
  119. }
  120. echo '</div>
  121. ';
  122. }
  123. ?>
  124. <p id="poweredby" style="text-align: center; font-size: 9px;">Powered by the Zend Framework</p>
  125.  
  126. </body>
  127. </html>

The REST of the story…

Posted by shrikant.joshi on March 12th, 2006

As KGO's Paul Harvey would say, you know what the news is. Here is the rest of the story...As it happens, the rest of the story involves REST. This rest will not put you to sleep as it is a bit of fun work. Okay, enough of puns...

I was looking into Axis as a means for easing the pain of using WebServices in Java. And, it is a nicely designed open source project based on SOAP that can be used to write servers or clients which implement webservices. I will write about this in a couple of weeks. But, for now it served as a preamble to this weeks blog.

REST stands for Representational State Transfer. It is an architectural style that specifies a way to access network resources in a stateless manner. The returned resource can be used for further drilling down and moving the client from one state to another. REST does not indulge into implementation but specifies the usage of standards like HTTP, XML.
A lot of resources/applications are made available using REST webservices on the internet. The simplicity of a REST system makes it very easy to use for writing applications in any language (including scripting languages). Yahoo, Amazon etc. are examples of REST API to access their resources. I will provide a bit more details on Yahoo's web search api as a case study here.

You can search the web for any given term, phrase, image, news, local-search using Yahoo's REST api. The search parameters are passed as a simle GET or PUT query to Yahoo and the results are returned in XML format. Once we parse the results from XML, we are ready to display the required attributes to the user. Here is a class diagram and interaction diagram that I put together to depict the flow.

Class Diagram :

Class Diagram YahooSearchClient

Interaction diagram :

Interaction Diagram
Yahoo maps, Flickr, del.icio.us are all accessible using the same fundamental concept of REST api. All one needs to do is get a (free) developer application id from Yahoo and use that in the api for accessing the information and then creating interesting applications. The api is available in many different languages.

Zend published their framework 0.1.2 for PHP. It includes an api to access some of these popular web services using REST client component. The framework looks a bit under-cooked at this time. I am sure it will get better in a short period of time. I will like to check it out soon.

AntiPattern: Distributed Disaster

Posted by shrikant.joshi on February 25th, 2006

Name: Distributed development disaster
Also known as: Geographical Gotcha
Most frequent scale: Enterprise
Refactored solution name: Game plan or Dahi-handi
Refactored solution type: Process, Management
Root causes: Development infrastructure, Time zone, Cultural difference, Unclear responsibilities
Unbalanced forces: Management of complexity,Management of IT resources
Anecdotal evidence: “Why on earth are they rewriting the same algorithm?”, “If we add a few more people to our group, we will be able to pull this through”, “I have no idea what Srini’s group is doing?”, “Damn, I have to wait till tomorrow to sync up the repository”, “cvs update is taking forever…I better go home and come back tomorrow.”, “How come nobody is in the office today?”, "What is Diwali?".



Background

Geographically distributed development is a reality in medium to large enterprises. With the advancements in communication technology and bandwidth, a large number of companies are dealing with multisite groups. The biggest problem in this is often people and process related rather than technology. A lot of these problems are also observed in collocated teams with silos, but they take a front seat in distributed teams.

Imagine a soccer team without a game plan and without assigned responsibilities where everybody is playing offence and defense at the same time! When the whole team is running after the ball, it is bound to lose regardless of talent on the team. On the other hand, a team with a well thought game plan optimizes the skills of every player on the team. In this case, the team potential is more than the sum of individual player’s talents. The coach/manager should assign each player to the position that best suits him and the team. Each player should know what his responsibilities are and should be able to communicate well with teammates.

Dahi-handi is a fun festive sport where a team of people forms a high tower by balancing on each other’s shoulders to reach a large pot full of yogurt. If people are not synchronized, the human tower falls to the ground in no time. On the other hand a well-rehearsed and coordinated teamwork can reach towering height to the pot and is a delight to watch. Well, I can’t imagine how a distributed dahi-handi will look like, may be using a PS2 with networked players!

General Form

The challenge in handling a multi-site group is multi-fold. First of all, the architecture and design of the system should be modular and partitioned properly. If the changes that one of the subgroups is doing affect other modules, there needs to be a closer interaction. If the interfaces are not clearly defined, the results lead to chaos and non-productive environment. Writing a comprehensive and automated suite of unit tests is invaluable. Complete and precise requirements document, design documents and review process at each stage is extremely important. An important observation to remember is that the dev. Process should foster independent thinking and not sweat the small stuff. Controlling at micro level often does not work.

Source code management is another important factor which affects this scenario. Multiple solutions have been employed to tackle this front in the form of mirroring, synchronizing, master-slave conf., module separation etc. Issues like tuning synchronization frequency and master-slave need to be handled depending on the coupling between multi-site groups. A fine tuned build process for distributed teams should reduce the amount of downloads (typically of common libraries) during each build.

The biggest problems have been reported on ‘Personal’ fronts rather than on technology front. The teams located at different places need to feel like they are part of the same group. Water cooler gossip needs to flow back and forth. Tele-conferencing, e-mails and periodic phone conversations help but nothing builds the bond like ‘face time’. Co-workers should visit on a reasonable basis to get acquainted with other team members. These visits should not be taken to the extremes so as to become a burden.

Symptoms and consequences

  • No or bad communication between groups working at different sites
  • No reuse at design or code level
  • Incompatibility between modules
  • Extensions in the system lead to multiple changes across all groups
  • No clearly defined interfaces
  • Build breaks which get fixed after a very long time
  • Lost changes in source code repository
  • Merge problems due to ineffective sync. cycles
  • Poor knowledge of modules that are owned by other sites
  • Slow learning curve during new employee training
  • Unacceptable network bandwidth
  • Blame game
  • Slow turnaround for customer issues

Refactored solution

There are at least following dimensions to the solution:

  1. Architecture and design of the product: A truly modular and extensible architecture usually leads to clear separation of modules and responsibilities. Proper use of encapsulations, interfaces, facades, inheritance hierarchies and usage of design patterns in general are of immense value.
  2. Development process: Architectural responsibilities should be assigned so decisions can be made locally. The process should also promote design and code reviews. Coding standards make life easier not only for developers but code maintainers. We should figure out what works for our situation so that there is no unnecessary overhead of red-tape processes while the product is managed with control and direction. Ownership per deliverable is another way to handle this problem.
  3. Automated test suite: The value of an automated unit test suite increases multifold when a team is distributed. The team needs to make sure that all the tests pass at any time from a public build. Mock objects based testing helps the development process when parallel teams are working at different velocity.
  4. Communication between diverse groups: Mailing lists, informal dialogues, group decision making, unity of purpose, absorbing and enjoying cultural diversity, on-site visits, briefings, design documents, teleconferencing are various tools for success in this area. An important point is to minimize unnecessary communication while maximizing understanding. This is similar to partitioning an application across network processors.
  5. Proper use of code management system: There are a lot of different approaches employed by various organizations. We need to find out what works best for us. Mirroring and master-slave configurations are widely used. There are positive and negative sides for these approaches. Various source code control systems support distributed development in different ways. ClearCase has an add-on unit called ‘Multi-site’. CVS, Perforce have also been employed by a lot of companies. The important thing for us is to keep it simple and workable.
  6. Time overlap: It is very desirable to have at least a few hours of overlap time for the work hours. In cases where the teams are separated by brutal time differences, like California and India, we need to come up with creative ways for an overlap. E.g team in California can work 6:30 am to 3:30 pm while India team can work from noon to 9pm. That way an overlap of at least an hour or two is availed. Weekly mmetings can clear a lot of doubts and bring the team on the same page.
  7. Hierarchy: In general, flatter teams work best. But, in certain situations, module leaders can contribute and ease the pain of day to day management. I will try and address this issue some other time.

Example

A lot of products have been developed and managed over geographically distributed sites. One can learn a lot by knowing how various open source projects are developed. I have been part of and managed many projects where the groups were geographically and culturally distributed. With globalization on everyone's mind, I don't think there is any need for specific examples.

Related solutions

Check out the refactored solutions to other antipatterns like Project mismanagement.

Read-Write-Execute

Posted by shrikant.joshi on February 12th, 2006

I created the site for no other reason other than to have fun creating it. I intend to write my thoughts about various subjects that interest me. I hope it will be useful or at least interesting.

I have been reading a lot of blogs and other material on the net. I thought this is the easiest way to change my file permissions from read-only to read-write! I hope I can execute the plan and keep up the enthusiasm.


sildenafil uk only purchase oxycontin from online pharmacies soloft paxil prosac depression anxiety chemical sildenafil phentermine lowest prices phentermin buy phentermine cod trusted pharmacy catalog seroquel for treating depression fermenting ephedra soma online medicine without prescription soma soma san diego interpol herbal phentermine forum cheap phentermine free sh diet prednisone diet phentermine pills drug phentermine oxycontin for pain relief order cheap cost tadalafil online buy phentermine pills without doctor herbal phentermine resources relenza market share gsk phentermine 37 5 order medication beyond prozac international premier pharmacy effects of paxil sildenafil coronary sertraline online buy soma t shirts interaction between xanax and prozac buy tadalafil pay with check online cod mg phentermine mg phentermine basics buy u s a tadalafil online effect prozac side generic prozac cheap 2737 amerimedrx flonase renova viarga phentermine 30 mg buy cod phentermine phentermine diet buy phentermine sildenafil tablet 100 picture phentermine 37,5 paxil morning alcohol night ritalin for weight loss line pharmacy propecia discount pharmacy paxil what is the pill soma 58 electric jolts prozac paxil to prozac sertraline weight loss negative affects of prozac fluoxetine prozac prozac weekly cheapest soma online no prescription generic fast overnight phentermine overnight delivery for phentermine phentermine 37.5mg $79 online prescription paroxetine sildenafil viagra and the heart effects of mixing risperdal with zoloft phentermine hcl 37 mg tablets ortho pharmaceuticals renova soma muscle relaxor buy soma carisoprodol paxil class action suite taking phentermine with antidepressants lowest price phentermine without perscription weight loss after prednisone side effects soma car finance offers pcp phentermine hcl bulk 100 powder cheap online prozac does prednisone cause hair loss sildenafil hemodynamics super 1 buy rohypnol without prescription cheap paroxetine buy online paxil and alcohol's effects wellbutrin clinical comparison to prozac soma pill information getting provigil without a prescription ionamin phentermine resin complex drug 3.37 30 mg phentermine toxic levels of prozac 160 mg of prozac eon lab liability phentermine product headaches and prozac nexium verses prilosec adipex loss phentermine weight acne from propecia drugs alcohol and steroids prednisone apnea phentermine ship uk who soma club san diego purchase prozac prednisone dosage canine arthritis diabetes tadalafil 30 mg phentermine hcl phentermine uk shipping online where to purchase phentermine online kamagra sildenafil site viagra order tadalafil 200 online car pcp finance prednisone for hair growth order paxil cr online synthroid and antidepressant metabolism prevacid brand pharmacy canadian hydrocodone licensed prescription meds prednisone india buying soma on-line low cost propecia diet no phentermine pill prescription prescription and propecia sertraline hcl generic zoloft wellbutrin xl and paxil phentermine no rx overnight pimozide and prozac 5 indian sildenafil phentermine and diet phentermine us pharmacy no prescription phentermine online cheap diet pills does prozac help you lose weight buy phentermine lowest price limited amount order tadalafil 50 online buy cod diet phentermine pill phentermine using mastercard soma muscle relaxer made by softtabs money order online justice seekers prozac pcp addiction treatment man s health phentermine diet pill paxil cr not for sale finance soma 99 free phentermine shipping drug abuse of pcp drug interactions for prozac fastest sildenafil delivery alcohol interaction prozac sildenafil gastroparesis remeron augmented with ssri prozac will prozac affect my pregnancy potatoes not prozac hardcover glenmullen prozac backlash overcoming phentermine ephedrine prednisone deltasone no prescription accepted cod phentermine 2004 relenza market share dropped soma online cheap free shipping adipex diet discount phentermine pill softtabs with no prescription online phentermine adipex overnight buying soma without a prescription accutane guild prempro legal drug allergy to generic ritalin depression caused by prozac order prilosec online from dreampharmaceuticals sertraline versus zoloft herbal phentermine 32 phentermine brand name fastin buy tadalafil 60 online longterm effect of prozac overdose social anxiety relief paxil hairloss baldness propecia adipex ionamin online phentermine qoclick forum for prozac users generic propecia finasteride viagra propecia picture pill soma phentermine overnight delivery us licensed pharmacies low price tadalafil online brain trauma and prozac tadalafil online $114 coupons for paxil cr priscription phentermine 37.5mg current information 1 buy mg propecia paxil cr and 2006 annual sales meridia sibutramine and xenical orlistat diet prescription phentermine diabetes diet prescription 5 citrato de sildenafil depression phentermine order tadalafil from usa online accepts cod phentermine kathy willits prozac serotonin prozac sertraline night sweats 6 finasteride proscar propecia order softtabs with check online tadalafil success rate for erectile dysfunction online pharmacy retin paxil for menopause crying 6hair loss baldness propecia buy cheap ritalin buy phentermine cheap phentermine can usage of prevacid cause hairloss soma compound overdose symptoms soma 350mg 150 pills generic tadalafil message board order tadalafil 270 online nursing process prozac phentermine online cheap phentermine buy phentermine order us softtabs online phentermine hcl prescription diet phentermine side effects trusted pharmacy catalog prednisone medication which cat ate prozac fluoxetine paroxetine clomipramine sildenafil every 3 hours soft tablet tadalafil hci sertraline zoloft phentermine prices synthroid night sweats calm prozac ssri drug names zoltan prozac nexium prilocec prevacid purchase tadalafil compare pravachol to lipitor cholestrol drugs sildenafil cream discount buy prilosec online order softtabs 50 online synthroid dye allergy cheap diet phentermine pill can you take tylenol and prozac order plavix 75 mg soma district san francisco galleries cod pay soma dysfunction erectile prozac paxil paroxetine dosage premature ejaculatoin tadalafil medication cod phentermine no rx needed weight loss with phentermine phentermine weight loss shiped buy cheap phentermine in mo paxil cr drug sildenafil vega sleep soma sildenafil intravenous 1.0mg ml depression help seroquel seroquel and zoloft interaction global pharmacy phentermine sideaffects of prozac buy carisoprodol soma sildenafil medlineplus info on prozac 150 soma without prescription trazadone increase prozac effect prednisone for cat no prescription hydroxycut prozac interactions find buy tadalafil cialis at ebay overmedication with prozac 30mg phentermine from canada seroquel and zoloft interactions chemical structure of prozac effects soma taking prozac and lexapro combination soma records 1137 sale price zenegra how sildenafil works zoloft instead of prozac 5 sildenafil in 24 hours tappering off paxil to zoloft phentermine blue 30 mg premarin and female hair loss phentermine average weight loss ivf premarin wilmington finance paxil where can i buy cheap phentermine hair loss phentermine elavil and prozac depression from prednisone pcp treatment centers in nj no effect from prozac xenical prevacid aldara nasacort aq