Tag Archives: Object Oriented Programming

AngularJS – Service VS Factory VS Provider

Design pattern is very important if you want to build a manageable and scalable application. In AngularJS, we could develop module, which is also regarded as a dependency, for specific feature and it could be injected to the controller whenever it is needed. This dependency injection design help us to build clean and well structured application and reduce redundant code.

There are different ways to create the dependency. Most common terms are service, factory and provider which are all singleton and you can find a lot of discussion online about their differences, when and how to use them. Here are some notes which summarize the AngularJS documentation about writing Provider.


1. When a dependency is injected to the controller, the injector from AngularJS framework will register a recipe such that the injected controller could make use of the type provided by the dependency.
Continue reading AngularJS – Service VS Factory VS Provider

Drupal 8 – Create a Hello World custom module in Symfony framework

It’s time to get start with Drupal 8! The biggest change in this major update is that Drupal 8 is now with the Symfony PHP framework. So Drupal developer could work with those components such as ClassLoader, Routing and DependencyInjection which are provided by the Symfony framework.

Ok! Stop talking and start coding~ =D

The following example is a simplified version from the screencast recorded by Joe Shindelar @ Drupalize.Me.
Continue reading Drupal 8 – Create a Hello World custom module in Symfony framework