I'm learning Magento 2 and couldn't able to understand some of the below things

  1. Dependency Injection
  2. Javascript bundling (Because some suggest to enable and some don't)
  3. Third party module override

Could anyone please guide me with practical example for these?


1 Answer 1


Dependency Injection Dependency Injection is a design pattern that allows an object A to declare its dependencies to an external object B that supplies those dependencies. The dependencies declared by A are usually class interfaces and the dependencies B provides are the concrete implementations for those interfaces.

This allows for loose coupling of code because object A no longer needs to be concerned with initializing its own dependencies. Object B decides which implementations to provide to object A based on a configuration or desired behavior.

JS bundling

Javascript bundling is a technique that groups separate files in order to reduce the number of HTTP requests that are required to load a page. Bundling is commonly used in today’s “module-based” development where some functionalities are basically split into Modules. This is an important concept to understand for extension developers because it forms the basis of how Magento composes its classes.

  • Thanks, I already read these from devdocs and couldn't understand. Could you please explain these with real-time examples.
    – Siva
    May 14, 2019 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.