Why use metaprogramming here?
Based on what we learned in Chapter 8, we should use metaprogramming only after trying to implement our solution without using any metaprogramming. We spent Chapter 1 to Chapter 7 learning how to build a web framework without metaprogramming, so now it’s a good time to consider whether or not we should use it.
Here are the reasons why we should use metaprogramming for Goldcrest
:
- We will be building DSLs that will be used in multiple places, by multiple controllers that use
Goldcrest
. This will allow us to standardize how controllers and views behave inGoldcrest
. - We have a clear set of requirements that we don’t anticipate changing very often. This allows us to build a stable DSL for the
Goldcrest
controllers and views. - Our implementation without a DSL is too complex to read when developers just need to make simple changes to define a controller. That’s a clear indication that this is a great candidate to build a...