<?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=Pvthakka</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=Pvthakka"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Pvthakka"/>
	<updated>2026-07-03T02:05:06Z</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_2012/ch2a_2w17_pt&amp;diff=67558</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67558"/>
		<updated>2012-10-16T22:08:40Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A [http://c2.com/cgi/wiki?RemoteProxy remote proxy] provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A [http://www.javabeat.net/2007/09/working-with-virtual-proxy-pattern/ virtual proxy] allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A [http://users.soe.ucsc.edu/~pohl/Winter01/Design2/sld047.htm copy-on-write] defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A [http://www.cymphonix.com/AnonymousProxy.html protection proxy] provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A [http://www.blackwasp.co.uk/Proxy.aspx cache proxy] provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/proxy.htm firewall proxy] protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A [http://rezagh.wikidot.com/sync-proxy-pattern synchronization proxy] provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A [http://www.theserverside.com/discussions/thread.tss?thread_id=10880 smart reference proxy] provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An [http://www.oodesign.com/adapter-pattern.html adapter pattern] translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A [http://www.oodesign.com/bridge-pattern.html Bridge Pattern] decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternComposite.aspx composite pattern] is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The [http://www.oodesign.com/decorator-pattern.html decorator pattern] can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternFacade.aspx facade] is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A [http://www.oodesign.com/flyweight-pattern.html flyweight] is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
[http://www.corej2eepatterns.com/Patterns2ndEd/FrontController.htm Front controllers] are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A [http://briancray.com/posts/javascript-module-pattern module pattern] is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
===Comparison of Proxy pattern and Facade Pattern===&lt;br /&gt;
*The proxy pattern adds behavior whereas the façade pattern simplifies behavior.&lt;br /&gt;
*Proxies are optional, facades are not.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Adapter Pattern and Facade Pattern===&lt;br /&gt;
*In adapter pattern, the interface that is being adapted might already exist. &lt;br /&gt;
*The adapter pattern preserves polymorphism. A façade provides an idealized flexible interface which can be modified anytime as requirements come in.&lt;br /&gt;
*Adapters are usually small and hence do not have performance issues whereas facades are huge.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Proxy pattern and Adapter pattern===&lt;br /&gt;
*An adapter pattern changes the interface of the service whereas proxy pattern changes the behavior.&lt;br /&gt;
*An adapter pattern preserves the behavior of the service whereas the proxy pattern preserves the interface.&lt;br /&gt;
*In adapter pattern client can use the service entity only by using the adapter whereas in proxy pattern a client can use the proxy or the adapter in the same way.&lt;br /&gt;
*The Proxy can be cast to the interface of the Service. The Adapter can be cast to the interface the Client expects.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*http://en.wikipedia.org/wiki/Software_design_pattern&lt;br /&gt;
*http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Proxy&lt;br /&gt;
*http://www.dofactory.com/Patterns/&lt;br /&gt;
*http://en.wikipedia.org/wiki/Proxy_pattern&lt;br /&gt;
*http://www.oodesign.com/&lt;br /&gt;
*http://www.netobjectivestest.com/PatternRepository/index.php?title=AdapterVersusProxyVersusFacadePatternComparison&lt;br /&gt;
*[http://www.csc.ncsu.edu/faculty/efg/517/f12/schedule Class notes]&lt;br /&gt;
*[http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&amp;amp;tp=&amp;amp;arnumber=4383091&amp;amp;contentType=Conference+Publications&amp;amp;sortType%3Dasc_p_Sequence%26filter%3DAND%28p_IS_Number%3A4383083%29 IEEE paper 1]&lt;br /&gt;
*[http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=5982228&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D5982228 IEEE Paper 2]&lt;br /&gt;
*[http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCkQFjAA&amp;amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.75.3386%26rep%3Drep1%26type%3Dpdf&amp;amp;ei=Vdp9UKinJpD09gTr8oCwDA&amp;amp;usg=AFQjCNERJnpeBDZjXH6PrZnR_8zRQPkIZQ IEEE Paper 3]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67557</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67557"/>
		<updated>2012-10-16T22:06:59Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A [http://c2.com/cgi/wiki?RemoteProxy remote proxy] provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A [http://www.javabeat.net/2007/09/working-with-virtual-proxy-pattern/ virtual proxy] allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A [http://users.soe.ucsc.edu/~pohl/Winter01/Design2/sld047.htm copy-on-write] defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A [http://www.cymphonix.com/AnonymousProxy.html protection proxy] provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A [http://www.blackwasp.co.uk/Proxy.aspx cache proxy] provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/proxy.htm firewall proxy] protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A [http://rezagh.wikidot.com/sync-proxy-pattern synchronization proxy] provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A [http://www.theserverside.com/discussions/thread.tss?thread_id=10880 smart reference proxy] provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An [http://www.oodesign.com/adapter-pattern.html adapter pattern] translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A [http://www.oodesign.com/bridge-pattern.html Bridge Pattern] decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternComposite.aspx composite pattern] is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The [http://www.oodesign.com/decorator-pattern.html decorator pattern] can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternFacade.aspx facade] is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A [http://www.oodesign.com/flyweight-pattern.html flyweight] is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
[http://www.corej2eepatterns.com/Patterns2ndEd/FrontController.htm Front controllers] are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A [http://briancray.com/posts/javascript-module-pattern module pattern] is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
===Comparison of Proxy pattern and Facade Pattern===&lt;br /&gt;
*The proxy pattern adds behavior whereas the façade pattern simplifies behavior.&lt;br /&gt;
*Proxies are optional, facades are not.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Adapter Pattern and Facade Pattern===&lt;br /&gt;
*In adapter pattern, the interface that is being adapted might already exist. &lt;br /&gt;
*The adapter pattern preserves polymorphism. A façade provides an idealized flexible interface which can be modified anytime as requirements come in.&lt;br /&gt;
*Adapters are usually small and hence do not have performance issues whereas facades are huge.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Proxy pattern and Adapter pattern===&lt;br /&gt;
*An adapter pattern changes the interface of the service whereas proxy pattern changes the behavior.&lt;br /&gt;
*An adapter pattern preserves the behavior of the service whereas the proxy pattern preserves the interface.&lt;br /&gt;
*In adapter pattern client can use the service entity only by using the adapter whereas in proxy pattern a client can use the proxy or the adapter in the same way.&lt;br /&gt;
*The Proxy can be cast to the interface of the Service. The Adapter can be cast to the interface the Client expects.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
http://en.wikipedia.org/wiki/Software_design_pattern&lt;br /&gt;
http://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/Proxy&lt;br /&gt;
http://www.dofactory.com/Patterns/&lt;br /&gt;
http://en.wikipedia.org/wiki/Proxy_pattern&lt;br /&gt;
http://www.oodesign.com/&lt;br /&gt;
http://www.netobjectivestest.com/PatternRepository/index.php?title=AdapterVersusProxyVersusFacadePatternComparison&lt;br /&gt;
http://www.csc.ncsu.edu/faculty/efg/517/f12/schedule&lt;br /&gt;
http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&amp;amp;tp=&amp;amp;arnumber=4383091&amp;amp;contentType=Conference+Publications&amp;amp;sortType%3Dasc_p_Sequence%26filter%3DAND%28p_IS_Number%3A4383083%29&lt;br /&gt;
http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=5982228&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D5982228&lt;br /&gt;
http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCkQFjAA&amp;amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.75.3386%26rep%3Drep1%26type%3Dpdf&amp;amp;ei=Vdp9UKinJpD09gTr8oCwDA&amp;amp;usg=AFQjCNERJnpeBDZjXH6PrZnR_8zRQPkIZQ&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67556</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67556"/>
		<updated>2012-10-16T22:03:22Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Comparisons */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A [http://c2.com/cgi/wiki?RemoteProxy remote proxy] provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A [http://www.javabeat.net/2007/09/working-with-virtual-proxy-pattern/ virtual proxy] allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A [http://users.soe.ucsc.edu/~pohl/Winter01/Design2/sld047.htm copy-on-write] defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A [http://www.cymphonix.com/AnonymousProxy.html protection proxy] provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A [http://www.blackwasp.co.uk/Proxy.aspx cache proxy] provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/proxy.htm firewall proxy] protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A [http://rezagh.wikidot.com/sync-proxy-pattern synchronization proxy] provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A [http://www.theserverside.com/discussions/thread.tss?thread_id=10880 smart reference proxy] provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An [http://www.oodesign.com/adapter-pattern.html adapter pattern] translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A [http://www.oodesign.com/bridge-pattern.html Bridge Pattern] decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternComposite.aspx composite pattern] is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The [http://www.oodesign.com/decorator-pattern.html decorator pattern] can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternFacade.aspx facade] is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A [http://www.oodesign.com/flyweight-pattern.html flyweight] is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
[http://www.corej2eepatterns.com/Patterns2ndEd/FrontController.htm Front controllers] are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A [http://briancray.com/posts/javascript-module-pattern module pattern] is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
===Comparison of Proxy pattern and Facade Pattern===&lt;br /&gt;
*The proxy pattern adds behavior whereas the façade pattern simplifies behavior.&lt;br /&gt;
*Proxies are optional, facades are not.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Adapter Pattern and Facade Pattern===&lt;br /&gt;
*In adapter pattern, the interface that is being adapted might already exist. &lt;br /&gt;
*The adapter pattern preserves polymorphism. A façade provides an idealized flexible interface which can be modified anytime as requirements come in.&lt;br /&gt;
*Adapters are usually small and hence do not have performance issues whereas facades are huge.&lt;br /&gt;
&lt;br /&gt;
===Comparison of Proxy pattern and Adapter pattern===&lt;br /&gt;
*An adapter pattern changes the interface of the service whereas proxy pattern changes the behavior.&lt;br /&gt;
*An adapter pattern preserves the behavior of the service whereas the proxy pattern preserves the interface.&lt;br /&gt;
*In adapter pattern client can use the service entity only by using the adapter whereas in proxy pattern a client can use the proxy or the adapter in the same way.&lt;br /&gt;
*The Proxy can be cast to the interface of the Service. The Adapter can be cast to the interface the Client expects.&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67555</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67555"/>
		<updated>2012-10-16T21:42:35Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Similar patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A [http://c2.com/cgi/wiki?RemoteProxy remote proxy] provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A [http://www.javabeat.net/2007/09/working-with-virtual-proxy-pattern/ virtual proxy] allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A [http://users.soe.ucsc.edu/~pohl/Winter01/Design2/sld047.htm copy-on-write] defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A [http://www.cymphonix.com/AnonymousProxy.html protection proxy] provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A [http://www.blackwasp.co.uk/Proxy.aspx cache proxy] provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/proxy.htm firewall proxy] protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A [http://rezagh.wikidot.com/sync-proxy-pattern synchronization proxy] provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A [http://www.theserverside.com/discussions/thread.tss?thread_id=10880 smart reference proxy] provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An [http://www.oodesign.com/adapter-pattern.html adapter pattern] translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A [http://www.oodesign.com/bridge-pattern.html Bridge Pattern] decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternComposite.aspx composite pattern] is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The [http://www.oodesign.com/decorator-pattern.html decorator pattern] can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A [http://www.dofactory.com/Patterns/PatternFacade.aspx facade] is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A [http://www.oodesign.com/flyweight-pattern.html flyweight] is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
[http://www.corej2eepatterns.com/Patterns2ndEd/FrontController.htm Front controllers] are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A [http://briancray.com/posts/javascript-module-pattern module pattern] is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67554</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67554"/>
		<updated>2012-10-16T21:39:25Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Types of proxies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A [http://c2.com/cgi/wiki?RemoteProxy remote proxy] provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A [http://www.javabeat.net/2007/09/working-with-virtual-proxy-pattern/ virtual proxy] allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A [http://users.soe.ucsc.edu/~pohl/Winter01/Design2/sld047.htm copy-on-write] defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A [http://www.cymphonix.com/AnonymousProxy.html protection proxy] provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A [http://www.blackwasp.co.uk/Proxy.aspx cache proxy] provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/proxy.htm firewall proxy] protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A [http://rezagh.wikidot.com/sync-proxy-pattern synchronization proxy] provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A [http://www.theserverside.com/discussions/thread.tss?thread_id=10880 smart reference proxy] provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67553</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67553"/>
		<updated>2012-10-16T21:32:46Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Proxy pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The [http://en.wikipedia.org/wiki/Proxy_pattern Proxy pattern], also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A [http://msdn.microsoft.com/en-us/library/windows/desktop/dd373867%28v=vs.85%29.aspx proxy object] has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67552</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67552"/>
		<updated>2012-10-16T21:11:22Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], [http://www.computationaldesign.ca/projects Computational design patterns], [http://pic.dhe.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=%2Fcom.ibm.websphere.ilog.jrules.doc%2FContent%2FBusiness_Rules%2FDocumentation%2F_pubskel%2FJRules%2Fps_JRules_Global933.html Execution patterns], [http://java-x.blogspot.com/2006/12/implementing-strategy-pattern-in-java.html Implementation strategy patterns], [http://gsraj.tripod.com/design/structural.html Structural design patterns].&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67551</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67551"/>
		<updated>2012-10-16T21:08:53Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A [http://en.wikipedia.org/wiki/Software_design_pattern software design pattern] is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a [http://en.wikipedia.org/wiki/Template template] that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more [http://en.wikipedia.org/wiki/Class_%28computer_programming%29 classes], [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCYQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FObject_(computer_science)&amp;amp;ei=e8x9UP76EYfO9QSaqIHgAw&amp;amp;usg=AFQjCNEi_fFQxGdN5EgaYjs39AP1_WV9Vg objects], services, processes, [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;ved=0CDgQFjAC&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FThread_(computing)&amp;amp;ei=jMx9UJDfFofA9gSCvYDIBA&amp;amp;usg=AFQjCNHVNxWptDxJ9hDcMD_N5JtVFZX9Ow threads], components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CCoQFjAB&amp;amp;url=http%3A%2F%2Fwww.oodesign.com%2Fadapter-pattern.html&amp;amp;ei=u8x9UMmUI4aK8QSE7YHoDg&amp;amp;usg=AFQjCNHBiT1X1w8RNvDaj_11MvharrKziA Adapter pattern] provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like [http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStrategy_pattern&amp;amp;ei=zcx9UMKnFIXA9gTVmIHwCQ&amp;amp;usg=AFQjCNGl3o_1x2n2_FUSSLX9qu5qjlOGmA Algorithm strategy patterns], Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67550</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67550"/>
		<updated>2012-10-16T21:05:00Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* PHP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 class ProxyBookList {&lt;br /&gt;
    private $bookList = NULL; &lt;br /&gt;
    //bookList is not instantiated at construct time&lt;br /&gt;
    function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    function getBookCount() {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    function addBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList(); &lt;br /&gt;
        }&lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;addBook($book);&lt;br /&gt;
    }  &lt;br /&gt;
    function getBook($bookNum) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;getBook($bookNum);&lt;br /&gt;
    }&lt;br /&gt;
    function removeBook($book) {&lt;br /&gt;
        if (NULL == $this-&amp;gt;bookList) {&lt;br /&gt;
            $this-&amp;gt;makeBookList();&lt;br /&gt;
        } &lt;br /&gt;
        return $this-&amp;gt;bookList-&amp;gt;removeBook($book);&lt;br /&gt;
    }&lt;br /&gt;
    //Create &lt;br /&gt;
    function makeBookList() {&lt;br /&gt;
        $this-&amp;gt;bookList = new bookList();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class BookList {&lt;br /&gt;
    private $books = array();&lt;br /&gt;
    private $bookCount = 0;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
    }&lt;br /&gt;
    public function getBookCount() {&lt;br /&gt;
        return $this-&amp;gt;bookCount;&lt;br /&gt;
    }&lt;br /&gt;
    private function setBookCount($newCount) {&lt;br /&gt;
        $this-&amp;gt;bookCount = $newCount;&lt;br /&gt;
    }&lt;br /&gt;
    public function getBook($bookNumberToGet) {&lt;br /&gt;
        if ( (is_numeric($bookNumberToGet)) &amp;amp;&amp;amp; ($bookNumberToGet &amp;lt;= $this-&amp;gt;getBookCount())) {&lt;br /&gt;
            return $this-&amp;gt;books[$bookNumberToGet];&lt;br /&gt;
        } else {&lt;br /&gt;
           return NULL;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    public function addBook(Book $book_in) {&lt;br /&gt;
        $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() + 1);&lt;br /&gt;
        $this-&amp;gt;books[$this-&amp;gt;getBookCount()] = $book_in;&lt;br /&gt;
        return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
    public function removeBook(Book $book_in) {&lt;br /&gt;
        $counter = 0;&lt;br /&gt;
        while (++$counter &amp;lt;= $this-&amp;gt;getBookCount()) {&lt;br /&gt;
          if ($book_in-&amp;gt;getAuthorAndTitle() == $this-&amp;gt;books[$counter]-&amp;gt;getAuthorAndTitle()) {&lt;br /&gt;
            for ($x = $counter; $x &amp;lt; $this-&amp;gt;getBookCount(); $x++) {&lt;br /&gt;
              $this-&amp;gt;books[$x] = $this-&amp;gt;books[$x + 1];&lt;br /&gt;
          }&lt;br /&gt;
          $this-&amp;gt;setBookCount($this-&amp;gt;getBookCount() - 1);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      return $this-&amp;gt;getBookCount();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 class Book {&lt;br /&gt;
    private $author;&lt;br /&gt;
    private $title;&lt;br /&gt;
    function __construct($title_in, $author_in) {&lt;br /&gt;
      $this-&amp;gt;author = $author_in;&lt;br /&gt;
      $this-&amp;gt;title  = $title_in;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthor() {&lt;br /&gt;
        return $this-&amp;gt;author;&lt;br /&gt;
    }&lt;br /&gt;
    function getTitle() {&lt;br /&gt;
        return $this-&amp;gt;title;&lt;br /&gt;
    }&lt;br /&gt;
    function getAuthorAndTitle() {&lt;br /&gt;
      return $this-&amp;gt;getTitle().' by '.$this-&amp;gt;getAuthor();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
  writeln( 'BEGIN TESTING PROXY PATTERN';&lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList = new ProxyBookList();&lt;br /&gt;
  $inBook = new Book('PHP for Cats','Larry Truett');&lt;br /&gt;
  $proxyBookList-&amp;gt;addBook($inBook);&lt;br /&gt;
  writeln('test 1 - show the book count after a book is added');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('test 2 - show the book');&lt;br /&gt;
  $outBook = $proxyBookList-&amp;gt;getBook(1);&lt;br /&gt;
  writeln($outBook-&amp;gt;getAuthorAndTitle()); &lt;br /&gt;
  writeln('');&lt;br /&gt;
  $proxyBookList-&amp;gt;removeBook($outBook);&lt;br /&gt;
  writeln('test 3 - show the book count after a book is removed');&lt;br /&gt;
  writeln($proxyBookList-&amp;gt;getBookCount());&lt;br /&gt;
  writeln('');&lt;br /&gt;
  writeln('END TESTING PROXY PATTERN');&lt;br /&gt;
  function writeln($line_in) {&lt;br /&gt;
    echo $line_in.&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
* ProxyBookList is created in place of the more resource intensive BookList. ProxyBookList will only instantiate BookList the first time a method in BookList is called.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 BEGIN TESTING PROXY PATTERN &lt;br /&gt;
 test 1 - show the book count after a book is added &lt;br /&gt;
 1 &lt;br /&gt;
 test 2 - show the book &lt;br /&gt;
 PHP for Cats by Larry Truett &lt;br /&gt;
 test 3 - show the book count after a book is removed &lt;br /&gt;
 0 &lt;br /&gt;
 END TESTING PROXY PATTERN&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67549</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67549"/>
		<updated>2012-10-16T21:00:36Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Exmaple 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67548</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67548"/>
		<updated>2012-10-16T21:00:00Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* C# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67547</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67547"/>
		<updated>2012-10-16T20:59:46Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* C# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67546</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67546"/>
		<updated>2012-10-16T20:59:20Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* C# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
 using System;&lt;br /&gt;
  // MainApp test application &lt;br /&gt;
  class MainApp&lt;br /&gt;
  {&lt;br /&gt;
    static void Main()&lt;br /&gt;
    {&lt;br /&gt;
      // Create proxy and request a service &lt;br /&gt;
      Proxy proxy = new Proxy();&lt;br /&gt;
      proxy.Request();&lt;br /&gt;
&lt;br /&gt;
      // Wait for user &lt;br /&gt;
      Console.Read();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Subject&amp;quot; &lt;br /&gt;
  abstract class Subject &lt;br /&gt;
  {&lt;br /&gt;
    public abstract void Request();    &lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;RealSubject&amp;quot; &lt;br /&gt;
  class RealSubject : Subject&lt;br /&gt;
  {&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      Console.WriteLine(&amp;quot;Called RealSubject.Request()&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  // &amp;quot;Proxy&amp;quot; &lt;br /&gt;
  class Proxy : Subject&lt;br /&gt;
  {&lt;br /&gt;
    RealSubject realSubject;&lt;br /&gt;
&lt;br /&gt;
    public override void Request()&lt;br /&gt;
    {&lt;br /&gt;
      // Use 'lazy initialization' &lt;br /&gt;
      if (realSubject == null)&lt;br /&gt;
      {&lt;br /&gt;
        realSubject = new RealSubject();&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      realSubject.Request();&lt;br /&gt;
    }  &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A surrogate is provided for another object to control access to it.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Called RealSubject.Request()&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67545</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67545"/>
		<updated>2012-10-16T20:56:19Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
 import java.io.*;  import java.net.*;&lt;br /&gt;
 // 5. To be compatible, an interface is created between the proxy and target&lt;br /&gt;
 interface SocketInterface {&lt;br /&gt;
  String readLine();&lt;br /&gt;
  void  writeLine( String str );&lt;br /&gt;
  void  dispose();&lt;br /&gt;
 }&lt;br /&gt;
 public class ProxyDemo {&lt;br /&gt;
  public static void main( String[] args ) {&lt;br /&gt;
    // 3. The client deals with the proxy&lt;br /&gt;
    SocketInterface socket = new SocketProxy( &amp;quot;127.0.0.1&amp;quot;, 8189,&lt;br /&gt;
      args[0].equals(&amp;quot;first&amp;quot;) ? true : false );&lt;br /&gt;
    String  str = null;&lt;br /&gt;
    boolean skip = true;&lt;br /&gt;
    while (true) {&lt;br /&gt;
      if (args[0].equals(&amp;quot;second&amp;quot;)  &amp;amp;&amp;amp;  skip) {&lt;br /&gt;
        skip = ! skip;&lt;br /&gt;
      }&lt;br /&gt;
      else {&lt;br /&gt;
        str = socket.readLine();&lt;br /&gt;
        System.out.println( &amp;quot;Receive - &amp;quot; + str );  // java ProxyDemo first&lt;br /&gt;
        if (str.equals(&amp;quot;quit&amp;quot;)) break;             // Receive - 123 456&lt;br /&gt;
      }                                            // Send ---- 234 567&lt;br /&gt;
      System.out.print( &amp;quot;Send ---- &amp;quot; );            // Receive - 345 678&lt;br /&gt;
      str = Read.aString();                        //&lt;br /&gt;
      socket.writeLine( str );                     // java ProxyDemo second&lt;br /&gt;
      if (str.equals(&amp;quot;quit&amp;quot;)) break;               // Send ---- 123 456&lt;br /&gt;
    }                                              // Receive - 234 567&lt;br /&gt;
    socket.dispose();                              // Send ---- 345 678&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 class SocketProxy implements SocketInterface {&lt;br /&gt;
  // 1. A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
  private Socket      socket;&lt;br /&gt;
  private BufferedReader in;&lt;br /&gt;
  private PrintWriter   out;&lt;br /&gt;
  public SocketProxy( String host, int port, boolean wait ) {&lt;br /&gt;
    try {&lt;br /&gt;
      if (wait) {&lt;br /&gt;
        // 2. A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
        ServerSocket server = new ServerSocket( port );&lt;br /&gt;
        socket = server.accept();&lt;br /&gt;
      } else&lt;br /&gt;
        socket = new Socket( host, port );&lt;br /&gt;
        in  = new BufferedReader( new InputStreamReader(&lt;br /&gt;
                                        socket.getInputStream()));&lt;br /&gt;
        out = new PrintWriter( socket.getOutputStream(), true );&lt;br /&gt;
      } catch( IOException e ) {&lt;br /&gt;
        e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  public String readLine() {&lt;br /&gt;
    String str = null;&lt;br /&gt;
    try {&lt;br /&gt;
      str = in.readLine();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
    return str;&lt;br /&gt;
  }&lt;br /&gt;
  public void writeLine( String str ) {&lt;br /&gt;
    // 4. The proxy delegates the target&lt;br /&gt;
    out.println( str );&lt;br /&gt;
  }&lt;br /&gt;
  public void dispose() {&lt;br /&gt;
    try {&lt;br /&gt;
      socket.close();&lt;br /&gt;
    } catch( IOException e ) {&lt;br /&gt;
      e.printStackTrace();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*A proxy is created for the expensive or remote or sensitive object(target)&lt;br /&gt;
*A level of abstraction is created to encapsulate the complexity is the target&lt;br /&gt;
*The client deals with the proxy&lt;br /&gt;
*The proxy delegates the target&lt;br /&gt;
*To be compatible, an interface is created between the proxy and target.&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67544</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67544"/>
		<updated>2012-10-16T20:49:41Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Exmaple 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67543</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67543"/>
		<updated>2012-10-16T20:49:09Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
====Example 1====&lt;br /&gt;
 class RealImage&lt;br /&gt;
 {&lt;br /&gt;
     int m_id;&lt;br /&gt;
     public:&lt;br /&gt;
     RealImage(int i)&lt;br /&gt;
     {&lt;br /&gt;
        m_id = i;&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   $$ ctor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
     }&lt;br /&gt;
    ~RealImage()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   dtor: &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;   drawing image &amp;quot; &amp;lt;&amp;lt; m_id &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 // 1. Design an &amp;quot;extra level of indirection&amp;quot; wrapper class&lt;br /&gt;
 class Image&lt;br /&gt;
 {&lt;br /&gt;
    // 2. The wrapper class holds a pointer to the real class&lt;br /&gt;
    RealImage *m_the_real_thing;&lt;br /&gt;
    int m_id;&lt;br /&gt;
    static int s_next;&lt;br /&gt;
  public:&lt;br /&gt;
    Image()&lt;br /&gt;
    {&lt;br /&gt;
        m_id = s_next++;&lt;br /&gt;
        // 3. Initialized to null&lt;br /&gt;
        m_the_real_thing = 0;&lt;br /&gt;
    }&lt;br /&gt;
    ~Image()&lt;br /&gt;
    {&lt;br /&gt;
        delete m_the_real_thing;&lt;br /&gt;
    }&lt;br /&gt;
    void draw()&lt;br /&gt;
    {&lt;br /&gt;
        // 4. When a request comes in, the real object is&lt;br /&gt;
        //    created &amp;quot;on first use&amp;quot;&lt;br /&gt;
        if (!m_the_real_thing)&lt;br /&gt;
          m_the_real_thing = new RealImage(m_id);&lt;br /&gt;
        // 5. The request is always delegated&lt;br /&gt;
        m_the_real_thing-&amp;gt;draw();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
 int Image::s_next = 1;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  Image images[5];&lt;br /&gt;
  for (int i; true;)&lt;br /&gt;
  {&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;Exit[0], Image[1-5]: &amp;quot;;&lt;br /&gt;
    cin &amp;gt;&amp;gt; i;&lt;br /&gt;
    if (i == 0)&lt;br /&gt;
      break;&lt;br /&gt;
    images[i - 1].draw();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
*The Wrapper class has an extra level on indirection&lt;br /&gt;
*The Wrapper class contains a pointer to the original class and it is initialized to NULL&lt;br /&gt;
*Lazy initialization is implemented.&lt;br /&gt;
*Request is always delegated.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 $$ ctor: 2 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 4 &lt;br /&gt;
 $$ ctor: 4 drawing image 4 &lt;br /&gt;
 Exit[0], Image[1-5]: 2 &lt;br /&gt;
 drawing image 2 &lt;br /&gt;
 Exit[0], Image[1-5]: 0 &lt;br /&gt;
 dtor: 4 &lt;br /&gt;
 dtor: 2&lt;br /&gt;
&lt;br /&gt;
====Exmaple 2====&lt;br /&gt;
 class Subject&lt;br /&gt;
 {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void execute() = 0;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class RealSubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string str;&lt;br /&gt;
  public:&lt;br /&gt;
    RealSubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        str = s;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; str &amp;lt;&amp;lt; '\n';&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class ProxySubject: public Subject&lt;br /&gt;
 {&lt;br /&gt;
    string first, second, third;&lt;br /&gt;
    RealSubject *ptr;&lt;br /&gt;
  public:&lt;br /&gt;
    ProxySubject(string s)&lt;br /&gt;
    {&lt;br /&gt;
        int num = s.find_first_of(' ');&lt;br /&gt;
        first = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        second = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        num = s.find_first_of(' ');&lt;br /&gt;
        third = s.substr(0, num);&lt;br /&gt;
        s = s.substr(num + 1);&lt;br /&gt;
        ptr = new RealSubject(s);&lt;br /&gt;
    }&lt;br /&gt;
    ~ProxySubject()&lt;br /&gt;
    {&lt;br /&gt;
        delete ptr;&lt;br /&gt;
    }&lt;br /&gt;
    RealSubject *operator-&amp;gt;()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; second &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        return ptr;&lt;br /&gt;
    }&lt;br /&gt;
     /*virtual*/void execute()&lt;br /&gt;
    {&lt;br /&gt;
        cout &amp;lt;&amp;lt; first &amp;lt;&amp;lt; ' ' &amp;lt;&amp;lt; third &amp;lt;&amp;lt; ' ';&lt;br /&gt;
        ptr-&amp;gt;execute();&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
  ProxySubject obj(string(&amp;quot;the quick brown fox jumped over the dog&amp;quot;));&lt;br /&gt;
  obj-&amp;gt;execute();&lt;br /&gt;
  obj.execute();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Explanation of Proxy Pattern'''&lt;br /&gt;
Here ”-&amp;gt;” and “.” operators give different results.&lt;br /&gt;
&lt;br /&gt;
'''Output'''&lt;br /&gt;
 the quick fox jumped over the dog &lt;br /&gt;
 the brown fox jumped over the dog&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67542</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67542"/>
		<updated>2012-10-16T20:37:56Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* UML Class Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:pt.jpg]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/1&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Pt.jpg&amp;diff=67541</id>
		<title>File:Pt.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Pt.jpg&amp;diff=67541"/>
		<updated>2012-10-16T20:37:16Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67540</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67540"/>
		<updated>2012-10-16T20:34:56Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:Uml.png]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/1&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67539</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67539"/>
		<updated>2012-10-16T20:33:26Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
&lt;br /&gt;
[[File:uml.png]]	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/1&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml.PNG&amp;diff=67538</id>
		<title>File:Uml.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Uml.PNG&amp;diff=67538"/>
		<updated>2012-10-16T20:32:40Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67537</id>
		<title>CSC/ECE 517 Fall 2012/ch2a 2w17 pt</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2a_2w17_pt&amp;diff=67537"/>
		<updated>2012-10-16T20:30:14Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: Created page with &amp;quot;==Design Pattern== 	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar f...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Design Pattern==&lt;br /&gt;
	A software design pattern is a problem-solution pair that gives a general re-usable solution to a commonly occurring problem and can be applied in a similar fashion in new contexts. A design pattern is a template that gives a solution to many similar situations. It cannot be directly transformed into code.  &lt;br /&gt;
The solution is usually a simple mechanism because it is a collaboration between two or more classes, objects, services, processes, threads, components, or nodes that work together to solve the underlying architecture or development challenge&lt;br /&gt;
	Design patterns documents simple mechanism that work. They provide a common vocabulary and taxonomy for developers and architects. They allow solutions to be described concisely as combinations of patterns. They enable reuse of architecture, design, and implementation decisions. All these features make design patterns very useful to software developers and architects.&lt;br /&gt;
	Design patterns are typically represented as relationships between classes and objects with defined responsibilities that act in concert to carry out the solution. For instance consider the Adapter pattern. Adapter pattern provides a solution to the scenario in which a client and server need to interact with one another, but cannot because their interfaces are not compatible. To implement the Adapter pattern, you create a custom class that honors the interface provided by the server and defines the server operations in terms the client expects. This is a much better solution than altering the client to match the interface of the server.&lt;br /&gt;
	There are many design patterns like Algorithm strategy patterns, Computational design patterns, Execution patterns, Implementation strategy patterns, Structural design patterns.&lt;br /&gt;
&lt;br /&gt;
==Proxy pattern==&lt;br /&gt;
	The Proxy pattern, also known as a surrogate pattern, is a Structural design pattern. A proxy provides a surrogate or placeholder for another object to control access to it. There will be situations in which a client does not or cannot reference an object directly but still wants to interact with the object. A proxy object can act as an intermediary between the client and the target object. A proxy object has the same interface as the target object. The proxy holds a reference to the target object and can forward requests to the target as required. In effect, the proxy object has the authority to act on behalf of the client to interact with the target object.&lt;br /&gt;
&lt;br /&gt;
==UML Class Diagram==&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
By defining a Subject interface, the presence of the Proxy object standing in place of the RealSubject is transparent to the client.&lt;br /&gt;
&lt;br /&gt;
==Applications of Proxy Pattern==&lt;br /&gt;
*A proxy can interface a network connection, a large object in memory, a file or any other resource that is expensive or impossible to duplicate.  &lt;br /&gt;
*Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide.&lt;br /&gt;
*In situations where multiple copies of a complex object must exist, the proxy pattern can be used to reduce the application’s memory requirements. A single instance of the complex object and multiple proxy objects are created all of which are references to the original complex object. Any operation on the proxy is forwarded to the original object.&lt;br /&gt;
&lt;br /&gt;
==Types of proxies==&lt;br /&gt;
===Remote Proxy===&lt;br /&gt;
A remote proxy provides a reference to an object located in a different address space on the same or different machine. They are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.&lt;br /&gt;
&lt;br /&gt;
===Virtual Proxy===&lt;br /&gt;
A virtual proxy allows the creation of a memory intensive object on demand. The object will not be created until it is really needed.&lt;br /&gt;
&lt;br /&gt;
===Copy-on-Write Proxy===&lt;br /&gt;
A copy-on-write defers cloning a target object until required by client actions. It is really a form of virtual proxy.&lt;br /&gt;
&lt;br /&gt;
===Protection Proxy===&lt;br /&gt;
A protection proxy provides different clients with different levels of access to a target object.&lt;br /&gt;
&lt;br /&gt;
===Cache Proxy===&lt;br /&gt;
A cache proxy provides temporary storage of the results of expensive target operations so that multiple clients can share the results.&lt;br /&gt;
&lt;br /&gt;
===Firewall Proxy===&lt;br /&gt;
A firewall proxy protects targets from bad clients (or vice versa).&lt;br /&gt;
&lt;br /&gt;
===Synchronization Proxy===&lt;br /&gt;
A synchronization proxy provides multiple accesses to a target object.&lt;br /&gt;
&lt;br /&gt;
===Smart reference Proxy===&lt;br /&gt;
A smart reference proxy provides additional actions whenever a target object is referenced such as counting the number of references to the object.&lt;br /&gt;
&lt;br /&gt;
==Examples of Proxy pattern==&lt;br /&gt;
===C++===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/1&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/cpp/2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/java/1&lt;br /&gt;
&lt;br /&gt;
===C#===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/c%2523&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
http://sourcemaking.com/design_patterns/proxy/php&lt;br /&gt;
&lt;br /&gt;
==Similar patterns==&lt;br /&gt;
===Adapter Pattern===&lt;br /&gt;
An adapter pattern translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface&lt;br /&gt;
&lt;br /&gt;
===Bridge Pattern===&lt;br /&gt;
A Bridge Pattern decouples an abstraction from its implementation so that the two can vary independently&amp;quot;. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.&lt;br /&gt;
&lt;br /&gt;
===Composite Pattern===&lt;br /&gt;
A composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to &amp;quot;compose&amp;quot; objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.&lt;br /&gt;
&lt;br /&gt;
===Decorator Pattern===&lt;br /&gt;
The decorator pattern can be used to extend (decorate) the functionality of a certain object dynamically, independently of other instances of the same class, provided some groundwork is done at design time. This is achieved by designing a new decorator class that wraps the original class.&lt;br /&gt;
&lt;br /&gt;
===Facade Pattern===&lt;br /&gt;
A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can make a software library easier to use, understand and test, since the facade has convenient methods for common tasks. It can make the library more readable, for the same reason. It can reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system. It wraps a poorly designed collection of API’s with a single well-designed API .&lt;br /&gt;
&lt;br /&gt;
===Flyweight Pattern===&lt;br /&gt;
A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. Often some parts of the object state can be shared, and it is common practice to hold them in external data structures and pass them to the flyweight objects temporarily when they are used.&lt;br /&gt;
&lt;br /&gt;
===Front Controller Pattern===&lt;br /&gt;
Front controllers are often used in web applications to implement workflows. While not strictly required, it is much easier to control navigation across a set of related pages (for instance, multiple pages might be used in an online purchase) from a front controller than it is to make the individual pages responsible for navigation.&lt;br /&gt;
&lt;br /&gt;
===Module Pattern===&lt;br /&gt;
A module pattern is a design pattern used to implement the concept of software modules,     defined by modular programming, in a programming language that does not support it, or only supports it, partially.&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
Comparison of&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=67536</id>
		<title>CSC/ECE 517 Fall 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012&amp;diff=67536"/>
		<updated>2012-10-16T20:24:12Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[CSC/ECE 517 Fall 2012/ch1 n xx]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w1 rk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w20 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w5 su]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w6 pp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w4 aj]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w7 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w8 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w9 av]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w10 pk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w11 ap]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w12 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w14 gv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w17 ir]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w18 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w22 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 aa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w21 wi]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w31 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w16 br]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1a 1w23 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w24 nr]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w15 rt]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w3 pl]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w32 cm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w37 ss]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w67 ks]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w27 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w29 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w33 op]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w19 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w34 vd]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w35 sa]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1 1w30 rp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w58 am]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w47 sk]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w69 mv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w44 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w45 is]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w53 kc]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 ar]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w39 sn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w54 go]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w56 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w64 nn]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w66 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w40 as]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w42 js]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w46 sm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w71 gs]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w63 dv]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w55 ms]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w57 mp]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w52 an]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2012/ch1b 1w38 nm]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w60 ac]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch1b 1w62 rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w29 st]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch 2w30 an]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2012/ch2a 2w17 pt]]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64053</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64053"/>
		<updated>2012-09-13T16:15:59Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Security */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for [http://en.wikipedia.org/wiki/Agile_software_development agile development].  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Recursion Recursive] approach when pulling or merging one branch&lt;br /&gt;
*[http://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies Octopus] is used when merging two heads.&lt;br /&gt;
&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with [http://en.wikipedia.org/wiki/SHA-1 SHA 1] ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
====Limitations====&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64052</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64052"/>
		<updated>2012-09-13T16:15:28Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Git */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for [http://en.wikipedia.org/wiki/Agile_software_development agile development].  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Recursion Recursive] approach when pulling or merging one branch&lt;br /&gt;
*[http://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies Octopus] is used when merging two heads.&lt;br /&gt;
&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
====Limitations====&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64051</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64051"/>
		<updated>2012-09-13T16:14:53Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Git */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for [http://en.wikipedia.org/wiki/Agile_software_development agile development].  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Recursion Recursive] approach when pulling or merging one branch&lt;br /&gt;
*[http://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies Octopus] is used when merging two heads.&lt;br /&gt;
&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64050</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64050"/>
		<updated>2012-09-13T16:13:58Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Merging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Recursion Recursive] approach when pulling or merging one branch&lt;br /&gt;
*[http://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies Octopus] is used when merging two heads.&lt;br /&gt;
&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64049</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64049"/>
		<updated>2012-09-13T16:13:26Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Merging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional [http://en.wikipedia.org/wiki/Merge_%28revision_control%29#Three-way_merge 3-way merge] algorithm.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Recursion Recursive] approach when pulling or merging one branch&lt;br /&gt;
*[http://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies Octopus] is used when merging two heads.&lt;br /&gt;
&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64048</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64048"/>
		<updated>2012-09-13T16:09:48Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Tagged Commits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Tag_%28metadata%29 Tagging] means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64047</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64047"/>
		<updated>2012-09-13T16:09:03Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Comparison_of_revision_control_software Comparison on various VCS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64046</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64046"/>
		<updated>2012-09-13T16:08:32Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Git */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64045</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64045"/>
		<updated>2012-09-13T16:07:57Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Mercurial */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in [http://www.python.org/ Python]. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64044</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64044"/>
		<updated>2012-09-13T16:07:05Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Limitations of CVS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Symbolic_link Symbolic links] and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64042</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64042"/>
		<updated>2012-09-13T16:05:49Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Examples of version control systems */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*[http://www.nongnu.org/cvs/ CVS]&lt;br /&gt;
*[http://www.bitkeeper.com/ Bitkeeper]&lt;br /&gt;
*[http://subversion.apache.org/ Subversion (SVN)]&lt;br /&gt;
*[http://www.monotone.ca/ Monotone]&lt;br /&gt;
*[http://www.perforce.com/ Perforce]&lt;br /&gt;
*[http://git-scm.com/ Git]&lt;br /&gt;
*[http://bazaar.canonical.com/en/ Bazaar]&lt;br /&gt;
*[http://www-01.ibm.com/software/awdtools/clearcase/ Clearcase]&lt;br /&gt;
*[http://mercurial.selenic.com/ Mercurial]&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64035</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64035"/>
		<updated>2012-09-13T15:57:52Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Distributed Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
[[File:3_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Distributed_revision_control Distributed version control] uses [http://en.wikipedia.org/wiki/Peer-to-peer peer-to-peer model] to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer-to-peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3_2.jpg&amp;diff=64034</id>
		<title>File:3 2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3_2.jpg&amp;diff=64034"/>
		<updated>2012-09-13T15:55:40Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64033</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64033"/>
		<updated>2012-09-13T15:55:22Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Centralized Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
[[File:3_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[http://blogs.atlassian.com/2012/02/version-control-centralized-dvcs/ Centralized Version Control] works on the basis of [http://en.wikipedia.org/wiki/Client%E2%80%93server_model client-server] model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64032</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64032"/>
		<updated>2012-09-13T15:51:33Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Local Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://james-iry.blogspot.com/2010/11/local-version-control.html Local version control] is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore [http://en.wikipedia.org/wiki/Software_versioning versioning] is possible on files rather than projects. Examples of local version control systems are [http://www.gnu.org/software/rcs/ Revision Control System (RCS)] and [http://en.wikipedia.org/wiki/Source_Code_Control_System Source Code Control System (SCCS)]. &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64031</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64031"/>
		<updated>2012-09-13T15:47:31Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Local Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3_1.jpg&amp;diff=64030</id>
		<title>File:3 1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3_1.jpg&amp;diff=64030"/>
		<updated>2012-09-13T15:45:44Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64029</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64029"/>
		<updated>2012-09-13T15:44:53Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Local Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
[[File:3_1.jpg]]&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64022</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64022"/>
		<updated>2012-09-13T08:29:08Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* SVN */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations (either the change is fully committed or it is not committed at all) are included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64021</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64021"/>
		<updated>2012-09-13T08:28:04Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* SVN */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
=='''SVN'''==&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64020</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64020"/>
		<updated>2012-09-13T08:27:45Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Selecting a VCS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
=='''CVS'''==&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
=='''Bazaar'''==&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
=='''Mercurial'''==&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
==='''SVN'''===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
=='''Git'''==&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64019</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64019"/>
		<updated>2012-09-13T08:25:27Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
==='''Local Version Control'''=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
==='''Centralized Version Control'''===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
==='''Distributed Version Control'''===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
==='''CVS'''===&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
==='''Bazaar'''===&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
==='''Mercurial'''===&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
==='''SVN'''===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
==='''Git'''===&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64018</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64018"/>
		<updated>2012-09-13T08:22:21Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
===Local Version Control=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
===Centralized Version Control===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
===Distributed Version Control===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
===CVS===&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
===Bazaar===&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
===Mercurial===&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
===SVN===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
===Git===&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System 1. CVS]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29 2. Bazaar]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial 3. Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion 4. SVN]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29 5. Git]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you Which VCS is best for you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control Wikipedia Revision Conrol]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ Comparison of Git, Mercurial and CVS]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64017</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64017"/>
		<updated>2012-09-13T08:17:23Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Local Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
===Local Version Control=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
===Centralized Version Control===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
===Distributed Version Control===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
===CVS===&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling:====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS:====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
===Bazaar===&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
===Mercurial===&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
===SVN===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits:====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI’s:====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
===Git===&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging:====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security:====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags:====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI:====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29]&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64016</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64016"/>
		<updated>2012-09-13T08:16:22Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Local Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
===Local Version Control=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[File:3_1.jpg|200px|thumb|right|]]&lt;br /&gt;
[[Image:3_1.jpg|thumb|225px|alt=Local Version Control.]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
===Centralized Version Control===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
===Distributed Version Control===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
===CVS===&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling:====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS:====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
===Bazaar===&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
===Mercurial===&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
===SVN===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits:====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI’s:====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
===Git===&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging:====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security:====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags:====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI:====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29]&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3_3.jpg&amp;diff=64015</id>
		<title>File:3 3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3_3.jpg&amp;diff=64015"/>
		<updated>2012-09-13T08:13:36Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64014</id>
		<title>CSC/ECE 517 Fall 2012/ch1 1w33 op</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_1w33_op&amp;diff=64014"/>
		<updated>2012-09-13T08:12:28Z</updated>

		<summary type="html">&lt;p&gt;Pvthakka: /* Distributed Version Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Comparison of version control system from a programmer’s viewpoint =&lt;br /&gt;
==Introduction==&lt;br /&gt;
Version control is an aspect of software configuration management. It is a repository of files, usually source codes of computer programs, large web sites that are a part of collective and distributed development. This article compares various version control systems with respect to their features gives the programmer an insight while selecting the best system for his use.&lt;br /&gt;
==Need of version control==&lt;br /&gt;
The most critical use of version control is to maintain a backup of all files of the project. From a programmer’s perspective, this will save a lot of rework. Due to version control, all files will be synchronized which will enable all members of the project group to stay updated with all changes related to the project. Version control also keeps track of previous versions of the project for reference. This way a developer can revert to any previous versions of any file in the repository. Documentation of changes in the project is also a part of version control which will help in viewing the evolution of code over a period of time. Features of version control such as sandboxing and branching of code will allow the programmer to work on a code in isolation before broadcasting the updated code.&lt;br /&gt;
==Types of Version Control Systems==&lt;br /&gt;
There are three main types of version control system available: local, centralized and distributed .The usage of local version control systems such as RCS is uncommon today and decrepitated.&lt;br /&gt;
			   	&lt;br /&gt;
===Local Version Control=== &lt;br /&gt;
&lt;br /&gt;
Local version control is an early implementation of version control. Local version control stores multiple copies of the same file. The copies are present on only one host machine. Hence all developers have to use the same machine. Here files are managed individually and therefore versioning is possible on files rather than projects. Examples of local version control include Revision Control System (RCS) and Source Code Control System (SCCS). &lt;br /&gt;
[[File:3_1.jpg|200px|thumb|right|]]&lt;br /&gt;
====Advantages of local version control:====&lt;br /&gt;
*Local version control is useful when the number of files to be maintained are less and the number of programmers working on it are also few.&lt;br /&gt;
&lt;br /&gt;
===Centralized Version Control===&lt;br /&gt;
Centralized Version Control works on the basis of client-server model for versioning of project.  Here, a working copy of the code is present on the server. The developer has to download this file, make the required changes and the check-in the modified file on the server by committing his code to the repository. He has to ensure that changes done by him are bug free before committing file to the repository.&lt;br /&gt;
====Advantages of centralized version control====&lt;br /&gt;
*In centralized version control, the working code is present on a dedicated server. Therefore multiple users can access this code which implies the code can be worked upon from multiple workstations instead of a single workstation.&lt;br /&gt;
*Versioning of projects is done in rather than individual versioning of files in centralized version control which will help in tracking and reviewing changes.&lt;br /&gt;
&lt;br /&gt;
===Distributed Version Control===&lt;br /&gt;
&lt;br /&gt;
Distributed version control uses peer to peer model to achieve version control. Here, a centralized canonical version of the code does not exist; rather, the centralized repository is divided into a number of local repositories maintained by each user. The local repositories contain a version of the working code along with the entire history. A developer works upon this code and broadcasts the change in a peer to peer fashion rather than using the client server mode present in centralized version control. If required, a centralized repository of the project can also be created in this system.&lt;br /&gt;
====Advantages of Distributed version control====&lt;br /&gt;
*Distributed version control does not require the developer to connect to the network for accessing the repository. Rather, since the developer has the local version of the repository on his workstation itself, he can work on the project offline.&lt;br /&gt;
*This system emphasizes on interaction with other developers rather than interaction with a server which is fundamental to any peer to peer network.&lt;br /&gt;
*It is easier to branch out from the baseline code and this helps in experimentation during development phase.&lt;br /&gt;
*It's possible to have multiple central branches for different uses like development, stable, release branches of the same project.&lt;br /&gt;
*As this system is not dependent on connection to a central server processes such as committing of code, viewing change log are much simpler.&lt;br /&gt;
&lt;br /&gt;
==Criteria for selecting a particular version control system== &lt;br /&gt;
*Size of project&lt;br /&gt;
*Number of developers working on the project&lt;br /&gt;
*Distribution of developers working on the project. &lt;br /&gt;
*Technology used for developing&lt;br /&gt;
*Plug-ins for IDE’s&lt;br /&gt;
*Learning curve&lt;br /&gt;
*Speed&lt;br /&gt;
*Functionality&lt;br /&gt;
*User interfaces (Web and GUI)&lt;br /&gt;
&lt;br /&gt;
==Examples of version control systems==&lt;br /&gt;
*CVS&lt;br /&gt;
*Bitkeeper&lt;br /&gt;
*SVN&lt;br /&gt;
*Monotone&lt;br /&gt;
*Perforce&lt;br /&gt;
*Git&lt;br /&gt;
*Bazaar&lt;br /&gt;
*Subversion (SVN)&lt;br /&gt;
*Mercurial&lt;br /&gt;
&lt;br /&gt;
==Selecting a VCS==&lt;br /&gt;
Selection of a VCS should be based on the need of the project rather than just the pros of that system. The most significant point while classifying a VCS and also while selecting a VCS, is whether the system is server based or peer-to-peer. In a server based system, there is a centralized repository where a file is checked out and checked in with changes. while in a peer to peer based system, the file is frequently updated from peer sources. Below is a comparison of a few version control systems with respect to the above points which may help the programmer selecting a system.&lt;br /&gt;
===CVS===&lt;br /&gt;
CVS is one of the earliest version control systems. It has a simple file system for providing the basic functionality of a VCS.It has a client-server model.  However it is now obsolete and its functionality is purely reduced to backing up and sharing files.&lt;br /&gt;
Learning curve:&lt;br /&gt;
The learning curve for CVS is not too steep.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
CVS provides a web interface as well as a stand-alone GUI. The plugins for IDE’s are limited with support for only Eclipse, Emacs and Intelij Idea.&lt;br /&gt;
====Conflict handling:====&lt;br /&gt;
A number of programmers can work on the same file concurrently on their individual working copies of the files and then checking in their modifications. To avoid conflicts, the server only accepts changes made to most recent version of the file. This adds to the overhead of keeping the working copy up-to-date on a regular basis. This task is however automated and requires manual intervention in case of a conflict between the client file and the server file.&lt;br /&gt;
&lt;br /&gt;
====Limitations of CVS:====&lt;br /&gt;
*Revisions created by commit are per file rather than containing multiple files.&lt;br /&gt;
*Symbolic links and not versioned leading to security risks.&lt;br /&gt;
*Unicode and non-ASCII filenames have limited support.&lt;br /&gt;
*Commits are not atomic leading to source corruption&lt;br /&gt;
*Text files are assumed to be the primary file type stored.&lt;br /&gt;
*No support for Distributed revision control.&lt;br /&gt;
*Branch operations are expensive since CVS was designed for working on a trunk.&lt;br /&gt;
&lt;br /&gt;
===Bazaar===&lt;br /&gt;
Bazaar is a free distributed VCS written in python with packages for Linux, Windows and Mac OS. &lt;br /&gt;
Distributed as well as Central:&lt;br /&gt;
Bazaar can be used in either a distributed workflow style or with a more standard centralized version control style. Bazaar also works well for single user project in a way that you don’t have to create your own repository and check out a working copy. You work from your project directory and Bazaar does the tracking from there.&lt;br /&gt;
Work offline:&lt;br /&gt;
The distributed nature allows you to work with without a net connection. This can be achieved with the centralized version control by having a local repository.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Bazaar’s merging supports merging multiple branches with a single requirement that the branches have a common ancestor. It also provides a feature called ‘cherrypicking’ wherein you can merge only some changes of a branch. You can also shelve changes that you are working on. This is useful when you are working on multiple patches.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
For a web interface, Bazaar uses a plain webserver. It also has stand alone GUI’s  Bazaar explorer, TortoiseBzr. Bazaar provides plugins for Eclipse, TextMate, Visual Studio and Komodo IDE.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Since it is one of the most feature heavy system, it is a  slightly complicated.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
It is more complicated to backup repositories. Either all the projects need to be kept in one main directory as sub directories or we need to make sure that all directories are being backed up.&lt;br /&gt;
&lt;br /&gt;
===Mercurial===&lt;br /&gt;
Mercurial is a distributed cross platform version control system implemented in Python. Mercurial’s major design goals are scalability, high performance, robust handling of bin and plain text files, advanced branching and merging capabilities. In spite of all these advances features, mercurial remains conceptually simple.&lt;br /&gt;
====Learning curve:====&lt;br /&gt;
Mercurial is similar to SVN and hence for those already familiar with SVN, the learning curve will be less steep. The documentation of mercurial is more complete which facilitates faster learning.&lt;br /&gt;
====GUI and IDE:====&lt;br /&gt;
Mercurial is primarily command line based but graphical extensions are available. Bitbucket, Trac are the web interfaces and TortoiseHg, MacHg, SourceTree are the standalone GUI’s. It provides plugins for IntelliJ IDEA, Eclipse, NetBeans, Visual Studio, Emacs, Vim (VCSCommand plugin), Komodo IDE.&lt;br /&gt;
====Merging:====&lt;br /&gt;
Mercurial uses a 3-way merge.&lt;br /&gt;
====Limitations:====&lt;br /&gt;
*It does not allow merging of two parents.&lt;br /&gt;
*Extension based rather than being scriptable that may be ideal for some programmers&lt;br /&gt;
*Less out of box power.&lt;br /&gt;
===SVN===&lt;br /&gt;
SVN is a successor of CVS fixing most if its problems. Atomic operations are now included. Branch operations are easier and cheaper.&lt;br /&gt;
&lt;br /&gt;
====Tagged Commits:====&lt;br /&gt;
Tagging means labeling a repository at any point of time so that it will be easier to find it in the future. It is a neat way of maintain extra data about your files.&lt;br /&gt;
====Merging/Conflict Resolution:====&lt;br /&gt;
A conflict has to be explicitly marked as resolved before being committed. This reduces the chances of a conflict being accidently committed. Merging multiple branches or cross-merging between branches is difficult due to the client-server model.&lt;br /&gt;
====IDE and GUI’s:====&lt;br /&gt;
Unlike CVS, SVN has provided plugins for a number of IDE’s like Eclipse, NetBeans, Visual Studio, Intellij Idea, TextMate, Rabbit, Komodo, BBEdit, Emacs.  It also has WebSvn ,Trac as web interfaces and Nautilus, Qt, RabbitVCS, RapidSVN, SourceTree as standalone GUI’s.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Does not use peer-to-peer model&lt;br /&gt;
*Contains bugs relating to renaming files and directories.&lt;br /&gt;
*Insufficient repository management commands.&lt;br /&gt;
*Slower that bazaar and Git.&lt;br /&gt;
&lt;br /&gt;
===Git===&lt;br /&gt;
Git is a distributed revision control system that takes a radical approach different from the traditional ones. Its original concept makes it the fastest distributed VCS.  Git supports non-linear development process meaning that changes will be repeatedly merged as the code is reviewed or the requirements change. Thus Git is most suited for agile development.  The purpose of Git was to be fast and scalable and it does that very successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Merging:====&lt;br /&gt;
*The traditional 3-way merge algorithm.&lt;br /&gt;
*Recursive approach when pulling or merging one branch&lt;br /&gt;
*Octopus is used when merging two heads.&lt;br /&gt;
====Compatibility:====&lt;br /&gt;
Git works with SVN meaning you can use a subversion directory directly with Git.&lt;br /&gt;
&lt;br /&gt;
====Security:====&lt;br /&gt;
The history is stored in such a way that the name of a revision depends on the history to that point. Once the revision is published, it can't be changed without the change being visible. The revisions are identified with SHA 1 ID’s.&lt;br /&gt;
&lt;br /&gt;
====Tags:====&lt;br /&gt;
Tags are extremely powerful. Any arbitrary description can be attached to the tag.&lt;br /&gt;
&lt;br /&gt;
====IDE’s and GUI:====&lt;br /&gt;
Git has a web interface GitHub, standalone GUI’s Gitbox, Tortoise, Smart Git. It has plugins for a number of IDE’s Aptana 3 Beta (Aptana Studio 3 with Git Integration); Eclipse (JGit/EGit); Netbeans (NbGit); KDevelop; Visual Studio (Git Extensions); Emacs (extension for standard VC); TextMate (Git TextMate Bundle); Vim (VCSCommand plugin and fugitive plugin); IntelliJ IDEA &amp;gt;8.1 (standard in Community and Ultimate Editions); Komodo IDE; Anjuta.&lt;br /&gt;
Limitations:&lt;br /&gt;
*Learning curve is a little steep.&lt;br /&gt;
*Not optimal for single developers.&lt;br /&gt;
*Limited windows support as compared to linux.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Concurrent_Versions_System]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Bazaar_%28software%29]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Mercurial]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_Subversion]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Git_%28software%29]&lt;br /&gt;
* [http://www.tuxradar.com/content/which-version-control-system-best-you]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Revision_control]&lt;br /&gt;
* [http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/]&lt;/div&gt;</summary>
		<author><name>Pvthakka</name></author>
	</entry>
</feed>