I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Thursday 29 April 2010

Javascript Performance Talk

I watched the javascript performance talk from Nicholas C. Zakas at Google Tech Talks: Nicholas C. Zakas: Speed Up Your JavaScript.

  • Scope Management
  • Loop optimization
  • About HTMLCollection Live objects
  • Document Fragments - postponing reflow

Scope Management

The tip given to improve efficiency is to use local variables, because variables which are in the local scope are accessed first. Every time a global or a variable from a prototype or a dot object variable is accessed twice. Use a local variable.

Another issue related to the scope aspect is that using functions and closures comes with a certain cost.

Loops Optimization

Loops can be optimized in different ways, when avoiding unnecessary work.

About HTMLCollection Live objects

The presentation explains that the collection returned by methods such as: .getElementsByTagName, ... return HTMLCollection objects which remain 'live', that is they get updated. A typical example is the following loop:

var divs = document.getElementsByTagName('div');

for (var i = 0; i< divs.length; i++){
var div = document.createElement('div');
document.body.append(div);
}
The collection in divs is an HTMLCollection. The body of the loops goes over the loops and adds a div for every object in the collection. But since new objects are added to the loop every time one goes through the loops, the loops never ends !!!!!

DocumentFragment - postponing reflow

Reflow occurs when the the size of the elements on the page are recalculated. To improve performance it is useful to minimize the number of reflows.

In general, Nicholas C. Zakas explained that reflow happens at five particular moments in browsers:

  • Page load
  • browser window resize
  • adding and removing elements
  • setting style attribute of elements
  • (sometimes) accessing the style elements of the nodes

To prevent useless reflows, one can use a document fragment in order to create a quite complete element as a document fragment and then add it to the DOM. In this way, reflow is only performed when the element is added to the page.

To minimize the access to the style attributes of elements, a better way to perform that is to change the class of the element, i.e: use .className instead of .style.

Wednesday 28 April 2010

Behavior Driven Development (aka. BDD) using EasyB

One more term for "test driven development", behaviour driven development. The idea behind the change in term is to highlight, that the principle underlying behind this style of development is more a design methodology as a test methodology.

To illustrate the purpose, and methodology, I will present it here using easyb.

The main idea is to write the specification as text, and then to replace the text using groovy code. Easyb provides two types of tests: specifications and stories.

I first describe the specification by giving an example.

before "initialize the queue for each spec", {
  queue = new Queue()
}

it "should dequeue gives item just enqueued", {
  queue.enqueue(2)
  queue.dequeue().shouldBe(2)
}
it "should throw an exception when null is enqueued", {
  ensureThrows(RuntimeException){
   queue.enqueue(null)
  }
}

easyb uses a number of keywords and methods. First of all, the keyword before for the code to be used when setting the test environment at the beginning. In this case a queue is created. The next important keyword is "it" at the beginning of certain lines. It indicates that this is a specification. It is followed by a text describing the specification. Finally, after the description some groovy code is included between "{" and "}".

Different methods belong to the easyb specification language: "shouldBe" and "ensureThrows". The first one checks that the result of the emthod to which it is applied returns a given value, whereas the second one verifyies that an exception as been thrown.

Maven Configuration

As usual, I find very useful to have a template of what I need in a maven pom to use somekind of framework. I haven't tested that yet. I still find that useful:

<project>
  ...
  <repositories>
   <repository>
     <id>easyb</id>
     <url>http://www.easyb.org/maven2/</url>
    </repository>
   </repositories>
   <pluginRepositories>
    <pluginRepository>
     <id>easyb</id>
     <url>http://www.easyb.org/maven2/</url>
    </pluginRepository>
   </pluginRepositories>
   ...
  </project>

Easyb clone for javascript

I also found the following code to perform bdd in javascript: JavaScript BDD framework in less than 200 lines.

Tuesday 27 April 2010

A site for Javascript library

As I was looking for a Java based implementation of javascript. I fell upon the following site: http://javascriptlibraries.com/ which will probably be useful.

Learning Python 3.0

I am learning python 3.0. There are a few reasons for this. For instance, there is a suggestion from the 'Pragmatic Programmer' book I bought lately. This other thing is that it would make it easier to cooperate with my brother and to perform more useful stuff for and with him. I am also using Mark Lutz: Learning Python (Fourth Edition from Oreilly).

So I installed pyhton 3.0 on my machine.

$> ./configure
$> su
$> make altinstall
And here it is:
$ /usr/local/bin/python3.0
Python 3.0 (r30:67503, Apr 27 2010, 01:32:05)
[GCC 4.4.3 20100127 (Red Hat 4.4.3-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

I will probably need to make a few tests that everything works.

Friday 23 April 2010

Mockito - basics

This entry gives simple methods on how to use mockito.

Maven configuration

To add mockito-core to your configuration, update your dependencies with:

<!-- needs extra dependencies: objenesis & hamcrest -->
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.1</version>

In order to add the complete mockito framework, i.e. mockito-all, update your dependencies with

<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.1</version>

Of course if the mock code is only found in unit tests, then you might want to add:

<scope>test<scope>
to your pom.xml

Use of Mocks to verify interaction (Spying)

The following example is adapted from the mockito documentation

// the staic import allows the direct use of the help methods: mock and verify
import static org.mockito.Mockito.*;

// create a mock of a map
List mockedMap = mock(Map.class);

//using mock object
mockedMap.put("key", "value");
mockedMap.clear();
//verification
verify(mockedMap).put("key","value");
verify(mockedMap).clear();

Stubbing - Or Have your objects mock others

While the previous section was used to verify that some operation did occur on a specific object. In some cases, you may not wish to initialize completely a complex object. In such a case, you can use mockito to perform stubbing, i.e. mockito provides an interface, so that the object returns a specific value, when a call to a method is performed.

For instance, it is possible to use the mocking framework to return a given result for certain parameters:

when(mockedMap.get("key")).thenReturn("first");
when(mockedList.get(5)).thenThrow(new RuntimeException());

Content delivery network

Content delivery network are a cool thing though I am not sure how secure is such an approach. I will have to take a closer look.

In particular in the case of using dojo, a few issues have to be taken into account.

Interesting seems that google provides an api for asynchonuous loading.

Browser based javascript library loading

Wouldn't it be interesting to have browser taking care of the javascript frameworks library loading such as dojo, ext, ... in the version corresponding to some specification in the HTML file.

Dojo Toolkit - Basics

This is a high level overview of the dojo toolkit.

  • Function called on load
  • package framework
  • a DOM element retrieval mechanism
  • a number of Widgets
  • Helper Methods
  • Dojo Array Methods
  • dojo.connect - Event mechanism
  • Parsing, formatting and validation of numbers and dates
  • Ajax request tools
  • An history and bookmarking mechanism
  • Event System tools
  • Animation tools
  • I18n tools (Internationalization)

Loading the dojo code

The code of dojo can be loaded from http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js. I would like to try loading it from the web server.

Function called on load

As for other web frameworks, you can have different function called on load:

dojo.addOnLoad(funtion( // code to perform on load ));

package framework

The dojo toolkit provides a package mechanism, the code is used in the following way:

dojo.require('dojo.fx');
loads the dojo.fx package.

a DOM element retrieval mechanism

Dojo provides a number of methods to retrieve elements of the DOM document. For instance, dojo.byId('myId'); retrieves the element with the id 'myId' just as document.getElementById would.

Just as other frameworks dojo provides also a query mechanism.

From the dojo documentation:

// all <h3> elements
dojo.query('h3')
// all <h3> elements which are first-child of their parent node
dojo.query('h3:first-child')
// a node with id="main"
dojo.query('#main')
// all <h3> elements within a node with id="main"
dojo.query('#main h3')
// a <div> with an id="main"
dojo.query('div#main')
// all <h3> elements within a div with id="main"
dojo.query('div#main h3')
// all <h3> elements that are immediate children of a <div>, within node with id="main"
dojo.query('#main div > h3')
// all nodes with class="foo"
dojo.query('.foo')
// all nodes with classes "foo" and "bar"
dojo.query('.foo.bar')
// all <h3> elements that are immediate children of a node with id="main"
dojo.query('#main > h3')

A number of Widgets

The dojo toolkit provides a number of widgets. These can be retrieved by the dijit.byId() method.

Dojo Array Methods

Dojo provides some other useful methods for example: dojo.forEach(). A similar method can be used on the resuklt of a dojo.query().

Dojo also provides filter and map functions. filters an array and returns all the elements verifying a given property. The map function applies some function on all the elements of an array and returns a new array of new values.

The functions dojo.some() and dojo.every() checking that some property is true for some, respectively all the elements of the array

dojo.connect - Event mechanism

The dojo toolkit provides the dojo.connect methods which allows to connect some event to a given event.

Parsing, formatting and validation of numbers and dates

Ajax request tools

An history and bookmarking mechanism

Event System tools

Animation tools

I18n tools (Internationalization)

Java Web Framework Comparison

Here is an useful link for comparing the different existing Java web frameworks.

In particular, "java Web Frameworks sweet spots" is quite interesting.

I learnt about a framework I yet had never heard of: RIFE. The developer, who was asked in the article, seems to be a little too subjective for my taste.

Thursday 22 April 2010

Flex - generating Flex on Java Project

I collected the following from The Flex On Java Book.

$workspace > mvn archetype:create -DarchetypeGroupId=org.foj -DarchetypeArtifactId=flex-mojos-archetype -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.foj -DartifactId=flex-bugs-ria -DremoteRepositories=http://flexonjava.googlecode.com/svn/repository

However, I still need to solve some dependency problems. In particular I needed to install the following packages:

  • com.adobe.flex.compiler:asdoc:zip:template:3.2.0.3958
  • org.graniteds:granite-generator:jar:1.1.0
  • com.adobe.flex:compiler:pom:4.0.0.7219

But this is solved by using the correct repository by adding
<repositories>
   ...
    <repository>
       <id>flexcompiler-repo</id>
       <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
    </repository>
</repositories>

However, after running:

$flex-bugs-ria >mvn package
it runs quite a while with an error. It seems it just could not start the flash player. So it may be all good ;-).

It returns successful and the generated swf can be displayed in the browser

$flex-bugs-ria >mvn package-Dmaven.test.skip=true

Next step: do a more complex flex example.

Mock Frameworks

In this entry, I present a summary of the features of mock frameworks. In particular, I looked at two different mock frameworks: easyMock (MIT Licence), Mockito (Apache Licence) and JMock (probably equivalent to BSD, MIT or Apache but I am not completely sure). The Mockito framework seems to be trying to extend even more the features of the easy mock.

Usual Use Cases of Mock Objects

I adapted the following list from a wikipedia entry. It shows the cases where it a good practice to use mocks.

  • results of method do not follow a very deterministic pattern
  • The mock can simulate a complex object or an object difficult to obtain, e.g a given state in a GUI
  • A state of a system which is expensive to create, resource, processing, power...
  • The object has not yet been provided, perhaps by an other team

Here are some useful posts on mocks:

I notice this post is not at all too clean. It needs to explain the purpose of spying and the difference there is with mock objects which are only dummy object or fake object.

Ext JS Feature Overview

After implementing a whole application with Ext JS, and after presenting also in this blog basic overview of the prototype and jquery javascript frameworks and given a small idea of the functionalities of qooxdoo (and a little overview of QWT), I want to give a more or less thorough view of all the features of this quality framework. In a later entry, I will give a thorough presentation of the relations between GWT and Ext JS.

It is important to notice, that unlike other frameworks the extJS framework does not have a licence mechanism which is very suitable for enterprise application which need to be kept closed source, unless you are ready to pay licence fees to the company owning the code of extJS. However, the core of ext JS is proposed under an LGPL licence, so it can still be used in closed source development.

I first list the main features of extJS, then I go in a little more details for each of these points:

  • Namespace functionalities
  • DOM elements manipulation Utilities
  • Data Manipulation Utilities
  • Data Store functionalities
  • Ajax request functionalities
  • an extended set of application widgets: trees, tables form, charts
  • a complete RIA framework, with menus, drag and drop,....

Namespace functionalities

This is presented in this entry. Namespaces makes it easy it construct more modular applications.

DOM elements manipulation Utilities

This is presented in another entry:

Data Manipulation Utilities

This is presented in another entry:

Data Store functionalities

This is presented in another entry:

Ajax request functionalities

This is presented in another entry:

an extended set of application widgets: trees, tables form, charts

This is presented in another entry:

a complete RIA framework, with menus, drag and drop,....

This is presented in another entry:

Ext JS Tutorial - Namespaces

In this entry I will give a tutorial on using Ext JS Namespaces.

Namespaces are a very useful functionality in extJS. You can define a namespace using:

var myNamespaceNS = new ext.Ext.NS('my.namespaces.mymodules');

Then you can add objects, or functions to the namespaces as easily as if they were normal variables:

myNamespaceNS.myObject = {title:'my title',author:'me'};

In other pieces of the code, you can get the hold of the namespace using its name or a variable.

var myNamespaceNS = new ext.Ext.NS('my.namespaces.mymodules'); alert(myNamespaceNS.myObject.title + " "+my.namespaces.mymodules.myObject.author);

JQuery - Plugins

JQuery is a framework designed with extensions or plugins in mind. There is a large number of plugins which can be found at the plugin page.

In this entry, I will try to select and explain some of the main useful plugins.

Wednesday 21 April 2010

JQuery - Basics

After the post on prototype I thought I might just present the features of jQuery. Just as for prototype I first summarize the features of JQuery, then I describe in a little more details these features. The informations from this entry come from the jQuery API.

  • simple on load execution mechanism
  • simple query mechanism using selectors and syntactic sugar $()
  • Simple Ajax functions and Helpers
  • Manipulation of the DOM elements
  • visualization effects
  • Dimensions Utilities
  • Data Storage and manipulation utilities

simple on load execution mechanism

JQuery provides a way to load code directly on load, by using the .ready() function. In that way, it is possible to initialize a certain number of elements once the web page is ready.

$(document).ready(function() {
  // Handler for .ready() called.
});

Simple Query Mechanism using Selectors and Syntactic Sugar $()

As prototype and other frameworks provide, jquery provides the means of selecting elements using css selectors. The function to use for this is the jQuery() function ( or its equivalent syntactic sugar: $()).

Simple Ajax functions and Helpers

jQuery provides a simple framework to perform Ajax Queries of the sort:

$.ajax({ url: "urltocall",
  context: document.body,
  success: function(){
  // code to perform when the ajax query has been a success
}}
);
Some callback functions can be given as parameters, in order to act depending on the result of the call. In the previous example, the function success is a callback function used when the Ajax request was successful. Other possibility is for example error. But also the request parameters can be changed before the HttpRequest is sent to the server.

Manipulation of the DOM Elements

jQuery provides a great number of utility methods to interact with DOM elements retrieved for instance with the CSS selectors mentioned earlier. For instance, you can add a title ( here an h2 element ) to all elements of the class container.

$('.container').append($('h2'));
Other possibilities is to prepend, the content to an element.

Two other methods can be useful: html() and text() which return respectively the HTML content or the text content of the element or its child elements.

Visualization Effects

JQuery provides the possibility to animate the elements of the page. For example, if the user clics on an elements a small animation can be displayed to inform the user that something actually occurs.

jQuery('#elementToClick').click(function() {
  $('#elementToAnimate').animate({
   opacity: 0.35,
   left: '+=20',
   height: 'toggle'
  }, 5000, function() {
  // the code called once the animation is finished
  });
});

Dimensions Utilities

JQuery provides a number of useful methods to determinate the dimensions of objects. See for example:

$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
Other methods are for example width(), innerHeight() and innerWidth()

Data Storage and manipulation Utilities

// code to add data to an element elementToStoreData
$('elementToStoreData').data('age', 52);
$('elementToStoreData').data('nameInfo', { firstName: 'Mark', lastName: 'MacGuire });
// code to remove the data from the element elementToStoreData
$('elementToStoreData').removeData('age');
$('elementToStoreData').removeData('nameInfo');
$('elementToStoreData').removeData(); // removes all entries stored in this Element

Visit the API page for more informations.

prototype javascript - API features

Prototype is a minimalistic javascript Ajax and Dom manipulation framework.

By taking a look at the API, I decided to sum up the interesting features of prototype (version 1.6). Here are the following useful features of prototype

  • Ajax Requests
  • syntactic sugar
  • CSS selector manipulation
  • enumeration
  • String manipulation and Template mechanism
  • periodical workers

Ajax Requests

The prototype API provides a simple browser independant API to perform Ajax requests:

new Ajax.Request('/theserverURLpath', {
  onSuccess: function(response) {
   // Handle the response content...
  }
});
Just as in other javascript frameworks to perform Ajax requests you can set callback depending on the type of response you obtain from the server. The code might look like this:
new Ajax.Request('/theserverURLpath', {
  onSuccess: function(response) {
   alert('The call was successful');
  },
  onFailure: function(response) {
   alert('The call has failed');
  }
});

Syntactic Sugar and Element Manipulation

Prototype provides a certain number of shortcuts to obtain elements more easily. For example, you can directly obtain elements when you know their id (for example for an element with id: 'myid', you can get the element using the call to $('myid'))

Other example of syntactic sugar are $F (returns the value of a form element), $A return an array from an iterable element, $H (returns a Hash map), $R (returns an object range), $w (returns the array from the splitted string given as argument).

CSS selector manipulation

CSS Selectors provides a powerful means of selecting elements of a web page either using their tags, or their ids, or their css class... prototype provides a selector class and two syntactic sugar constructs to perform easy queries using selectors.

Enumerations

Prototype provides a mixin in order to create enumerable classes more easily. The following example illustrate the definition and the use of the mixin.

var theEnumerableClass = Class.create(Enumerable, {
  initialize: function() {
   // the constructor code
  },
  _each: function(iterator) {
  // Your iteration code, invoking iterator at every turn
  },
  // Your other methods here, including Enumerable overrides
}); var enumerableInstance = new theEnumbarableClass({});
After having defined the enumerable class and instance, prototype provides a number of methods from the Enumerable mixin in order to perform actions on the enumerable aspect of the instance, for instance using the each() function.

String manipulation and Template mechanism

Prototype provides a number of string manipulations extensions of the string class as well as a regular expression framework.

It also provides the usual template mechanism which allows the passing of arguments to a given string.

var myTemplate = new Template('Dear #{title} #{firstname} #{lastname}.');
var personInfo = {
  title: 'Dr',
  firstname: 'Homer',
  lastname: 'Simpson'
};
// let's format our data
myTemplate.evaluate(personInfo);

periodical workers

Like many other javascript frameworks, prototype has also a mechanism to perform some tasks periodically. The code is clear in itself.

new PeriodicalExecuter(function (pe) { // the code to be performed every five seconds !!! }, 5);

git trick - shallow cloning

I am reading Oreilly's kurz & gut Git book. And I discovered, that it is possible to clone with a very shallow level by using the "--depth=" option. For example, if you want only to clone the repository with only the three latest commit, you may use:

$mygitworkingdirectory> git clone --depth=3 git:path/repository

Isn't that great.

Git rocks !!! ;-)

Installing qwt (Qooxdoo Windowing Toolkit)

After trying qooxdoo, I natually tried QWT, which is a simple implementation of the windowing toolkit with java. The default project generated for qwt is basicall the same as the one provided by qooxdoo. However, the main idea is to use java as programming language. The javascript components are then generated I suppose.

Getting QWT to run with maven without the installed Maven

The QWT install package contains a maven instance. However, I already have two instances of maven installed on my computer, therefore I prefered using my own maven instance. This worked quite well after I installed the qooxdoo files as well as some eclipse base package in my local repository. Moreover I need the following setting:

<settings>
  <pluginGroups>
   <pluginGroup>org.qooxdoo.toolkit</pluginGroup>
  </pluginGroups>
</settings>

Then I could use the qwt project generator: $qwt-workplace> mvn-jul qx:new -Dpackage=de.deprofundis.exampleqwt -Dorg.apache.maven.global-settings=`pwd`/../qwt-0.2.0/bin/settings.xml
and then I could change in the directory "exampleqwt", where there is a src directory as well as a pom.xml.

Installing the project in my repository was easy:
$exampleqwt> mvn package -Dorg.apache.maven.global-settings=`pwd`/../qwt-0.2.0/bin/settings.xml
Then using qx:run task from the qwt maven plugin:
$exampleqwt> mvn qx:run -Dorg.apache.maven.global-settings=`pwd`/../qwt-0.2.0/bin/settings.xml

This started an instance of tomcat on port 8080. Therefore I could then test the application.

First Comments

The generated code is an index.html (or index.html.gz for browser/servers supporting gz I suppose. This is a huge html file containing the core content of the javascript for running qwt. I wonder why the programmers have not put this generated code in a javascript file and loaded this file.

The directory layout of a qwt project is described in a wiki page: directory_layout. Note that, there is a logging mechanism. Though I have not yet looked at what it really does. There is also a list of the modules to be loaded and the index.html which has been created.

From all this, it is not yet clear to me how to have a more modular approach, so that the qooxdoo code does not need to be loaded every time I need a qooxdoo component. I suppose this might be solved in a later version of the code.

Caveats

According to the following page of the documentation, QWT only works in a Tomcat 6 Servlet instance:

In order to distribute your QWT application, simply run mvn clean package to generate a target/yourapp-version.war file. Your application should run in any Tomcat 6 servlet container. QWT applications follow Sun’s servlet specification 2.5. Unfortunately, the servlet specification has currently no support for “reverse Ajax” (sometimes called “Comet”). QWT uses Tomcat 6 features to work-around this limitation. As a consequence, you cannot deploy in other servlet containers.

Trying qooxdoo

I have been trying qooxdoo? And I do not find it very easy to use. But I am not really clear about every commands: So here is what I did:
  1. checked the qooxdoo sdk and generated a project using
    /qooxdoo-1.0.1/tools/bin/create-application.py --name mytest
    in the directory where the project should be generated.
  2. this created the template of the demo project but it took some time
  3. to see the default I used: ./generate.py source-all as suggested in the documentation and this took also along time
  4. once done I looked at the result in the browser ( without a webserver!)
  5. I added code for a tree, and reused
    ./generate.py source-all
    (maybe I should have used ./generate.py source

One of the disadvantage of course is the use of python. I have to take a look at what RAP exactly does with the code. It probably does not need to use any python or generation since the application components are already generated. But I should check.

Use JQuery in firebug with jQueryfy

Here is a great presentation on how to use firebug to test interactively jquery.

JQueryfy is a bookmarklet to load jquery in any web page easily.

So all you have to do is:

  1. go to some web page.
  2. Load Jquery with jQueryfy
  3. then start firebug

Then go to the console of firebug, and type jQuery(). This should return
"function()".

In order to have all the images disappear for example, you can use:
jQuery('img').hide()

Of course you need to use a correct selector for your queries. But isn't that just great ?

Note: I had to update my version of firebug to have all this working.

Sunday 18 April 2010

Agile Methods - Pair Programming

I had a job interview the week before and I enjoyed the possibility of participating in a mock job day last week. This day was really interesting for me. I could learn a lot about agile methods. In particular I noticed how difficult it was for me to interact in pair programming work.

After that I looked more into agile methods to try to see what I was missing and what I could have done better. The following article: All I Really Need to Know about Pair Programming I Learned In Kindergarten gives some tips on how to work with pair programming. It also states that pair programming needs a little adaptation

I summed up in the following paragraphs the positive and negative aspects of pair programming.

Positive Aspects

  • More structured: Pairs usually choose to code at more appropriate positions and have shorter breaks.
  • Better Code: during pair programming, programmers come less into dead ends and achieve a better quality.
  • Better distributed Flow: Pair programming has another kind of Flow: a programmer can choose to communicate to his partner the current state and let the partner resume coding at that place. Stops in the coding can be thus better minimized.
  • Fun Working: Pair programming is often more thrilling and interesting as lone development.
  • Distribution of Project Knowledge: When Pair programming is used, and partners are changed frequently, programmers obtain a better knowledge of the whole code base. Preventing the loss of knowledge assets when programmers go.
  • Mentoring: Every one has knowledge that others do not. Pair programmierung distributes knowledge and skills.
  • Team consolidation: people learn to know each other better, which improves the collaboration in the team.
  • Less Break: Pairs are less frequently disturbed as people working alone.

Disadvantages

  • Cost: Advantages such as better quality and efficience need a number of iterations to be able to work correctly, therefore the cost in early phases are higher.
  • Finding Team Elements : not every programmer can be used together and getting used to pair programming may need some time
  • Autority problem: Who decides the solution to use when the solution are contradicting each others?
  • Time pressure: programmers may require more time because of mentoring tasks or to adapt to different code styles and strategies
  • Code copyright: it is not always clear who is the real owner of the code.
  • accountability: when mistake or copyright violations occur, it may be difficult to decide who is accountable.
  • Team size: it is more difficult for larger teams to decide what and how the code should be solved, therefore pair programming is more efficient for smaller teams
  • Knowledge requirements: if different types of tasks need to be performed, programmers need to know more.