Angular is a controversial framework among developers that either loved or hated, with its fancy features and modern approaches to building web applications. One of the core features that stands out is dependency injection.
You might wonder, “What on Earth is that?”. Well it is actually come from one of the fundamentals of the Object Oriented Programming called Dependency Inversion. You might quick search on google to cover because in this post we are not going to. I would like to focus on the Angular as much as possible to not bore you 🙂
Dependency injection, the magical power in Angular that I like most, is a technique that allows a class to receive its dependencies from an external source. The result? A clean and modular codebase, easier testing, and improved reusability.
Some might argue that dependency injection is just another “unnecessary complexity” of Angular. Most of ex react developers finds that Angular is overloaded with of tons features and they have valid points for sure. Angular is a large framework while react is just a vanilla library. They have different concerns overall.
Dependency Injection is one of the features that you would possibly like most. We can develop a frontend application just the way we did with the backend applications. When the frontend technologies evolved over the years, frontend applications became more larger and complex than it used to be. In order to avoid the complexity and provide more clean and robust systems we need such features which we were using for a very long time on backend applications.
Of course these are my ideas and one other may think differently then I do. There I would like to demonstrate some pitfalls and misconceptions that developers face when using it in Angular
In summary, DI in Angular helps make code more modular, testable, and maintainable, but it can also introduce complexity and a learning curve for those new to the concept. It might be look a bit complex in the beginning but when you understand it and start to using it I bet you gonna love it. It is among the best features angular provides and very reason that I choose angular over other frontend frameworks. If you are interested in I share some links below so you can dig more and get to know more about Dependency Injection.
For examples you can also read the following post from angular guide!
Herkese Merhabalar. Bildiğiniz üzere bu ay Angular 17 yepyeni bir imaj çalışması ile birlikte yayına…
Herkese merhaba arkadaşlar. Önceki yazımızda openlayers nedir ve neden kullanmalıyız sorunu yanıtlamıştık. Popüler harita kütüphanelerinden…
Merhaba arkadaşlar. Eğer CBS (Coğrafi Bilgi Sistemleri) dünyasına yeni yeni adımlar atıyorsanız adını sık sık…
Herkese merhabalar. Bugün angular ekosisteminde NGXS kullanarak nasıl state management yapacağımızı inceleyeceğiz. Angular state management…
Herkese Merhaba. Bu yazımızda frontend camiasında faaliyet gösteren herkesin aklındaki o soruya bir açıklık getireceğiz.…
Uzun bir aradan sonra herkese merhaba :) Angular Template Driven Form Nedir, Ne işe yarar…