Answer by Filip Milovanović for Difference between Resolvers and Controllers?
Disclaimer: this is based on what I've read, not on direct personal experience with GraphQL.It looks like the term "resolver" is associated with GraphQL (at least in the context of your question),...
View ArticleAnswer by Filip Milovanović for The notion of configurable strategies
"As you can see above, each Strategy is optionally configurable through its constructor."This is perfectly fine/normal, and is in fact one of the cornerstones that makes polymorphic types flexible: you...
View ArticleAnswer by Filip Milovanović for Should an optional boolean function argument...
I agree that you should go with what makes more sense semantically, but I also find that, when the boolean argument is optional, the thing that fairly often makes more sense when omitting it is for it...
View ArticleAnswer by Filip Milovanović for Is it okay for an Interface Adapter /...
The More General Part of the AnswerI'm going to answer the question you stated in your closing line, but there's a caveat - see below.Is this okay? Considering the Interface-Adapter and Gateway are...
View ArticleAnswer by Filip Milovanović for Which Clean Architecture Areas do Gateways...
Without seeing more code than what you provided in your Typescript example, it's impossible to be 100% certain, but I'd wager that the following is roughly correct (if not, just mentally shift it by...
View ArticleAnswer by Filip Milovanović for Tests of 1-Dependency VS Tests of 0-Dependency
"why are "unit tests" considered so important when they don't reallytest your application"Perhaps an analogy will help; an isolated unit test is like SpaceX engineers testing one of their Raptor...
View ArticleAnswer by Filip Milovanović for How can I achieve polymorphism if MVC logic...
Context: From some of your comments, it seems like you're dealing with what's basically a desktop application running on JavaScript, so this is mostly written in that light (that is, the scenario is...
View ArticleAnswer by Filip Milovanović for What is the relationship between variance,...
"In a general sense, covariance is achieved when the direction ofassignment compatibility is preserved. Contravariance is achieved whenthe direction of assignment compatibility is reversed."You omitted...
View ArticleAnswer by Filip Milovanović for Liskov Substitution Principle Edge Case
A class doesn't violate LSP by merely having an extra method. The behaviors that LSP talks about are not methods, but rules and relationsips and constraints that the class is meant to follow/enforce as...
View ArticleAnswer by Filip Milovanović for In Clean Architecture, how do we name...
Here are a couple of guidelines:1. Don't use the UseCase suffix. UseCase, within Clean Architecture, is more of a role that a piece of code has within the system. While it might be helpful at first to...
View ArticleAnswer by Filip Milovanović for Is this really loosely coupled?
My guess is that the idea here is for client code to use service-specific interfaces (like your IProductService), that decouple them from the service implementations.If so, the intended dependency...
View ArticleAnswer by Filip Milovanović for Unit Testing - should / how should I write...
Regarding call verification - test doubles/mocks that check if a method was called (at all, or with certain parameters, etc.) are called Spies. See this article on different kinds of test doubles...
View ArticleAnswer by Filip Milovanović for ECMAScript Primitives: Immutability vs Value...
"You could just say that primitives are stored directly in a variable.Such a value could never take any effect on other variables"That's not true. This is where the metaphor that describes a variable...
View ArticleAnswer by Filip Milovanović for Should edge cases be part of one test, or...
I'll give you an overview of what tests should look like, but note that it might not be easy to achieve this without having a certain level of experience, and that it may be better to think of this as...
View ArticleAnswer by Filip Milovanović for What is the responsibility of a typed...
Ideally, the models (data structures or proper objects) exposed by the application layer interface, as well as the methods on the interface, would not be defined by the external API specification....
View ArticleAnswer by Filip Milovanović for How do you decompose big object for testing?
What you want to do is test the contract between the two objects.One set of unit tests checks the behavior of the sub-object in isolation. This set of tests is essentially a representation of various...
View ArticleAnswer by Filip Milovanović for Message Dispatching: If, Visitor, or...
I should be able to add new types of messages AND/OR new types of handlers without affecting the existing messages or handlers (i.e., loose coupling).So, what you might be running into here is known in...
View ArticleAnswer by Filip Milovanović for Clean Arch: Where to put HTTP request inputs...
From what i understand of the clean arch., I/Os from the "outside" should be handled by the presentation layer.. but because the presenter has to be called after the service it has no chances to take...
View ArticleAnswer by Filip Milovanović for Visitor Pattern: what's the point of the...
But I really don't see the point of that accept call. If you've got the visitor and the objects to be visited, why not just pass these objects directly to the visitor and avoid the...
View ArticleAnswer by Filip Milovanović for Does the Visitor Pattern necessitate...
I have a class hierarchy of elements (more static) with differentoperations on them in another class hierarchy (more flexible). ... Idecided to use the Double Dispatch technique:elem.do(operationObj) {...
View Article