Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Opinion: I have a general "rule of 3". If I'm abstracting more than 3 layers, I'm probably making it too complicated.
And my own personal rule of "If I'm writing a lot of code to do something, I'm probably doing it wrong" always comes into play in encapsulation and separation of concerns. -
On a serious note, I don’t think that it can be thought. It highly depends on the context and it's something that you automatically gain with experience. It’s also highly subjective.
-
I think of other things each piece can be used in and that serves as the boundary. I guess for me it's all about feeling confident that I chose the correct boundary
and then I encapsulate by the boundary -
iiii94292dcommon sense, i guess. there are no hard rules for that and more about personal opinions about what people find maintainable and not convoluted
-
hjk10155912dYAGNI is very important here.
The guiding force behind abstractions should always be variability analysis. You only abstract things that vary.
Even though you may not build abstractions sometimes you do use abstract concepts because they make more sense in communicating. For example if you have a single chair object and you are not getting a couch you might still call it the more abstract "seating", because that is the function you care about.
You can read up on clean architecture and ddd. There are some useful teaching in there however keep the YAGNI in mind. If you follow all that crap to have the layer system in ddd you will end up with at least 4 times the amount of concepts/abstractions than you actually need. Still they do provide some ways to do it correctly when you do actually need to implement an abstraction.
Opinions or resources on how to do good abstractions, encapsulation and separation of concerns
question