This is a guide to Alien-Factory's IoC and how to use it to create re-usable and injectable services.

IoC provides Inversion Of Control (IOC) via Dependency Injection (DI). It provides a central hub for you to easily define, store and retrieve your service instances. It simplifies application design so much, you'll be wondering how you ever coped without it!

This guide is a collection of articles which serve to incrementally enhance your understanding of const classes, IoC services and how to write & use them in your Fantom application.

  1. 2 Ways to Create an IoC Service

    You now have a const class, and you can change the state it holds - but how do you turn it into an IoC service? This article shows you how to define IoC services in the AppModule class.

  2. How to Inject an IoC Service

    You have an IoC service, great! But how do you inject it into other services!? This article explains the @Inject facet and how to use it to inject services into your classes.

These other articles are not about IoC services per se, but do enhance your understanding of how to use the const keyword and how to create const services that still hold mutable data:

  1. Confused About Const Classes?

    Fantom const classes are the cornerstone of every good IoC service. This article takes a closer look at them, and details techniques of constructing them.

  2. From One Thread to Another...

    Services should be const classes, but const classes can't hold mutable state... or can they? This article takes a simple const class and shows how it can change the data it holds.

Have fun!



Discuss