Live data from Hacker News

Adonis.js v2 released – Laravel for Node.js

adonisjs.com

1–10 of 28 posts

Re: Adonis.js v2 released – Laravel for Node.js

#6

According to who/what? I've never heard of this framework, but a quick glance at the source and I find it hard to believe it comes close to Laravel's features. I guess it's the week to post about Node.js MVC frameworks with the whole Sails/Trails thing

I'm not sure what you're looking at... but it does resemble laravel quite a bit to me.. the way relations are setup is almost identical laravel: public function resources(){ return $this->belongsToMany('App\Resource'); }

Adonis: posts () { return this.hasMany('App/Model/Post') }

The routes/middleware page seems even closer to laravel 5's, that's all I've looked through so far, but it does look interesting at least as far as frameworks go, though I'd wait a bit before putting anything into production on it, till it gains some more momentum.

Re: Adonis.js v2 released – Laravel for Node.js

#7
This is sorta tangentially related...

I used to think DI was a good idea, but as I've gotten more experience... I'm no longer convinced using a DI framework nets you huge wins relative to the added complexity. My hypothesis is that good design can remove the need for a DI framework in many cases, or at least that's been my experience so far. Maybe I just haven't worked in an application that's big and complicated enough to justify a DI framework.

Don't get me wrong, there's usually going to a few moving parts you'll wanna inject, in order to make testing easier. But you can just... do it manually.

Perhaps I'm wrong about this, but I get the impression DI tends to encourage people to obsess over unit testing and abuse mocks. While I certainly believe that unit tests add a lot of value, there's definitely a point where they start to add little to no value.

Anyway, with that being said... The framework looks very interesting. I love looking through frameworks like these and seeing how people decide to tackle certain problems.

Thank you for sharing!

Re: Adonis.js v2 released – Laravel for Node.js

#8

According to who/what? I've never heard of this framework, but a quick glance at the source and I find it hard to believe it comes close to Laravel's features. I guess it's the week to post about Node.js MVC frameworks with the whole Sails/Trails thing

I'm not sure what you're looking at... but it does resemble laravel quite a bit to me.. the way relations are setup is almost identical laravel: public function resources(){ return $this->belongsToMany('App\Resource'); } Adonis: posts () { return this.hasMany('App/Model/Post') } The routes/middleware page seems even closer to laravel 5's, that's all I've looked through so far, but it does look interesting at least as…

i mean, these features resemble basically every MVC ever

Re: Adonis.js v2 released – Laravel for Node.js

#9

This is sorta tangentially related... I used to think DI was a good idea, but as I've gotten more experience... I'm no longer convinced using a DI framework nets you huge wins relative to the added complexity. My hypothesis is that good design can remove the need for a DI framework in many cases, or at least that's been my experience so far. Maybe I just haven't worked in an application that's big and complicated eno…

Agree. Especially in a language like Javascript. For testing -

  var myLib;
  if(process.env.NODE_ENV === "test") {
    myLib = require("../test/my_test_lib")
  } else {
    myLib = require("./my_lib")
  }
or similar (you can obviously tighten this code up, too; I'm just being very explicit). Tada, you're injecting your test stubs in place of the real library when running in test.

For the actual production use that a DI framework gives you, you can do similar, or manually set things up, or create a layer of indirection yourself, that only applies where you need it (say an IIFE that has the logic to determine which implementation to pull in, and return that function/module as appropriate).

But this is, as you say, largely tangential.

Re: Adonis.js v2 released – Laravel for Node.js

#10

This is sorta tangentially related... I used to think DI was a good idea, but as I've gotten more experience... I'm no longer convinced using a DI framework nets you huge wins relative to the added complexity. My hypothesis is that good design can remove the need for a DI framework in many cases, or at least that's been my experience so far. Maybe I just haven't worked in an application that's big and complicated eno…

Agree. Especially in a language like Javascript. For testing - var myLib; if(process.env.NODE_ENV === "test") { myLib = require("../test/my_test_lib") } else { myLib = require("./my_lib") } or similar (you can obviously tighten this code up, too; I'm just being very explicit). Tada, you're injecting your test stubs in place of the real library when running in test. For the actual production use that a DI framework gi…

There's also stuff like rewire [0], which lets you change required values inside modules. Although every time I've tried it, I found it created more problems than it was solving.

[0] https://www.npmjs.com/package/rewire

Post reply on HN