Hot answers tagged

2

The problem is that your example is vague and your names are anemic. If we make them good robust names doesn't the choice become obvious? namespace ImageFilter { class BasicFace ... class HappyFace ... class SadFace ... } verses namespace ImageFilter { class BasicFaceImageFilter ... class HappyFaceImageFilter ... class ...


1

Since i'm not familiar with c++ i'm answering in a more design-specific way. The name of class describes it's functionality, while a namespace includes a wider spectrum of classes sharing one type of function or use case. So at first it looks like you could refactor your *Filter-classes and all of your classes work just fine. Now you're implementing ...


1

Naming things is hard, and part of making the right decision is to understand what specifically the repeated name part expresses. A prefix that is merely a company name is usually redundant, e.g. there is no reason to declare an ACMEString class within an ACMEUtil package. A prefix that pervasively affects everything you do in the domain can sometimes ...


1

I think the most relevant guideline here is the Single Responsibility Principle. A method that is responsible for processing a Data object should have no business in creating or retrieving it. Instead, it should be passed in as a dependency; just what your first version does. I disagree that the second version is, by any standard, more generic. It only ...


1

So you are asking when to introduce an additional layer of abstraction to decouple pieces of code. It's impossible to give a general answer. Most of developers just follow their experience and the Open/Closed-Principle. … maybe, in future, I will need different data … The best answer I can give based on the information provided: You Aren't Gonna Need ...



Only top voted, non community-wiki answers of a minimum length are eligible