One long class or many shorter classes?

后端 未结 6 1097
醉梦人生
醉梦人生 2021-02-19 03:01

In PHP, is there any performance impact on using one long class with a lot of functions in it? Or is it advisable to use many small classes and call them separately when needed?

6条回答
  •  忘了有多久
    2021-02-19 03:50

    You can and should put things in the same class as long they are directly related to the logic of the class you're creating. Size of the class doesn't mean a lot if you follow the OOP concepts.

提交回复
热议问题