Pages

Saturday, December 28, 2013

The Composite Design Pattern In Fortran

The Composite design pattern is a structural design pattern which is used to group the objects of same type together and create hierarchies of objects. As an example consider a factory where "Manager" is an "Employee" but also has subordinates which are "List<Employee>" and in this way a tree structure for a group of "Employee" is created.

As an example following is an implementation in Fortran:

Github - Fortran implementation of Composite pattern
Fork

Friday, December 27, 2013

Bridge Design Pattern in Fortran

Bridge pattern is used to separate an implementation from its abstraction so that both may vary without any dependancy upon other. Due to this decoupling, the bridge pattern is classified as a structural pattern. All that is needed is to create an interface to act as a bridge to make the functionality of concrete classes independent of interface implementer.

Following is an example in Fortran:

GitHub - Bridge Pattern
Fork

Thursday, December 26, 2013

Adapter Pattern Implementation in Fortran

Sometimes the classes that need to work together do not have compatible interfaces. In that case, to make the two classes talk to each other, Adapter pattern is implemented. This pattern is a structural pattern as it combines the capabilities of two different interfaces. Think of it as a dvd player which acts as an adapter between the dvd and the television.

Following is an implementation in Fortran.

Github - Adapter Pattern
Fork

Wednesday, December 25, 2013

Prototype Design Pattern Implementation in Fortran

Although the modern systems have lots of computing power, there are some operations which still become a bottleneck. Disk I/O and database access being few of them. Prototype design pattern is a creational pattern which is used to duplicate/clone objects keeping performance in mind. For example, a system where disk I/O is expensive can reference the same pointer when creating different objects of the same class.

Following is an implementation of the pattern using Fortran:

Github - Prototype Pattern
Fork

Tuesday, December 24, 2013

Builder Pattern Implementation in Fortran

Builder pattern is one of the most widely used and useful design pattern. The idea is to separate creation logic from the class so as to provide better encapsulation and make an object immutable for the client. This is a creational pattern because it facilitates the object creation logic.

Following is an implementation of builder in Fortran:

GitHub - Builder Pattern

Fork

Monday, December 23, 2013

Singleton Pattern Implementation in Fortran

In software systems, there is usually a need for class with just one instance. This need arises when there are resources that are globally shared. Singleton design pattern is a creational design pattern facilitating the creation of one and only one instance of a class. It is one of the simplest design patterns yet it is the most famous and as some may claim, most useful.

Following link has an implementation of Singleton pattern using Fortran programming language.

GitHub - Single Pattern using Fortran
Fork

Sunday, December 22, 2013

Abstract Factory Design Pattern Implementation Using Fortran

An abstract factory is the factory of factories. It is a class which acts as a kind of super-factory.  The abstract factory can return factories of objects without specifying specific classes. Each factory object can produce objects using the factory pattern.

Following is an implementation of abstract factory pattern using Fortran.

GitHub - Abstract Factory using Fortran
Fork