Is it permissible to distribute the functions of the PHP library solely for changing names?

I am going to launch a rather large PHP application this summer, on which I will be the only developer (therefore, I do not have any coding conventions to fit my own).

PHP 5.3 is a decent IMO language, despite the dumb namespace token. But one thing that has always bothered me about this is the standard library and its lack of naming conventions.

So, I'm curious, would it be seriously bad practice to wrap some of the most common standard library functions in my own functions / classes to make names a little better? I believe that in some cases it can also add or change some functions, although at the moment I have no examples (I believe that I will find ways to make them OO or make them work a little differently while I work).

If you noticed that the PHP developer did this, you would think: "Man, is this one crappy developer?"

Also, I don’t know much (or anything else) about how and how PHP is optimized, and I know that usually PHP performace does not matter. But did something like this affect the performance of my application?

+3
source share
4 answers

Now you can be the only developer, but will anyone else take this code? If this is the case, you really should adhere to mostly standard library names if you are doing nothing but just wrapping the call.

I worked with code where the author wrapped up such calls, and it really hurts the ability to quickly understand the code

If you noticed that the PHP developer did this, you would think: "Man, is this one crappy developer?"

Well, no ... but I would have thought: “Damn ... I have to find out this new standard for naming guys who, although well intentioned, will find time for me”

+6
source

I assume that you are referring not only to naming conventions, but also to a fun mix of orders function (needle, haystack)and function(haystack, needle).

. , , , . , array_push, MyArrayFunctions::push, , , , .

, , , . , IDE, , .

, , , Array, push(), pop(), array_this() array_that() . , .

+4

, . PHP, .

- , . PHP, ( ). .

+2

, OOP, , , , , , .

If you really need to do this, make sure you comment it with phpdoc so that people can see the correct syntax in autocompleting their IDE.

0
source

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


All Articles