Chapter 2. Creating services
This chapter covers
- Instantiating service objects
- Injecting and validating dependencies and configuration values
- Promoting optional constructor arguments to required ones
- Making implicit dependencies explicit
- Designing services to be immutable
In the following two chapters, we’ll discuss different types of objects and the guidelines for instantiating them. Roughly speaking, there are two types of objects, and they both come with different rules. In this chapter we’ll consider the first type of objects: services. The creation of other objects will be the topic of chapter 3.
2.1. Two types of objects
In an application there will typically be two types of objects:
- Service objects that either perform a task or return ...
Get Object Design Style Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.