Convert static namespace components to classes #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Whereas before the pattern was:
The pattern is now:
This allows for the possibility of building a proper object graph. See the implementation comment for App.init() for further explanation.
I thought to do this after realizing that modeling everything with static functions might not suggest the most scalable architecture. While this example doesn't contain any components that need any state, I wanted to model more closely what a stateful component graph might look like.
I thought about doing the same to components/request.js, but I see the functions in that model as being quite good composable building blocks. I'd like them to stand alone as an illustrative example.
What I will do in the next commit is create a new Backend abstraction which uses the request.js functions. It will also allow for requesting a response from a "Backend" implementation in the App itself. This will enable this project to serve as a JavaScript environment for the same String Calculator kata.
The user can then switch between the in-App implementation of the String Calculator logic and the Tomcat backend. It will also show how the frontend can run and be independently developed using a local stub implementation independently from the production backend.