Questions tagged [abstraction]
Use this tag in reference to either hardware abstraction, such as how Windows can use the same APIs even on different hardware, or any other method where the reality is separated from the user-level programs by software. This should not be used for emulation.
219
questions
2
votes
2
answers
317
views
In unit testing: How to abstract a dependency of subject under test?
Disclaimer: I am learning unit testing. I am also kind of beginner in object-oriented design.
Currently, I am involved in the development of an application to manage the finance of a humble food ...
5
votes
1
answer
506
views
Confused on how abstraction and encapsulation is helpful
Using assimp I've created a function to load 3D models and it does everything I need and I don't plan to use another library or write something custom, however, I am curious how techniques such as ...
2
votes
3
answers
241
views
Is it necessary or "class obsession" (opposite to primitive obsession) to create classes for non-business fields?
I know there are some posts talk about primitive obsession : When is primitive obsession not a code smell?, Is "avoid the yo-yo problem" a valid reason to allow the "primitive obsession&...
3
votes
3
answers
1k
views
C++ Is it okay to use nested classes as a way to namespace derived classes?
I have many abstract classes that describe many abstract ideas and objects. These classes have many complex relationships with each other, and I realize that while writing code with some of the ...
-2
votes
1
answer
494
views
How to create a cross-platform class abstraction?
I have been struggling with how to create an "object-oriented" cross-platform abstraction.
In C++, a class requires a certain amount of coupling between its interface (i.e., public methods) ...
0
votes
1
answer
106
views
How to seamlessly interact with a message broker when the underlying system (SQS, RabbitMQ) can change depending on the environment?
Having a poor knowledge of the extended features of the available message brokers, I was wondering how to approach this.
We have some environments where only RabbitMQ is available, others where ...
1
vote
2
answers
167
views
Strategies to abstract away technical details when dealing with transactions
I like programming in such a way that every component/injectable of the applications I build, has a clearly defined scope, and it's easily tested.
With years working as a Developer I've come to ensure ...
0
votes
0
answers
186
views
Designing long running background jobs that are part of domain language
I am going to type out my problem in terms of my domain use case;
When an Operator has an Ingest with a valid Dataset (Lowside, Drive and EntryPoints selected), they will opt to then Scan the Ingest. ...
2
votes
2
answers
232
views
Should I abstract function calls with duplicate arguments?
I have an intuition, that I'd like to read what others have talked about. To me, it seems fairly intuitive that when you have a function which is called multiple times with the same arguments, it ...
1
vote
2
answers
249
views
Should I stop using jQuery and create custom abstractions?
I'm a junior web developer. My current work is on a form-based server side web application. It was set up using jQuery. I'm now the primary person working on it. In a previous job, which was more ...
16
votes
7
answers
5k
views
Where should interfaces be used?
One thing I've long struggled with being able to grasp properly is, when designing a program in an object-oriented language, where and how should explicitly named/defined interfaces be added? In ...
0
votes
2
answers
131
views
Externally relying on the method call of the DI class means introducing a dependency on the implementation detail?
So I've got a class that calculates a discount (Let's call it class "A"). It has a price fetcher class as a dependency (constructor injection) (Class "B"). The price that is ...
0
votes
0
answers
49
views
How to handle ISR callbacks when writing a Hardware Abstraction Layer (HAL)?
I'm writing a Hardware Abstraction Layer (HAL) to abstract a hardware peripheral on an mcu.
The driver peripheral looks like this.
Driver module. Includes hal.h
void drv_init(void);
void drv_set(int x)...
1
vote
2
answers
260
views
How to design relationships with constraints on subclass type?
I'm developing a full-stack Rest application following a narrative description of a working context. There is a class Job with two subclasses Job_A and Job_B. Job_A produces Report_A while Job_B ...
0
votes
1
answer
186
views
How far can one debug a low-level API in closed-source environments?
Assume a low-level API is provided without source code (e.g. DirectX).
The API provides a virtualization of hardware resources (GPU, CPU, audio card, etc.), which enables the user to call hardware-...