Hello
Currently, classes do not have a single location in the directory structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
One solution to solve this problem would be to move the classes to a new directory that contains only class files and create a new namespace that points to that directory. The directory can have any name that describes it, like lib, classes, includes or src, but what I usually see in open source projects is the src directory.
Then we can use the namespace PhpMyAdmin, which is already used in SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I would like to hear your opinion on this subject.
Best regards Maurício Meneghini Fauth
On Jun 13, 2017, at 8:35 PM, Maurício Meneghini Fauth mauriciofauth@gmail.com wrote:
Hello
Currently, classes do not have a single location in the directory structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
One solution to solve this problem would be to move the classes to a new directory that contains only class files and create a new namespace that points to that directory. The directory can have any name that describes it, like lib, classes, includes or src, but what I usually see in open source projects is the src directory.
I like this suggestion. It doesn't make a lot of sense to have class files scattered around the entire source tree, especially if it affects the autoloader.
I have a preference to NOT use "src" because that doesn't make much sense to me personally. I tend to think of src as containing a project source code, which isn't very useful in our case since the whole codebase is source code. Most of your other suggestions would be fine by me, I think ./classes or ./libraries/classes make the most sense to me, but I'm open to other ideas.
Then we can use the namespace PhpMyAdmin, which is already used in SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I think this is a good idea.
I would like to hear your opinion on this subject.
Best regards Maurício Meneghini Fauth _______________________________________________ Developers mailing list Developers@phpmyadmin.net https://lists.phpmyadmin.net/mailman/listinfo/developers
Thanks for the feedback, Isaac.
I have a preference for using src, because if we analyze the files present in ./ as index.php, these are "public" files or entry points and should not have any type of logic, and serve only to initialize the application. ./templates and ./themes are for presentation only and should not have any type of system logic. For this reason I like to think of the src as the directory that contains all the system logic.
However, this would not be the case with phpMyAdmin because it is not 100% object oriented and for this reason, we would end up having libraries and src for a long time, which could cause confusion and would not help at all.
Thinking about it, I ended up changing my opinion and I think ./libraries/classes is the best option. And in the future when practically all of the logic is already inside this directory, we can think about restructure again, if necessary.
Maurício Meneghini Fauth
On Thu, Jun 15, 2017 at 9:34 AM, Isaac Bennetch bennetch@gmail.com wrote:
On Jun 13, 2017, at 8:35 PM, Maurício Meneghini Fauth <
mauriciofauth@gmail.com> wrote:
Hello
Currently, classes do not have a single location in the directory
structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
One solution to solve this problem would be to move the classes to a new
directory that contains only class files and create a new namespace that points to that directory.
The directory can have any name that describes it, like lib, classes,
includes or src, but what I usually see in open source projects is the src directory.
I like this suggestion. It doesn't make a lot of sense to have class files scattered around the entire source tree, especially if it affects the autoloader.
I have a preference to NOT use "src" because that doesn't make much sense to me personally. I tend to think of src as containing a project source code, which isn't very useful in our case since the whole codebase is source code. Most of your other suggestions would be fine by me, I think ./classes or ./libraries/classes make the most sense to me, but I'm open to other ideas.
Then we can use the namespace PhpMyAdmin, which is already used in
SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I think this is a good idea.
I would like to hear your opinion on this subject.
Best regards Maurício Meneghini Fauth _______________________________________________ Developers mailing list Developers@phpmyadmin.net https://lists.phpmyadmin.net/mailman/listinfo/developers
Developers mailing list Developers@phpmyadmin.net https://lists.phpmyadmin.net/mailman/listinfo/developers
Hello
Maurício Meneghini Fauth píše v Út 13. 06. 2017 v 21:35 -0300:
Currently, classes do not have a single location in the directory structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
Is this something noticeable or just hypothetic?
One solution to solve this problem would be to move the classes to a new directory that contains only class files and create a new namespace that points to that directory. The directory can have any name that describes it, like lib, classes, includes or src, but what I usually see in open source projects is the src directory.
I don't think src is good fit there, it's good for libraries, but I don't think it makes sense for us. Also we've spent quite some time to educate people to block access to the libraries folder, so I'd stick with that.
Then we can use the namespace PhpMyAdmin, which is already used in SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I was thinking about namespace unification as well, so this certainly makes sense.
How about just registering namespace on the libraries folder (eg. PhpMyAdmin\Core)?
Maurício Meneghini Fauth
On Fri, Jun 16, 2017 at 11:43 AM, Michal Čihař michal@cihar.com wrote:
Hello
Maurício Meneghini Fauth píše v Út 13. 06. 2017 v 21:35 -0300:
Currently, classes do not have a single location in the directory structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
Is this something noticeable or just hypothetic?
It's not something I would worry about, because there are certainly things that hurt performance more than that. I care more about how the files are organized.
One solution to solve this problem would be to move the classes to a new directory that contains only class files and create a new namespace that points to that directory. The directory can have any name that describes it, like lib, classes, includes or src, but what I usually see in open source projects is the src directory.
I don't think src is good fit there, it's good for libraries, but I don't think it makes sense for us. Also we've spent quite some time to educate people to block access to the libraries folder, so I'd stick with that.
As I commented with Isaac, I also think src would not be a good idea at the moment. I prefer libraries/classes.
Then we can use the namespace PhpMyAdmin, which is already used in SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I was thinking about namespace unification as well, so this certainly makes sense.
How about just registering namespace on the libraries folder (eg. PhpMyAdmin\Core)?
I thought about using PhpMyAdmin only on libraries/classes. What do you think?
-- Michal Čihař | https://cihar.com/ | https://weblate.org/
Developers mailing list Developers@phpmyadmin.net https://lists.phpmyadmin.net/mailman/listinfo/developers
I opened a PR that moves some classes to the libraries/classes directory under the PhpMyAdmin namespace.
https://github.com/phpmyadmin/phpmyadmin/pull/13411
Maurício Meneghini Fauth
On Tue, Jun 20, 2017 at 1:28 PM, Maurício Meneghini Fauth < mauriciofauth@gmail.com> wrote:
Maurício Meneghini Fauth
On Fri, Jun 16, 2017 at 11:43 AM, Michal Čihař michal@cihar.com wrote:
Hello
Maurício Meneghini Fauth píše v Út 13. 06. 2017 v 21:35 -0300:
Currently, classes do not have a single location in the directory structure. The class files are mixed with other kinds of files in the libraries directory, and the PMA namespace points to the root path which causes all classes to have a namespace that begins with PMA\libraries. This affects the performance of the autoloader.
Is this something noticeable or just hypothetic?
It's not something I would worry about, because there are certainly things that hurt performance more than that. I care more about how the files are organized.
One solution to solve this problem would be to move the classes to a new directory that contains only class files and create a new namespace that points to that directory. The directory can have any name that describes it, like lib, classes, includes or src, but what I usually see in open source projects is the src directory.
I don't think src is good fit there, it's good for libraries, but I don't think it makes sense for us. Also we've spent quite some time to educate people to block access to the libraries folder, so I'd stick with that.
As I commented with Isaac, I also think src would not be a good idea at the moment. I prefer libraries/classes.
Then we can use the namespace PhpMyAdmin, which is already used in SqlParser, in the src directory, and after all classes are moved to that directory, we remove the PMA namespace.
I was thinking about namespace unification as well, so this certainly makes sense.
How about just registering namespace on the libraries folder (eg. PhpMyAdmin\Core)?
I thought about using PhpMyAdmin only on libraries/classes. What do you think?
-- Michal Čihař | https://cihar.com/ | https://weblate.org/
Developers mailing list Developers@phpmyadmin.net https://lists.phpmyadmin.net/mailman/listinfo/developers