Reading Order: I defined what I expected to see first in this file, then opened it up. I expected to see the most important thing, which is the main logic first, and that logic is defined by the app function. That function is currently buried at the bottom of this file, so I pulled it to the top of the file for ease of reading.
Cohesion Order: I also noticed that the function instances should logically sit together when the IoC container is created, which is when the register method is called. Initially, the instances function was at the top of the file, it's moved to the bottom of the file for cohesion.
This pull request demonstrates an example application of Reading Order and Cohesion Order
Reading Order: I defined what I expected to see first in this file, then opened it up. I expected to see the most important thing, which is the main logic first, and that logic is defined by the
app
function. That function is currently buried at the bottom of this file, so I pulled it to the top of the file for ease of reading.Cohesion Order: I also noticed that the function
instances
should logically sit together when the IoC container is created, which is when theregister
method is called. Initially, theinstances
function was at the top of the file, it's moved to the bottom of the file for cohesion.