Is returning a Task violating the CQS-principle?

Is returning a Task violating the CQS-principle?

By : Meichen Lu
Date : November 21 2020, 09:01 AM
I hope this helps . At the level of considering what you want to know (a query) or do (a command) then Task gives you data and hence is correct for a query and Task does not and hence is correct for a command. ("return void" is the language-specific way for some langauges to express "do not return data").
At the level below that, in which you are considering the mechanism by which asynchronous operations are managed, then you always want to have information about the state of the asynchronous operation and so always want some sort of task object. That is not the level to consider command-query separation.
code :

Share : facebook icon twitter icon
is this Service layer violating SRP principle

is this Service layer violating SRP principle

By : Lucas Braga
Date : March 29 2020, 07:55 AM
should help you out You have AuthorDAO which is the class that should be doing all interactions with the persistence layer, ex. a database.
It isn't obvious in your example because your AuthorEntityLoadService has similar methods which just delegate to the DAO layer.
how to implement movable overloads without violating the DRY principle in C++?

how to implement movable overloads without violating the DRY principle in C++?

By : COLblindOR
Date : March 29 2020, 07:55 AM
I wish did fix the issue. A better alternative would be to just delete the rvalue-qualified operator* completely and have just the one operator*, this one:
code :
    matrix_2_2 operator*(const matrix_2_2& m) const;
matrix_2_2 operator*(matrix_2_2&& m) &&
    matrix_2_2 res;
    return std::move(res);
matrix_2_2 product = some_matrix() * some_other_matrix();
Single Responsibility Principle Violating

Single Responsibility Principle Violating

By : fe.fallace
Date : March 29 2020, 07:55 AM
Hope this helps It sounds like what you are concerned about is not really the SRP, but more about how to organize code. It looks like you are organizing like methods together, which is a fine way of code organization. If CalculateAvailableAmount and Distribute are logically or functionally connected, then it looks to me. Yes, the OOP paradigm often calls for organizing methods based on what data that they operate on, but organizing by logic or function is valid as well (though it might not be OOP).
The Single Responsibility Principle is a very nebulous, philosophical principle. Many people struggle with deciding on how granular or coarse a single method/class/module should be. The following is just by own thoughts on it, and it is by no means an exact definition, because no exact definition exists.
Not exposing IQueryable and not violating OC principle

Not exposing IQueryable and not violating OC principle

By : Natalia Olivares
Date : March 29 2020, 07:55 AM
Any of those help A repository is an abstraction over your Data Access Layer (DAL). In Java, they are also known as DAOs (Data Access Objects). So, exposing IQueryable in a repository is bad practice because of this reason, you are tying LINQ queries to the client code.
So, to fix it you should create an object which would follow the command pattern with all the filtering options you support. Then return a List or any sorted collection you want to use (maybe IList is more appropriate).
code :
class BookFilter
    public string NameStartsWith { get; set; }
    public string ISBN { get; set; }
    public DateTime PublishedAfter { get; set; }
    // ....

public interface IBookRepository  
    IList<Book> Filter(BookFilter filter);
Is this constructor violating the Single Responsibility Principle?

Is this constructor violating the Single Responsibility Principle?

Date : March 29 2020, 07:55 AM
may help you . The dictionary here is almost a primitive type; Its used to store key value pairs, and nothing else(?). I can't see you ever needing to swap it out for a different implementation, which is where IOC would be useful. The writer makes more sense being IOC'd (which you did): I can see a need to output as xml later, or as a string, etc.
On the "too many responsibilites" side. From your sentence describing what this class does, 1) detects special attributes, 2) renders some js. There could be potential for splitting here. What if this class just detected the properties and returned those detected properties in a C# object. Then some other class, JavascriptRenderer maybe, could take in those properties and translate to javascript.
code :
var pi = JavascriptPropertyInitializer(containerObject, javscriptObjectName);
var r = JavascriptRenderer(writer);
var output = r.Render(pi.DetectAttributes());
Related Posts Related Posts :
  • C# Local variables
  • How can I merge the results of a group by Linq-to-XML query?
  • How to add Report in ASP.NET Project
  • C# How to display all instances of a loop in a label?
  • C# subscribe a function to System.Action that is subscribed to another System.Action: why does order matter?
  • Is there any negative effect to setting SqlCommand's CommandTimeout to a high value?
  • C# - TreeView Context Menu Out of Place when using keyboard
  • How to read stored procedure output and return it as list
  • How do you maintain changes made by VisualState triggers after setting another VisualState?
  • Should I be unit testing my bootstrapper and if so how?
  • using .SingleOrDefault() inside .Where() will raise the following exception:- System.NotSupportedException was unhandled
  • C# How would I fill a Form1 Parameter in the same seperate class
  • Access gridview row's data from LinkButton inside that row
  • Translating excel function to c# Math.pow not resulting in same values
  • Arranging Ten Inputted Numbers into Ascending and Descending order
  • AsEnumerable and Query Syntax
  • How can I defensively code against randomly referencing "Table 0" and null values?
  • Changing xaml code position based on screen size
  • Castle Windsor resolve ienumerable and name
  • Drawing multiple sprites with a for loop xna 4.0
  • For loop to Populate Textblocks
  • Visual Studio 2015: Create an Empty Project
  • What are .NET classes to replace the old MSXML2.ServerXMLHTTP?
  • Handle leak in .Net threads
  • Excel add-in ribbon click events bubbling
  • validation rule needed for only numbers to be entered
  • Parsing complex XML, no descendent elements exists when selecting a named element
  • Web Api - IEnumerable with complex type as param is null
  • Email address input validation
  • .Net AND operator Regular Expression using strings in a document
  • Windows phone 8.1 POST x-www-form-urlencoded not working
  • Is there any way to make my C# XMLManager work?
  • ASP.NET 5 Console Application (package) - How to create DBContext from connection string?
  • How to use form's function in other class C#
  • WPF Zebra EPL2 Printing issue
  • C# use reflection to capture exception throw
  • Convert strings in DataRow to double
  • Xml-Serialization is not working
  • HTML Agility Pack can't find classes with trailing spaces
  • ComputeHash Calls Inexplicably Differ
  • Creating an array that holds both integers and datetime C#
  • GroupBy multiple columns in Linq with Take()
  • Rename multiple symbols at once? (using Roslyn)
  • Cast lambda in delegate
  • DataContractSerializer using default properties
  • LINQ Query Sum in recordset
  • change left-hand boolean value to be opposite of the right hand value
  • Get node from XmlDocument using xpath
  • Why does a Control's BeginInvoke() target delegate never occur after Dispose() is called on the Control?
  • A pattern for returning an object created by multiple repositories
  • Change Tracking in Excel
  • MVC5 Compilation Bug
  • where I need to set my await compared to the code
  • How to make the transition from "traditional" to reactive MVVM
  • Exception when calling RDORecipients.AddMultiple(ref Array, object) in Redemption
  • Switch a Task<T> where T is an enum
  • c# neo4j cypher use regular exp
  • Calling a method from a LINQ select
  • LINQ Specified Cast is Not Valid with a ushort Table Column
  • Why does ReSharper recommend the removal of its own fix?
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co