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.
- 2 Ways to Create an IoC Service
You now have a
constclass, 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
- 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
@Injectfacet 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:
- Confused About Const Classes?
constclasses are the cornerstone of every good IoC service. This article takes a closer look at them, and details techniques of constructing them.
- From One Thread to Another...
Services should be
constclasses can't hold mutable state... or can they? This article takes a simple
constclass and shows how it can change the data it holds.