New answers tagged

0

As others have said, you may be misunderstanding SRP. Don't feel bad though, SRP is not well defined. You would be better off just to ignore it and concentrate on other more well-defined principles like Coupling and Cohesion and the Law of Demeter. I'm not really here to comment about that though, but about your design. You say: Clearly it states that it ...


4

In an MVC the Model is not a database. MVC is a pattern to split the concerns and responsibility of the UI, and you can have a UI CRUD build with the MVC pattern without a database. The data could be stored in memory or some backend using REST API calls. The class structure is not redundant with the database because the way you store your data should not be ...


13

Single responsibility ? There is a fundamental misunderstanding about SRP here: The single responsibility does not mean that a class should do only one thing, but that it should have only one reason to change. In other words, it's not the single responsibility OF the class, but the single responsibility FOR the class to change. So it's about decision ...


4

You didn’t understand the Single Responsibility Principle. It means: Do one thing - completely. With everything that is needed to make it work. Like exception handling. Adding another class for exception handling would be utterly ridiculous. A chef cooking a lobster takes a pot, fills it with water, puts it on the oven, turns the heat on, waits until the ...


10

Don't catch exceptions as soon as they are thrown. Catch exceptions at the point you can do something meaningful with them. But your example code shouldn't be throwing there. The only reasonable exception is ArgumentNullException, which you should throw in the constructor. public class BcryptDecrypt { private string _password; private ...


Top 50 recent answers are included