What should be a standard PHP code file in LOC?

I often program PHP in my company and in my personal work. Usually my files get bigger, sometimes more than 2000-3000 lines. Then it becomes difficult to manage.

My question is . What should be (is) the standard length of the PHP code file in terms of lines of code. How long have you guys divided it?

Note. There is no object oriented programming (I do not use classes). Please respond accordingly.


Refinement of unused classes:

  • I use functions a lot.
  • I do not use classes because the code is deprecated. I have to support this and add new features.
  • I used to be a C programmer. So, switching to OO is a bit difficult for me. Like learning a whole new way of doing things.
+2
source share
5 answers

There is no good standard length. Some files get bigger, some smaller.

A good guiding principle for object-oriented programming is the separation of tasks and tasks into classes and the separation of these classes into separate files.

This is the most logical separation and allows you to use PHP 5 Startup . The basic principles may be appropriate even if you do not want to get into a serious OOP.

Related questions:

+3
source

, . , , , , (, , ), , , , . , , .

+3

, .

, PHP 1000 .

+2

OO. , - " ", , , , ( , )

+1

, . , .

, IDE - Netbeans, . , , ( ).

On the other hand, if you have code files with a length of several thousand lines that consist of one function, then yes, the chances that it will be very difficult, no amount of IDE skills will help.

+1
source

Source: https://habr.com/ru/post/1788245/


All Articles