Sorting Algorithm representation with Object Oriented process

As we know from basic of OOP, the main purpose of object oriented programming is to reduce the reusability of code and to use it on every platform using its public, private and protected properties. We have some of these facilities with structure oriented programming, but object oriented shows its real beauty while using same object on different platform.

Here I have made several simple sorting algorithms to represent OOP features and that can be used any platform. This is reducing programmers’ effort and reusability of code. I am writing code here in C#.NET creating some class and object. Just imagine, the same application, if I want to do it online with ASP.NET, should I write the same code again? The answer is obviously “Yes” if you don’t know about Object Oriented Programming. OK, now I will solve the dilemma. We can use the same class on various platforms just updating some basic syntax of the specific language and of course you should make the object to get the access of that class.

This is a combination tutorial of various sorting algorithm and usage of OOP feature.

First of all you have to make the classes of the algorithms. Here we go,

  • A class for insertion sort
  • A class for merge sort
  • A class for quick sort
  • A class for bubble sort

This is GUI for the code and the mainForm behind code is here,

This class is for merge sort. You should access the class by creating an object using specific syntax.

Therefore, if you want to change the platform from windows to webform, just copy the classes and paste it into the mainfile folder of Web Form application. Then right click on project application, then click add, then click existing item. Select the sorting classes. This is the webform of same code:

The code is pretty straight forward, just make objects and create some conditions.

Thank you very much.

The code is here for you :