<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjoshi</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjoshi"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Mjoshi"/>
	<updated>2026-06-03T19:18:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81925</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81925"/>
		<updated>2013-10-31T01:55:25Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:sahana.jpg|right]]&lt;br /&gt;
This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description and Objective==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. The objective of the project is to export reports in the form of downloadable format, so that user can see view reports offline. Currently we focused on exporting reports to PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:userscreen.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:samplepdf.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:classDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on different operating systems:Linux,Windows,Mac. Sahana Eden is written in Javascript, Perl, HTML, Python. To run Eden then you will need to run Python. Sahana Eden requires web2py framework. Eden uses SQLite database. Sahana Eden can be easily deployed on Amazon EC2, Heroku. Pycharm IDE can be used for development.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, you can fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Exporting of reports is implemented using java script.&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently we are focusing on exporting reports to PDF. PdfExporter Class serves this purpose. It is a sub-class of Exporter Class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, &amp;lt;b&amp;gt;tableExporter&amp;lt;/b&amp;gt; is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here using below classes.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are making use of strategy pattern here. TableRenderer can be extended for XLS by writing (say) &amp;lt;i&amp;gt;XLSTableRenderer&amp;lt;/i&amp;gt; class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
The code makes use of following external java-script libraries to achieve the objective.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to take &amp;quot;screenshots&amp;quot; of webpages or parts of it opened on users' browser. The screenshot is created by parsing several DOM objects.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
Future development of the project can be implementation of following functionalities.&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting graph and pivot table(generated interactively by user) to a PDF. In future, graphs and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excels are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user can subscribe to receive reports daily/weekly/monthly through emails. The format of this report can be PDF or Excel.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81919</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81919"/>
		<updated>2013-10-31T01:54:26Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:sahana.jpg|right]]&lt;br /&gt;
This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description and Objective==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. The objective of the project is to export reports in the form of downloadable format, so that user can see view reports offline. Currently we focused on exporting reports to PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:userscreen.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:samplepdf.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:classDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on different operating systems:Linux,Windows,Mac. Sahana Eden is written in Javascript, Perl, HTML, Python. To run Eden then you will need to run Python. Sahana Eden requires web2py framework. Eden uses SQLite database. Sahana Eden can be easily deployed on Amazon EC2, Heroku. Pycharm IDE can be used for development.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, you can fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Exporting of reports is implemented using java script.&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently we are focusing on exporting reports to PDF. PdfExporter Class serves this purpose. It is a sub-class of Exporter Class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, &amp;lt;b&amp;gt;tableExporter&amp;lt;/b&amp;gt; is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here using below classes.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are making use of strategy pattern here. TableRenderer can be extended for XLS by writing (say) &amp;lt;i&amp;gt;XLSTableRenderer&amp;lt;/i&amp;gt; class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
The code makes use of following external java-script libraries to achieve the objective.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to take &amp;quot;screenshots&amp;quot; of webpages or parts of it opened on users' browser. The screenshot is created by parsing several DOM objects.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
Future development of the project can be implementation of following functionalities.&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting graph and pivot table(generated interactively by user) to a PDF. In future, graphs and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excels are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user can subscribe to receive reports daily/weekly/monthly through emails. The format of this report can be PDF or Excel.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81915</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81915"/>
		<updated>2013-10-31T01:53:34Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:sahana.jpg|right]]&lt;br /&gt;
This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description and Objective==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. The objective of the project is to export reports in the form of downloadable format, so that user can see view reports offline. Currently we focused on exporting reports to PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:userscreen.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:samplepdf.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:classDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on different operating systems:Linux,Windows,Mac. Sahana Eden is written in Javascript, Perl, HTML, Python. To run Eden then you will need to run Python. Sahana Eden requires web2py framework. Eden uses SQLite database. Sahana Eden can be easily deployed on Amazon EC2, Heroku. Pycharm IDE can be used for development.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, you can fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Exporting of reports is implemented using java script.&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently we are focusing on exporting reports to PDF. PdfExporter Class serves this purpose. It is a sub-class of Exporter Class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, &amp;lt;b&amp;gt;tableExporter&amp;lt;/b&amp;gt; is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are making use of strategy pattern here. TableRenderer can be extended for XLS by writing (say) &amp;lt;i&amp;gt;XLSTableRenderer&amp;lt;/i&amp;gt; class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
The code makes use of following external java-script libraries to achieve the objective.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to take &amp;quot;screenshots&amp;quot; of webpages or parts of it opened on users' browser. The screenshot is created by parsing several DOM objects.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
Future development of the project can be implementation of following functionalities.&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting graph and pivot table(generated interactively by user) to a PDF. In future, graphs and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excels are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user can subscribe to receive reports daily/weekly/monthly through emails. The format of this report can be PDF or Excel.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81892</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81892"/>
		<updated>2013-10-31T01:49:45Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Description and Objective */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:sahana.jpg|right]]&lt;br /&gt;
This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description and Objective==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. The objective of the project is to export reports in the form of downloadable format, so that user can see view reports offline. Currently we focused on exporting reports to PDF.&lt;br /&gt;
&lt;br /&gt;
[[File:userscreen.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:samplepdf.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
[[File:classDiagram.png]]&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on different operating systems:Linux,Windows,Mac. Sahana Eden is written in Javascript, Perl, HTML, Python. To run Eden then you will need to run Python. Sahana Eden requires web2py framework. Eden uses SQLite database. Sahana Eden can be easily deployed on Amazon EC2, Heroku. Pycharm IDE can be used for development.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, you can fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Exporting of reports is implemented using java script.&lt;br /&gt;
&lt;br /&gt;
The base class is Exporter, defined as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently we are focusing on exporting report to a PDF. PdfExporter Class serves this purpose. It is a sub-class of Exporter Class&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are reusing the code. TableRenderer can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
The code makes use of following external java-script libraries to achieve the objective.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to take &amp;quot;screenshots&amp;quot; of webpages or parts of it opened on users' browser. The screenshot is created by parsing several DOM objects.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
Future development of the project can be implementation of following functionalities.&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting graph and pivot table(generated interactively by user) to a PDF. In future, graphs and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excels are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user can subscribe to receive reports daily/weekly/monthly through emails. The format of this report can be PDF or Excel.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81673</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81673"/>
		<updated>2013-10-31T00:17:47Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description and Objective==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. The objective of the project is to export reports in the form of downloadable format, so that user can see view reports offline. Currently we focused on exporting report to a PDF.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on different operating systems:Linux,Windows,Mac. Sahana Eden is written in Javascript, Perl, HTML, Python. To run Eden then you will need to run Python. Sahana Eden requires web2py framework. Eden uses SQLite database. Sahana Eden can be easily deployed on Amazon EC2, Heroku. Pycharm IDE can be used for development.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, you can fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Exporting of reports is implemented using java script.&lt;br /&gt;
&lt;br /&gt;
The base class is Exporter, defined as:&lt;br /&gt;
&lt;br /&gt;
[[File:classDiagram.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently we are focusing on exporting report to a PDF. PdfExporter Class serves this purpose. It is a sub-class of Exporter Class&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are reusing the code. TableRenderer can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
The code makes use of following external java-script libraries to achieve the objective.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to take &amp;quot;screenshots&amp;quot; of webpages or parts of it opened on users' browser. The screenshot is created by parsing several DOM objects.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
Future development of the project can be implementation of following functionalities.&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting graph and pivot table(generated interactively by user) to a PDF. In future, graphs and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excels are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user can subscribe to receive reports daily/weekly/monthly through emails. The format of this report can be PDF or Excel.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81562</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=81562"/>
		<updated>2013-10-30T23:24:09Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* bytesscoutpdf.js */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project is developed as a contribution to Sahana Software Foundation (Eden).&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana Software Foundation was originally developed by members of the Sri Lankan IT community who wanted to apply their talent and help their country  to recover from the aftermath of 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national language of Sri Lanka. Sahana community has since grown to include experts from emergency and disaster management as partners in software development process. This is one of the unique strength of Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of &amp;quot;The Lanka Software Foundation (LSF)&amp;quot;, Sahana Software grew into a free and open source software project. Hundreds of volunteers, contribute and support both local and national relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 as a non-profit organization, registered in the State of California to serve diverse group of customers. SSF partners together with disaster and technologies experts address following questions:&lt;br /&gt;
&lt;br /&gt;
How can an urgent requirement be effectively communicated to international donor community?&lt;br /&gt;
&lt;br /&gt;
How can responsible authorities find hospitals that can accommodate more patients?&lt;br /&gt;
&lt;br /&gt;
How can family members be reunited who were separated during evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For the data to be useful and share-able, it needs to be presented in a way that can help users to make decisions and plan activities. To achieve this Sahana Eden produce reports that are flexible and user friendly.&lt;br /&gt;
&lt;br /&gt;
Reports can be in the form of: Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
We have implemented the code using external java-script libraries.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytescoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to a PDF. In future, the grahps and pivot table can be exported to an excel(.xls). Exporting to an excel will require significant amount of effort as excel are interactive. User should be able to manipulate the generated excel document.(Not required in the case of PDF as they are static).&lt;br /&gt;
XLS would ideally include raw Data on one or more sheets, the Pivot table on another sheet &amp;amp; Graphs on one or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80796</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80796"/>
		<updated>2013-10-30T16:47:40Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project is developed as a contribution to Sahana foundation (Eden).&lt;br /&gt;
[[File:Screenshot.png]]&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80789</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80789"/>
		<updated>2013-10-30T16:44:32Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80788</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80788"/>
		<updated>2013-10-30T16:44:22Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Further Reading */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80787</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80787"/>
		<updated>2013-10-30T16:44:14Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3.  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4.  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80786</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80786"/>
		<updated>2013-10-30T16:44:04Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
:1. [https://github.com/flavour/eden Git repository]&lt;br /&gt;
:2. [http://demo.eden.sahanafoundation.org/eden/ Sahana Eden Demo]&lt;br /&gt;
:3  [http://bytescout.com/ Bytescout]&lt;br /&gt;
:4  [http://html2canvas.hertzen.com/ Html2Canvas]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80781</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80781"/>
		<updated>2013-10-30T16:41:51Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Terminology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80780</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80780"/>
		<updated>2013-10-30T16:41:39Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Motivation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80779</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80779"/>
		<updated>2013-10-30T16:41:21Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Setup (Installation) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80778</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80778"/>
		<updated>2013-10-30T16:41:05Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Setup (Installation) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from below URL:&lt;br /&gt;
https://github.com/flavour/eden&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80777</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80777"/>
		<updated>2013-10-30T16:40:53Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Setup (Installation) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
To contribute to Eden foundation, fork repository from below URL:&lt;br /&gt;
&amp;lt;a href=&amp;quot;https://github.com/flavour/eden&amp;quot;&amp;gt;https://github.com/flavour/eden&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80776</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80776"/>
		<updated>2013-10-30T16:40:13Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80772</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80772"/>
		<updated>2013-10-30T16:37:27Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Dependency */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80771</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80771"/>
		<updated>2013-10-30T16:37:15Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Dependency */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 During implementation of this project we used external java-script library.&lt;br /&gt;
&lt;br /&gt;
===html2canvas.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this file is to having ability to take &amp;quot;screenshots&amp;quot; of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM.&lt;br /&gt;
&lt;br /&gt;
===bytesscoutpdf.js===&lt;br /&gt;
&lt;br /&gt;
The purpose of this client-side Javascript library to generate PDF with text, images and graphics.It Works with mainstream desktop and mobile browsers, iPhone and iPad.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80765</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80765"/>
		<updated>2013-10-30T16:29:13Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
The base class Exporter is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function Exporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
    this.tableExporter = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setExporter = function(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.setTableExporter = function(exporter)&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter = exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Exporter.prototype.renderTable = function()&lt;br /&gt;
{&lt;br /&gt;
    this.tableExporter.render();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since we have implemented the Pdf functionality, a PdfExporter is defined for this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
function PdfExporter(exp)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype = new Exporter();&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    return this.exporter;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.export = function(imageObj, json)&lt;br /&gt;
{&lt;br /&gt;
    this.exportImage(imageObj);&lt;br /&gt;
    this.exportPivotTable(json);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportImage = function(imageObj)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    // load image from canvas into BytescoutPDF&lt;br /&gt;
&lt;br /&gt;
    this.exporter.imageLoadFromUrl(imageObj);&lt;br /&gt;
&lt;br /&gt;
    // place this mage at given coordinates and dimesionson on the page&lt;br /&gt;
    this.exporter.imagePlaceSetSize(50, 50, 0, 750, 500);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfExporter.prototype.exportPivotTable = function(json)&lt;br /&gt;
{&lt;br /&gt;
    this.exporter.pageAdd();&lt;br /&gt;
&lt;br /&gt;
    if(this.tableExporter == null || this.tableExporter == undefined)&lt;br /&gt;
    {&lt;br /&gt;
        this.setTableExporter(new PdfTableRenderer(json, this.exporter));&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    this.renderTable();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, Table exporter is written only for table creation in Pdf. This can even be used for table creation in XLS or RSS or so. Thus, we use strategy pattern here.&lt;br /&gt;
&lt;br /&gt;
Table renderer is defined as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function TableRenderer()&lt;br /&gt;
{&lt;br /&gt;
    this.X = 50;&lt;br /&gt;
    this.Y = 50;&lt;br /&gt;
    this.PageWidth = 750;&lt;br /&gt;
    this.PageHeight = 500;&lt;br /&gt;
    this.numcols = 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.constructor = function(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
TableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
    // this method is abstract and does nothing&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Pdf table renderer having functionality of exporting table to Pdf, is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfTableRenderer(json_data, exp)&lt;br /&gt;
{&lt;br /&gt;
    this.json = json_data;&lt;br /&gt;
    this.exporter = exp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype = new TableRenderer();&lt;br /&gt;
&lt;br /&gt;
PdfTableRenderer.prototype.render = function()&lt;br /&gt;
{&lt;br /&gt;
  // render code here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By setting TableRenderer in Exporter class to an instance of PdfTableRenderer, we are achieving code reuse. This can be extended for XLS by writing XLSTableRenderer class which inherits from TableRenderer and overrides the &amp;lt;b&amp;gt;render()&amp;lt;/b&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
At last, the final Pdf object which needs to be downloaded, is generated by &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt;. Here we have used Factory pattern to achieve the same. &amp;lt;i&amp;gt;getPdf()&amp;lt;/i&amp;gt; method of &amp;lt;i&amp;gt;PdfFactory&amp;lt;/i&amp;gt; hides all the implementation details from outside of the library.&lt;br /&gt;
&lt;br /&gt;
PdfFactory is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function PdfFactory()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
PdfFactory.getPdf = function()&lt;br /&gt;
{&lt;br /&gt;
    //... code to extract canvas image&lt;br /&gt;
&lt;br /&gt;
    var pe = new PdfExporter(pdf);&lt;br /&gt;
&lt;br /&gt;
    pe.export(dataURL, json_data);&lt;br /&gt;
&lt;br /&gt;
    return pe.getPdf(); // gets final pdf object&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80760</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80760"/>
		<updated>2013-10-30T16:12:34Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Dependency==&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80271</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80271"/>
		<updated>2013-10-29T14:11:25Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
==Problem with Aspect Oriented Programming==&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80270</id>
		<title>CSC/ECE 517 Fall 2013/oss fmv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/oss_fmv&amp;diff=80270"/>
		<updated>2013-10-29T14:11:00Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==[Under Construction]==&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
Sahana software was originally developed by members of the Sri Lankan IT community who wanted to find a way to apply their talents towards n helping their country recover in the immediate aftermath of the 2004 Indian Ocean earthquake and tsunami. The word “Sahana” means “relief” in Sinhalese, one of the national languages of Sri Lanka. Sahana community has since grown to include experts in emergency and disaster management as full partners in the software development process. This is extremely unique in the governance of software projects, and a unique strength of the Sahana Software Foundation.&lt;br /&gt;
&lt;br /&gt;
Under the stewardship of The Lanka Software Foundation (LSF) Sahana software grew into a global free and open source software project supported by hundreds of volunteer contributors from dozens of countries and it supported national and local authorities and relief agencies in their response to numerous large-scale, sudden-onset disasters. The Sahana Software Foundation was established in 2009 by an initial board of directors as a non-profit organization registered in the State of California to serve the needs and requirements of a diverse group of customers. SSF partners with disaster and technologies experts, technology, professional services and disaster response organizations and to better address information needs and the following questions:&lt;br /&gt;
&lt;br /&gt;
How can conditions and urgent requirement be effectively communicated to the international donor community?&lt;br /&gt;
How can responsible authorities understand where hospitals that can accommodate additional patients are located?&lt;br /&gt;
How  can family members remaining in villages be reunited with their parents, spouses, and children separated by evacuation?&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Sahana Eden can be used to collect and manage a large variety of data. For this data to add value it needs to be processed and shared in a way in which it can present the information people need to make decisions and plan activities. To achieve this Sahana Eden should be able to produce reports which analyse and visualize data in a flexible, user friendly and configurable way.&lt;br /&gt;
The types of the report can be Pivot Table, Bar Chart, or Pie chart. Our work includes the exporting the generated report to user's computer so that user can see the generated report offline. Currently we focused on exporting report to PDF document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
===Cross Cutting Concerns===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
==Problem with Aspect Oriented Programming==&lt;br /&gt;
&lt;br /&gt;
==Setup (Installation)==&lt;br /&gt;
&lt;br /&gt;
Sahana Eden can be installed on several different operating systems:Linux,Windows,Mac. The installation of Sahana eden requires web2py framework. Sahana Eden can be easily deployed on Amazon EC2, Heroku.&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&lt;br /&gt;
===Moving toward a better way to build software===&lt;br /&gt;
&lt;br /&gt;
==Future==&lt;br /&gt;
&lt;br /&gt;
===Export to Excel File===&lt;br /&gt;
&lt;br /&gt;
Currently our work is restricted to exporting the graph and pivot table-generated interactively by user to the PDF version of it. In future newer implementation can include exporting the pivot table and graph to the excel(.xls) version. This implementation may requires significant efforts as excel documents are interactive. So a user should able to manipulate the generated excel document.(Not required in the case PDF document as they are static documents).&lt;br /&gt;
XLS would ideally include the raw Data on 1 or more sheets, the Pivot table on another sheet &amp;amp; Graphs on 1 or more additional sheets. The Pivot Table &amp;amp; Graphs should be linked to the raw data using XLS functionality.&lt;br /&gt;
&lt;br /&gt;
===Subscription===&lt;br /&gt;
&lt;br /&gt;
A user would like to subscribe to a report to receive by email daily/weekly/monthly. The format of this report can be PDF or Excel document.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further Reading==&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79956</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79956"/>
		<updated>2013-10-08T01:08:46Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. &lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has been promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Consider a simple class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a String holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Line 3 in above code implies that there is an equals method defined for class Money. Else it will call Object's equals method. To make above code work, we need to write the equals method in Money as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. [http://en.wikipedia.org/wiki/Kent_Beck Beck]’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79955</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79955"/>
		<updated>2013-10-08T01:07:47Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Characteristics of Good Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. &lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has been promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Consider a simple class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a String holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Line 3 in above code implies that there is an equals method defined for class Money. Else it will call Object's equals method. To make above code work, we need to write the equals method in Money as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. [http://en.wikipedia.org/wiki/Kent_Beck Beck]’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79953</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79953"/>
		<updated>2013-10-08T01:05:56Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Test Driven Development using JUnit (Example) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. &lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has been promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Consider a simple class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a String holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Line 3 in above code implies that there is an equals method defined for class Money. Else it will call Object's equals method. To make above code work, we need to write the equals method in Money as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79950</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79950"/>
		<updated>2013-10-08T00:59:57Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Why to use TDD? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. &lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has been promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79949</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79949"/>
		<updated>2013-10-08T00:59:09Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. &lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79793</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79793"/>
		<updated>2013-10-07T13:12:01Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Why to use TDD? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that has promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79792</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79792"/>
		<updated>2013-10-07T11:36:46Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf KentBack Test Driven Development by Example]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm Test Driven Development in JUnit]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html TDD Agile Data Method]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79791</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79791"/>
		<updated>2013-10-07T11:34:52Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
* Test Driven Development by Exmaple http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf&lt;br /&gt;
* Test-Driven Database Development: Unlocking Agility (Net Objectives Lean-Agile Series) http://www.amazon.com/exec/obidos/ASIN/032178412X/ambysoftinc&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Test-driven_development]&lt;br /&gt;
*[http://junit.sourceforge.net/doc/testinfected/testing.htm]&lt;br /&gt;
*[http://www.agiledata.org/essays/tdd.html]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79790</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79790"/>
		<updated>2013-10-07T11:30:30Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Test Driven Development using JUnit (Example)''' ==&lt;br /&gt;
Let's start simple and define a class Money to represent a value in a single currency. We represent the amount by a simple int. To get full accuracy you would probably use double or java.math.BigDecimal to store arbitrary-precision signed decimal numbers. We represent a currency as a string holding the ISO three letter abbreviation (USD, CHF, etc.). In more complex implementations, currency might deserve its own object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Money {&lt;br /&gt;
    private int fAmount;&lt;br /&gt;
    private String fCurrency;&lt;br /&gt;
    public Money(int amount, String currency) {&lt;br /&gt;
        fAmount= amount;&lt;br /&gt;
        fCurrency= currency;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public int amount() {&lt;br /&gt;
        return fAmount;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public String currency() {&lt;br /&gt;
        return fCurrency;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
JUnit defines how to structure your test cases and provides the tools to run them. You implement a test in a subclass of TestCase. To test our Money implementation we therefore define MoneyTest as a subclass of TestCase. In Java, classes are contained in packages and we have to decide where to put MoneyTest. Our current practice is to put MoneyTest in the same package as the classes under test. In this way a test case has access to the package private methods. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class MoneyTest extends TestCase {&lt;br /&gt;
    //…&lt;br /&gt;
    public void testSimpleAdd() {&lt;br /&gt;
        Money m12CHF= new Money(12, &amp;quot;CHF&amp;quot;);  // (1)&lt;br /&gt;
        Money m14CHF= new Money(14, &amp;quot;CHF&amp;quot;);        &lt;br /&gt;
        Money expected= new Money(26, &amp;quot;CHF&amp;quot;);&lt;br /&gt;
        Money result= m12CHF.add(m14CHF);    // (2)&lt;br /&gt;
        Assert.assertTrue(expected.equals(result));     // (3)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next let's write the equals method in Money:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public boolean equals(Object anObject) {&lt;br /&gt;
    if (anObject instanceof Money) {&lt;br /&gt;
        Money aMoney= (Money)anObject;&lt;br /&gt;
        return aMoney.currency().equals(currency())&lt;br /&gt;
            &amp;amp;&amp;amp; amount() == aMoney.amount();&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Since equals can receive any kind of object as its argument we first have to check its type before we cast it as a Money. As an aside, it is a recommended practice to also override the method hashCode whenever you override method equals.&lt;br /&gt;
&lt;br /&gt;
In the static way you override the runTest method inherited from TestCase and call the desired test case. A convenient way to do this is with an anonymous inner class. Note that each test must be given a name, so you can identify it if it fails.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TestCase test= new MoneyTest(&amp;quot;simple add&amp;quot;) {&lt;br /&gt;
    public void runTest() {&lt;br /&gt;
        testSimpleAdd();&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79789</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79789"/>
		<updated>2013-10-07T11:22:18Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications.&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79788</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79788"/>
		<updated>2013-10-07T11:22:07Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Traditional Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79787</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79787"/>
		<updated>2013-10-07T11:21:37Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.   &lt;br /&gt;
&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79786</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79786"/>
		<updated>2013-10-07T11:20:39Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Why to use TDD?'''==&lt;br /&gt;
A significant advantage of TDD is that it enables you to take small steps when writing software.  This is a practice that I have promoted for years because it is far more productive than attempting to code in large steps.  For example, assume you add some new functional code, compile, and test it.  Chances are pretty good that your tests will be broken by defects that exist in the new code.  It is much easier to find, and then fix, those defects if you've written two new lines of code than two thousand. The implication is that the faster your compiler and regression test suite, the more attractive it is to proceed in smaller and smaller steps. &lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.   &lt;br /&gt;
&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79785</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79785"/>
		<updated>2013-10-07T11:19:10Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.   &lt;br /&gt;
&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;br /&gt;
&lt;br /&gt;
=== TDD vs. AMDD ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.&lt;br /&gt;
&amp;lt;li&amp;gt;TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).&lt;br /&gt;
&amp;lt;li&amp;gt; TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.&lt;br /&gt;
&amp;lt;li&amp;gt; TDD is non-visually oriented whereas AMDD is visually oriented.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques are new to traditional developers and therefore may be threatening to them.&lt;br /&gt;
&amp;lt;li&amp;gt; Both techniques support evolutionary development.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79784</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79784"/>
		<updated>2013-10-07T11:17:30Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.   &lt;br /&gt;
&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;br /&gt;
&lt;br /&gt;
;Agile Model Driven Development (AMDD) Lifecycle&lt;br /&gt;
[[File:amdd.gif]]&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Amdd.gif&amp;diff=79783</id>
		<title>File:Amdd.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Amdd.gif&amp;diff=79783"/>
		<updated>2013-10-07T11:16:47Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79782</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79782"/>
		<updated>2013-10-07T11:16:33Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;br /&gt;
&lt;br /&gt;
== '''Traditional Testing''' ==&lt;br /&gt;
TDD is primarily a specification technique with a side effect of ensuring that your source code is thoroughly tested at a confirmatory level.   However, there is more to testing than this.  Particularly at scale you'll still need to consider other agile testing techniques such as pre-production integration testing and investigative testing.  Much of this testing can also be done early in your project if you choose to do so (and you should). &lt;br /&gt;
With traditional testing a successful test finds one or more defects.  It is the same with TDD; when a test fails you have made progress because you now know that you need to resolve the problem.  More importantly, you have a clear measure of success when the test no longer fails. TDD increases your confidence that your system actually meets the requirements defined for it, that your system actually works and therefore you can proceed with confidence. &lt;br /&gt;
As with traditional testing, the greater the risk profile of the system the more thorough your tests need to be. With both traditional testing and TDD you aren't striving for perfection, instead you are testing to the importance of the system.  To paraphrase Agile Modeling (AM), you should &amp;quot;test with a purpose&amp;quot; and know why you are testing something and to what level it needs to be tested.  An interesting side effect of TDD is that you achieve 100% coverage test – every single line of code is tested – something that traditional testing doesn’t guarantee (although it does recommend it).  In general I think it’s fairly safe to say that although TDD is a specification technique, a valuable side effect is that it results in significantly better code testing than do traditional techniques.   &lt;br /&gt;
&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Documentation''' ==&lt;br /&gt;
Like it or not most programmers don’t read the written documentation for a system, instead they prefer to work with the code.  And there’s nothing wrong with this.  When trying to understand a class or operation most programmers will first look for sample code that already invokes it.  Well-written unit tests do exactly this – the provide a working specification of your functional code – and as a result unit tests effectively become a significant portion of your technical documentation. The implication is that the expectations of the pro-documentation crowd need to reflect this reality.  Similarly, acceptance tests can form an important part of your requirements documentation.  This makes a lot of sense when you stop and think about it.  Your acceptance tests define exactly what your stakeholders expect of your system, therefore they specify your critical requirements.  Your regression test suite, particularly with a test-first approach, effectively becomes detailed executable specifications. &lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Scaling TDD via Agile Model-Driven Development (AMDD)''' ==&lt;br /&gt;
TDD is very good at detailed specification and validation, but not so good at thinking through bigger issues such as the overall design, how people will use the system, or the UI design (for example).  Modeling, or more to the point agile model-driven development (AMDD) (the lifecycle for which is captured in Figure 4) is better suited for this.  AMDD addresses the agile scaling issues that TDD does not.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79781</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79781"/>
		<updated>2013-10-07T11:12:44Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Levels of Test Driven Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
;Testing using xUnit can be done as shown below:&lt;br /&gt;
[[File:tdd_xunit.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Tdd_xunit.jpg&amp;diff=79780</id>
		<title>File:Tdd xunit.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Tdd_xunit.jpg&amp;diff=79780"/>
		<updated>2013-10-07T11:11:50Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79779</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79779"/>
		<updated>2013-10-07T11:10:53Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Levels of Test Driven Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Atdd_dtdd.jpg&amp;diff=79778</id>
		<title>File:Atdd dtdd.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Atdd_dtdd.jpg&amp;diff=79778"/>
		<updated>2013-10-07T11:10:29Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: uploaded a new version of &amp;amp;quot;File:Atdd dtdd.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79777</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79777"/>
		<updated>2013-10-07T11:08:54Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Levels of Test Driven Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
[[File:atdd_dtdd.jpg|right]]&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Atdd_dtdd.jpg&amp;diff=79776</id>
		<title>File:Atdd dtdd.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Atdd_dtdd.jpg&amp;diff=79776"/>
		<updated>2013-10-07T11:05:14Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79775</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79775"/>
		<updated>2013-10-07T11:03:14Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Levels of Test Driven Development''' ==&lt;br /&gt;
There are two levels of TDD:&lt;br /&gt;
;Acceptance TDD (ATDD):  With ATDD developers write a single acceptance test, or behavioral specification depending on preferred terminology, and then just enough production functionality/code to fulfill that test.  The goal of ATDD is to specify detailed, executable requirements for the solution be on a just in time (JIT) basis. ATDD is also called Behavior Driven Development (BDD).&lt;br /&gt;
;Developer TDD: With developer TDD a single developer test is written, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.  The goal of developer TDD is to specify a detailed, executable design for the solution be on a JIT basis.  Developer TDD is often simply called TDD.&lt;br /&gt;
- See more at: http://www.agiledata.org/essays/tdd.html#sthash.11uJfvXR.dpuf&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79774</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79774"/>
		<updated>2013-10-07T10:59:32Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: /* Steps performed in TDD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79773</id>
		<title>CSC/ECE 517 Fall 2013/ch1 1w31 vm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2013/ch1_1w31_vm&amp;diff=79773"/>
		<updated>2013-10-07T10:59:02Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Test Driven Development (Under Construction)''' ==&lt;br /&gt;
'''Test-driven development''' (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.&lt;br /&gt;
Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999, but more recently has created more general interest in its own right.&lt;br /&gt;
Programmers also apply the concept to improving and debugging legacy code developed with older techniques.&lt;br /&gt;
&lt;br /&gt;
== '''Rules of Thumb'''==&lt;br /&gt;
&amp;lt;li&amp;gt;Don’t write a line of new code unless you first have a failing automated test&lt;br /&gt;
&amp;lt;li&amp;gt;Eliminate duplication.&lt;br /&gt;
&lt;br /&gt;
These rules generate complex individual and group behavior. Some of the technical implications are:&lt;br /&gt;
&lt;br /&gt;
; Design with organization&lt;br /&gt;
TDD recommends that programmers should write their code such that it provides feedback between decisions. It should exhibit a control hierarchy which is easy to manage and understand.&lt;br /&gt;
&lt;br /&gt;
; Write your own tests&lt;br /&gt;
This states that developers should write their own tests, since it is not advisable to wait for someone else to write a test every time. In a software environment, developers usually used to rely on testers to find bugs. However, this design says otherwise. It implies that developers know their code inside out and hence should write their own test cases.&lt;br /&gt;
&lt;br /&gt;
; Rapid Response&lt;br /&gt;
Your development environment must provide rapid response to small changes. Business requirments are generally fickle and they can change at any point of time. Hence, it is receommended that developers write code such that it can adapt to changes made in future.&lt;br /&gt;
&lt;br /&gt;
; High Cohesion&lt;br /&gt;
In computer programming, cohesion refers to the degree to which the elements of a module belong together. Thus, it is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is. The design must consist of many highly cohesive, loosely coupled components, just to make testing easy.&lt;br /&gt;
&lt;br /&gt;
== '''Steps performed in TDD'''==&lt;br /&gt;
[[File:tdd_flow.jpg|right]]]]&lt;br /&gt;
The following sequence is based on the book Test-Driven Development by Example.[http://www.eecs.yorku.ca/course_archive/2003-04/W/3311/sectionM/case_studies/money/KentBeck_TDD_byexample.pdf]&lt;br /&gt;
=== Quickly add a test ===&lt;br /&gt;
In test-driven development, each new feature begins with writing a test. This test must inevitably fail because it is written before the feature has been implemented. (If it does not fail, then either the proposed &amp;quot;new&amp;quot; feature already exists or the test is defective.) To write a test, the developer must clearly understand the feature's specification and requirements. The developer can accomplish this through use cases and user stories to cover the requirements and exception conditions, and can write the test in whatever testing framework is appropriate to the software environment. This could also be a modification of an existing test. This is a differentiating feature of test-driven development versus writing unit tests after the code is written: it makes the developer focus on the requirements before writing the code, a subtle but important difference.&lt;br /&gt;
=== Run all tests and see the new one fail ===&lt;br /&gt;
This validates that the test harness is working correctly and that the new test does not mistakenly pass without requiring any new code. This step also tests the test itself, in the negative: it rules out the possibility that the new test always passes, and therefore is worthless. The new test should also fail for the expected reason. This increases confidence (though does not guarantee) that it is testing the right thing, and passes only in intended cases.&lt;br /&gt;
=== Make a little change ===&lt;br /&gt;
The next step is to write some code that causes the test to pass. The new code written at this stage is not perfect, and may, for example, pass the test in an inelegant way. That is acceptable because later steps improve and hone it.&lt;br /&gt;
At this point, the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and 'allowed for' at any stage.&lt;br /&gt;
=== Run all tests and see them all succeed ===&lt;br /&gt;
If all test cases now pass, the programmer can be confident that the code meets all the tested requirements. This is a good point from which to begin the final step of the cycle.&lt;br /&gt;
=== Refactor to remove duplication ===&lt;br /&gt;
Now the code should be cleaned up as necessary. Move code from where it was convenient for passing the test to where it logically belongs. Remove any duplication you can find. Make sure that variable and method names represent their current use. Clarify any constructs that might be misinterpreted. Use Kent Beck's four rules of simple design[5][6] to guide you, as well as anything else you know about writing clean code. By re-running the test cases, the developer can be confident that code refactoring is not damaging any existing functionality.&lt;br /&gt;
The concept of removing duplication is an important aspect of any software design. In this case, however, it also applies to removing any duplication between the test code and the production code—for example magic numbers or strings repeated in both to make the test pass in step 3.&lt;br /&gt;
&lt;br /&gt;
== '''Characteristics of Good Tests'''==&lt;br /&gt;
For developers, the implication is that they need to learn how to write effective unit tests. Beck’s experience is that good unit tests:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run fast (they have short setups, run times, and break downs).&lt;br /&gt;
&amp;lt;li&amp;gt;Run in isolation (you should be able to reorder them).&lt;br /&gt;
&amp;lt;li&amp;gt;Use data that makes them easy to read and to understand.&lt;br /&gt;
&amp;lt;li&amp;gt;Use real data (e.g. copies of production data) when they need to.&lt;br /&gt;
&amp;lt;li&amp;gt;Represent one step towards your overall goal.&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Tdd_flow.jpg&amp;diff=79772</id>
		<title>File:Tdd flow.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Tdd_flow.jpg&amp;diff=79772"/>
		<updated>2013-10-07T10:56:09Z</updated>

		<summary type="html">&lt;p&gt;Mjoshi: Test Driven Development Flow&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test Driven Development Flow&lt;/div&gt;</summary>
		<author><name>Mjoshi</name></author>
	</entry>
</feed>