Friday, August 23, 2013

Design Patterns

Creational Patterns

In software engineeringcreational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.
Creational design patterns are composed of two dominant ideas. One is encapsulating knowledge about which concrete classes the system uses. Another is hiding how instances of these concrete classes are created and combined.[1]
Creational design patterns are further categorized into Object-creational patterns and Class-creational patterns, where Object-creational patterns deal with Object creation and Class-creational patterns deal with Class-instantiation. In greater details, Object-creational patterns defer part of its object creation to another object, while Class-creational patterns defer its object creation to subclasses.[2]
Five well-known design patterns that are parts of creational patterns are the
  • Abstract factory pattern, which provides an interface for creating related or dependent objects without specifying the objects' concrete classes.[3]
  • Builder pattern, which separates the construction of a complex object from its representation so that the same construction process can create different representation.
  • Factory method pattern, which allows a class to defer instantiation to subclasses.[4]
  • Prototype pattern, which specifies the kind of object to create using a prototypical instance, and creates new objects by cloning this prototype.
  • Singleton pattern, which ensures that a class only has one instance, and provides a global point of access to it.[5]

Structural Patterns

  • Adapter pattern: 'adapts' one interface for a class into one that a client expects
    • Adapter pipeline: Use multiple adapters for debugging purposes.[1]
    • Retrofit Interface Pattern:[2][3] An adapter used as a new interface for multiple classes at the same time.
  • Aggregate pattern: a version of the Composite pattern with methods for aggregation of children
  • Bridge pattern: decouple an abstraction from its implementation so that the two can vary independently
    • Tombstone: An intermediate "lookup" object contains the real location of an object.[4]
  • Composite pattern: a tree structure of objects where every object has the same interface
  • Decorator pattern: add additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes
  • Extensibility pattern: aka. Framework - hide complex code behind a simple interface
  • Facade pattern: create a simplified interface of an existing interface to ease usage for common tasks
  • Flyweight pattern: a high quantity of objects share a common properties object to save space
  • Pipes and filters: a chain of processes where the output of each process is the input of the next
  • Private class data pattern: restrict accessor/mutator access
  • Proxy pattern: a class functioning as an interface to another thing

Behavioral Patterns

In software engineeringbehavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
Examples of this type of design pattern include:

Concurrency Patterns

In software engineeringconcurrency patterns are those types of design patterns that deal with the multi-threaded programming paradigm. Examples of this class of patterns include:

Thursday, August 1, 2013

Setting proxy for git and using clone over http:// instead of git://

Many times behind corporate firewalls, the default outbound connection to port

The usual command line for git is
  git clone git://github.com/jcnetdev/yubnub.git

However that will fail. Instead do:
  git clone http://github.com/jcnetdev/yubnub.git

The only other gotcha is that you might need to setup your proxy in your environment. To do this, simply do:

export http_proxy=http://<username>:<password>@<proxy_ip>:<proxy_port>

where:
    username = your network username (someuser)
    password = your network password (somepassword)
    proxy_ip = the ip address of your proxy server (192.168.1.1)
    proxy_port = the port number for the proxy (80)

the full string would look like this:
    export http_proxy=http://someuser:somepassword@192.168.1.1:80