Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert static namespace components to classes #56

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Conversation

mbland
Copy link
Owner

@mbland mbland commented Dec 17, 2023

Whereas before the pattern was:

  StaticNamespace.init(params)

The pattern is now:

  const c = new ComponentClass()
  c.init(params)

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.

Whereas before the pattern was:

  StaticNamespace.init(params)

The pattern is now:

  const c = new ComponentClass()
  c.init(params)

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.
@mbland mbland self-assigned this Dec 17, 2023
@mbland mbland merged commit 6f930c3 into main Dec 17, 2023
3 checks passed
@mbland mbland deleted the objectify-components branch December 17, 2023 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant