在LOC中应该是标准的PHP代码文件lenth? [英] What should be the standard PHP code file lenth in LOC?

查看:135
本文介绍了在LOC中应该是标准的PHP代码文件lenth?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在公司和个人工作中做了很多PHP编码。通常我的文件会变大,有时会超过2000-3000行。

我的问题:应该是什么(是)PHP代码文件的标准长度行代码



注意:没有面向对象的编程(我不使用类)。






说明不使用课程:




  1. 我经常使用函数。

  2. 我不使用类,因为代码是遗留的。我必须维护它并添加新功能。

  3. 我是一个C程序员。所以,去OO对我来说有点艰难。就像学习全新的做事方式一样。


解决方案



面向对象编程的一个很好的指导原则是将任务和关注分成类,并将这些类拆分成单独的文件。



这是最合乎逻辑的分离,允许使用PHP 5的自动加载。即使你不想进入严重的OOP,基本原则也许值得采用。



相关问题:




I do PHP coding a lot in my company and personal work. Usually my files get bigger, sometimes more than 2000-3000 lines long. Then, they get difficult to manage.

My Question: What should be (is) the standard length of a PHP code file in terms of lines-of-code. At what length do you guys split it up?

Note: No Object Oriented programming (I don't use classes). Please answer accordingly.


Clarification of not using classes:

  1. I do use functions a lot.
  2. I don't use classes because the code is legacy. I have to maintain that and add new features.
  3. I was a C programmer before. So, going OO is somewhat tough for me. Like learning whole new way of doing things.

解决方案

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

A good guiding principle from Object Oriented Programming is separating tasks and concerns into classes, and splitting those classes into separate files.

That is the most logical separation, and allows using PHP 5's Autoloading. The basic principles may be worth adopting even if you don't want to get into serious OOP.

Related questions:

这篇关于在LOC中应该是标准的PHP代码文件lenth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆