Pages

Sunday, December 22, 2013

Factory Design Pattern Implemention Using Fortran

Fortran 2003 opened a new dimension of Object Oriented Programming (OOP) in the world of Fortran. Used widely by scientific community, the usage of Fortran is still limited to the Structured Programming approach. The resulting code is long list of jumbled up uncommented methods and variables which make it very difficult to read. Adapting OOP best practices can change this.

OOP provides better encapsulation, abstraction, composition and reusability for the code. Design Patterns go one step further. These are best practices adapted by the community for solving certain kind of problems. Depending on the task, these patterns can be behavioural, structural or creational. Factory pattern is classified as creational pattern.



Factory pattern provides one of the best ways to create objects which comply with the same interface. In this pattern, the creational logic is not exposed to the client. Rather a singular interface is provided and the client gets the object using this interface by specifying the kind of object it is demanding.

Following is an implementation of Factory pattern in Fortran.

https://github.com/FactoryPattern
Fork

Reuse & enjoy!

No comments:

Post a Comment