Search code examples
c#classpartial

The concept of classes is ok if i have a single user application and i work alone at it and just i'll use it?


I make an app in c# with windows forms and all my code is behind the window code, so i have for now 2500+ lines of code and some of my collegues say to use classes to divide the code by functionalities but i don't find a purpose in that because everything will be made public and so on. None of them know to explain me why it is the best approach, but just give me vague hints like : "if you do a modification somewhere your other functions will crash" and i don't know how that is possible... I searched and find a keyword "partial" so what should i do? Should start learning classes and so on?


Solution

  • The main answer for which you should divide your code into classes is code reusability. You could greatly benefit from techniques of object oriented programming such as inheritence, polymorphism and so on.

    Moreover, the time invested in learning Object oriented programming is a time invested in you, and for your greater understanding of different programming languages or frameworks which you may be using in the future.

    Although you could do this project all by yourself and without using any classes, I strongly recommend you to try and learn OOP programming.

    PS: C# is an object oriented programming language, which means that all object and variable type you may be using are classes!