Search code examples
node.jsarchitecturedomain-driven-designclean-architecture

About Uncle Bob's clean architecture inversion of dependencies and Node.js


I'm currently reading Uncle Bob's "Clean Architecture" book. So far it's an amazing book with lots of learning for me but there is something i'm failing to grasp.

How relevant is the inversion of dependency to scripting languages like Node.js

From my undestanding, inversion of dependencies, allows for the changes in lower level code to have no impact on the higher level code so long that the interface is kept. This in turns allow for module to be deployed without having to recompile the whole application.

But in Node.js, whether I import my database implementation module or an interface of it in my application layer, if my database schema changes, for example, then I would still have to change that database implementation module file and re-deploy the whole application.

Am I missing something?


Solution

  • What I meant is that in a compiled language you might just compile a DLL or .jar file and just deploy that.

    That being said I realise now that, actually, this is unrelated to the language but more related to the deployment method.

    Although I've never seen it, it is actually possible to deploy just a specific module even in JS so long as the interfaces are respected.

    Also, I've realised the other benefits that interfaces provide to code maintainability which, even if that was the only benefit, would be justifying the use of it.

    I will mark this thread as answered as I answered my own question, Thanks.