How do you decide if you need a new non-static class (maybe when you are developing or after it)? The question is two part:
- Why another class?
- Why not an static class?
New static classes and functions or smaller functions within a class could be used to reorganize the program. But what about non-static classes? identifying them is harder.
Non-static classes can generate objects. then the need for some objects of the same class should be a key point and play a role here! (note still I have no idea about what is that class)
It's possible that a person introduce some classes to organize his program and distribute the procedures and variables while just one object of each class is used in the entire project. For example a program which must take dimensions of a rectangle and gives the area can be done in a static class, while a program which must calculates the intersection of some rectangles need Rectangle class as a non-static class.
Does the number of instances play a role here?
For the one who is used to procedural programming how he can think of classes and the necessity for the objects?
Maybe I can start from my variables or data and think how can I group them as objects! Please add more!
Aucun commentaire:
Enregistrer un commentaire