Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You'd be lucky if it was all just a chain of methods. In reality one of those links would be replaced by space. Which is an implicit method call. (Invisible parenthesis)

I find this infuriating because the DSL isn't discoverable. You have to know what each method returns. Is it self, or is it a value.

Spot the difference: Expect(myFunc).WithParams(4).To BeCalled(1).Returns(8).InUnder(2). Milliseconds().WithEspilon(30).Microseconds().



Why isn't it discoverable? You know what type is returned by "To()" and if that has a BeCalled() method you can call it :)

Now, the problem that requires an IDE, that many curse Scala for comes in when you have implicit things. So even if "To()" returns a WhateverTestDslElement that might not tell you anything because there might be a hundred implicit functions that convert WhateverTestDslElement to OtherFancyDslThingWithTheMethodYouAreLookingFor.

Of course, at this point you are basically back to reading the documentation, which is kind of what C programming looks like.

That said efficient and useful and really "domain specific" layers are great, and many systems would benefit from one. (Which is sort of what the whole clean code "entities" is about - https://blog.cleancoder.com/uncle-bob/images/2012-08-13-the-... )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: