1,853 reputation
69
bio website facebook.com/michel.henrich
location Brazil
age 23
visits member for 2 years, 8 months
seen 1 hour ago

Dec
17
comment Why use a enum to create the singleton pattern
stackoverflow.com/questions/70689/…
Dec
15
awarded  Good Answer
Dec
13
comment Why public access level method get overridden in java?
Besides, even if you could only override protected methods, you could still break LSP, after all, private/protected methods are going to be used by the public ones.
Dec
13
comment Why public access level method get overridden in java?
Looks like this "product owner" would benefit from employing real professionals instead of trying to defend the code base from amateurs who don't follow simple principles of good software design. :)
Dec
13
revised Why public access level method get overridden in java?
added 55 characters in body
Dec
13
answered Why public access level method get overridden in java?
Dec
11
awarded  Guru
Dec
10
awarded  Nice Answer
Dec
10
comment Interfaces between multiple projects
When I mentioned the "third project", I really meant it as only the composition root. It should not define interfaces since nobody should depend on it - it depends on everybody else. Since you mentioned Spring MVC: The composite root is usually the main method - so in your case, the third project is already the one where Spring MVC is used, since it will provide you the main method. Just be sure to decouple your application from it. Here's a good talk on how to do that: youtube.com/watch?v=HhNIttd87xs
Dec
10
comment Saving an object via a method of its own or via another class?
@Dunk OOD principles can be stated as: "In principle, doing this is better because of X, Y and Z". It does not mean that it should always be applied; people have to be pragmatic and weight the trade-offs. In big projects, the benefits are such that usually outweigh the learning curve that you speak of - but of course, that is not the reality for most people, and so it shouldn't be applied as heavily. However, even in the lighter applications SRP, I think we can both agree that separating persistence from business rules always yields benefits beyond its cost (except maybe for throw-away code).
Dec
9
answered Using the optional 'self' reference in instance methods in Swift as a matter of style
Dec
9
comment Saving an object via a method of its own or via another class?
@Dunk you speak as if classes were the only modularization unit available. I've seen and written many projects following SRP, and I agree that your example does happen, but only if you do not make correct use of packages and libraries. If you separate responsibilities into packages, since the context is implied by it, you can name the classes freely again. Then, to maintain a system like this, all it takes is to drill-drown to the right package before searching for the class that you need to change. :)
Dec
9
answered Interfaces between multiple projects
Dec
9
comment Saving an object via a method of its own or via another class?
@Ahmad Edited to answer the part about the mixed approach. By the way, if you watch the talks, I hope you enjoy science lessons... :P
Dec
9
revised Saving an object via a method of its own or via another class?
extended to answer the additions to the question
Dec
9
comment Saving an object via a method of its own or via another class?
@amon for reference, the idea of abstract entities comes from the Clean Architecture, as presented by Uncle Bob, and some of what I said can be read in this discussion board: groups.google.com/forum/#!topic/clean-code-discussion/…
Dec
9
comment Saving an object via a method of its own or via another class?
@amon I agree that it is not so simple, but I believe it is a matter of coupling, not encapsulation. For instance, you can make the Student class abstract, with abstract methods for any data that the business needs, which are then implemented by the repository. This way, the data-structure of the DB is completely hidden behind the repository implementation, so it is even encapsulated from the Student class. But, at the same time, the repository is deeply coupled to the Student class - if any abstract methods are changed, the implementation has to change as well. It's all about trade-offs. :)
Dec
9
comment Saving an object via a method of its own or via another class?
About your side note: Although, conceptually, there is only one DB while the application is running, it doesn't mean you should make RetriveStudent and AddStudent methods static. Repositories are usually made with interfaces in order to allow the developers to switch implementations without affecting the rest of the application. This can even allow you to distribute your application with support for different databases, for instance. This same logic, of course, applies to many other areas besides persistence, as, for instance, UI.
Dec
9
answered Saving an object via a method of its own or via another class?
Dec
9
revised Class design - should methods call other methods?
added 4 characters in body