Search

Application Framework in 12 steps

An application framework is a software library that provides a fundamental structure to support the development of applications for a specific environment. An application framework acts as the skeletal support to build an application. The intention of designing application frameworks is to lessen the general issues faced during the development of applications. This is achieved through the use of code that can be shared across different modules of an application. Application frameworks are used not only in the graphical user interface (GUI) development, but also in other areas like web-based applications.

Application frameworks are not a recently emerged idea. Some of the old application frameworks that are still used today are the SmallTalk user interface framework, MacApp (for Macintosh), and Struts (for Web-based Java applications).

We can start with the interface to define a signature

// Step1: Add namespace & References library
using System;
// Step2: Decalre a namespace
namespace FrameworkNamespace
{
// Step3: Declare the Interface.
public interface Iframework
{
// Step4: Declare functions needs to be in framework
// Usage: declare method <returntype> <methodname>();
void method1 ();
int method2 ();
void method3 ();
}
}

The Abstract calss

namespace FrameworkNamespace
{
// Step5: Declare Abstract class to Implement Interface
public abstract class Aframework :Iframework
{
// Step6: Declare implemented functions as Abstract or define virtual method with body.
// Step7: Implement interface classes as Abstract class
public abstract void method1 ();
public abstract int method2 ();
// Step8: Virtual method Body Defined
public virtual void method3 ()
{
//TODO: Type virtual method body here..
throw new NotImplementedException();
}
}
}

The sealed class

namespace FrameworkNamespace
{
// Step9: Declare Sealed class to prevent inheritance of class & virtual methods any further
// Step10: Inherit the Abstract class
public sealed class MyFramework :Aframework
{
// Step11: Override the Abstract class
public override void method1 ()
{
//TODO: write your code here
throw new NotImplementedException();
}
public override int method2 ()
{
//TODO: write your code here
throw new NotImplementedException();
}
// Step12: Override the Virtual method if needed
public override void method3 ()
{
// Step13: Call the base class virtual method(if needed)
base.method3();
//TODO: write your code here
throw new NotImplementedException();
}
}
}