Advantages and disadvantages of phalcon-DependencyInjection dependency injection and automatic loading

Source: Internet
Author: User
I recently read phalcon, which uses the di dependency injection method. But I don't feel it is convenient to set a rule to automatically load it, I want to know the advantages and disadvantages of the two. I recently read phalcon. He uses the di dependency injection method, but I feel that it is not convenient to set a rule to automatically load it, I don't know what you think, but I want to know the advantages and disadvantages of the two.

Reply content:

I recently read phalcon, which uses the di dependency injection method. But I don't feel it is convenient to set a rule to automatically load it, want to know the advantages and disadvantages of the two

The essence of automatic loading is http://php.net/manual/zh/function.spl-autoload-register.php recommendation specification reference http://www.php-fig.org/PSR-0 PSR-4

Di dependency injection reference

  • How PHP programmers understand IoC/DI
  • How PHP programmers understand dependency injection containers)

Ioc is used for decoupling. However, no matter how decoupled, automatic loading is required according to certain rules when loading classes in a project.
Decoupling is used to conveniently Replace the specific implementation of a class at any time. The ioc container facilitates initialization when a service class is used.
Reference Article http://www.yuansir-web.com /? P = 1012 & preview = true
Two are two different things.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.