Comments (1)
Thanks for your feedback @nikoschon
The technique I am using for Dependency Injection does indeed come from Functional Programming and it is usually called "Partial Application" or a "Partially Applied Function".
"Partial application is the act of applying some, but not all, of the arguments to a function and returning a new function awaiting the rest of the arguments."
Kyle Shevlin in Just Enough FP: Partial Application
Using it with a class is basically the same because, as you pointed out, classes in JavaScript are just another kind of function.
If you want an approach to Dependency Injection that is more reminiscent of what you might see in Java, you can use a popular JavaScript DI Library like inversify.
Hope that helps.
from comments-api.
Related Issues (20)
- Design patterns HOT 1
- authentication and authorization HOT 2
- race condition HOT 1
- How should I include Transactions, without breaking this source code architecture? HOT 3
- can one use case be dependent on another usecase. HOT 2
- Content Moderator Timeout Issue HOT 1
- Concurrent database writes HOT 5
- Typo in src/index.js: app.put instead of app.patch HOT 2
- How to support api error codes and subcodes HOT 1
- What's the point HOT 2
- Implment Abstracts for model and collection HOT 1
- Validation in entity HOT 3
- Classes vs. factory functions? HOT 3
- How should the add-comment use-case be if using classes in js? HOT 2
- VS Code debugging HOT 2
- .env variable undefined at the time of running data-access module HOT 1
- sampledotenv needs "DM_API_ROOT" HOT 3
- Why you use IIFE in db access file ? HOT 1
- Is Id considered to be in the framework layer?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comments-api.