Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 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)...
user avatar
0 votes
2 answers
66 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 ...
user avatar
  • 109
0 votes
1 answer
139 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-...
user avatar
0 votes
1 answer
503 views

Encapsulation of External API in Infrastructure Layer AS Persistence

My question is about DDD, the Infrastructure layer, it's relation to the Domain, and specifically how we can take advantage of the ability to "swap out" one persistence implementation for ...
user avatar
5 votes
2 answers
152 views

Finding the right abstraction and minimising invalid states

I am writing a library to allow two people to play chess for a toy project. For what is worth, it is in C++. I have deemed useful to have a class named Move, which represents a move which needs to be ...
user avatar
0 votes
2 answers
118 views

Data structure for graphs and vectors in C

I'd like to design an implementation for graphs in C. I'm wondering what the most efficient approach in terms of both computational power and memory consumption would be. I've looked at various open-...
user avatar
0 votes
3 answers
222 views

Refactor SLA problem of high level code inside if/else?

I have some code where I believe the SLA (single level of abstraction) principle is broken in a way that the low-level code (if-statements) is outside and the high level code is nested inside the ...
user avatar
-1 votes
1 answer
46 views

Designing a class implementing a method which signature types depends on the instance contained

My goal is to define a Service class which process method accepts a RequestType argument that is defined by the contained ServiceType and returns an object of a type defined by ServiceType. By doing ...
user avatar
0 votes
2 answers
142 views

Abstraction way in a bank software system

I am creating a bank software system. In this system, there are 3 account types: Savings, Checking, CD. Each account from any type has an ID, apr, and amount, and we can withdraw from it. So I can ...
user avatar
  • 65
1 vote
4 answers
163 views

How to express abstractions?

In a program there is an abstraction from an person to a shape. This abstraction is so that collision detection can be performed. Here is my original class hierarchy: namespace Graphics { class Shape ...
user avatar
2 votes
2 answers
274 views

In OOP, are all class methods valid?

Some classes have methods that don't match up with procedural data abstraction. Here is an example of a problem hierarchy, the Render() method doesn't seem to be part of an procedural data abstraction ...
user avatar
0 votes
1 answer
90 views

What's an abstraction?

I know this is a very basic topic, but I'm curious why an abstraction in programming is always defined as a simplification/hiding of some functionality. Let's say I wrote a set of functions that let ...
user avatar
3 votes
5 answers
233 views

Does abstraction have a relationship with the abstract key word in java?

I learnt the concept of abstraction as: Reducing complexity by hiding unnecessary details. Does this have a relationship with the abstract keyword in java? I see that the abstract keyword is being ...
user avatar
  • 140
1 vote
0 answers
95 views

How can I improve this API solution

Intro I'm creating an app and I'm not sure if the structure of the solution is correct. I have a BaseController that uses generics. This controller is inherited by others that do not have to ...
user avatar
  • 19
4 votes
1 answer
136 views

Do kotlin libraries with inline APIs encourage high coupling and discourage unit testing?

As an example, let's assume our application needs some way to communicate with other systems using HTTP. interface HttpClient { fun <T> get(url: String, returnType: Class<T>): T fun ...
user avatar
  • 149
-4 votes
1 answer
260 views

Express SQL Query As Abstract Object Model

Goal: write code to express SQL queries in C# that get converted to SQL at the data layer level and will be compatible with any common data layer / ORM such as Dapper or Entity Framework (EF). Edit: ...
user avatar
0 votes
1 answer
121 views

Are inheritance, abstraction and polymorphism regarded as association in OOP?

In the realm of OOP, inheritance, abstraction and polymorphism are basic concepts of the paradigm. On top of that, there also have the concept called "associations" which I understand is ...
user avatar
1 vote
1 answer
87 views

How to decide on abstraction level and entity definitions?

I am working on a hobby project of mine where I want to make an application to doing my personal finances. Just for learning. I am trying to adhere and implement best practices and patterns to learn ...
user avatar
2 votes
4 answers
486 views

Wrapping 3rd party library - avoiding leaking abstraction

I'm currently developing an application using SFML. My biggest concern at the moment is making a layer of abstraction over the library, so I can easily change it to something else if needed. What I'm ...
user avatar
  • 203
1 vote
1 answer
81 views

General question on Pairing of Abstract Factory with Bridge

I am trying to get myself familiarized with the design patterns and I am reading through this line on the relationships between different patterns. I cannot get my head around this one though, You ...
user avatar
  • 19
1 vote
1 answer
107 views

Where to handle duplicate key exceptions in multy layer application

+-------------+ +--------+ +----------+ | repository +-------->+service +------->+controller| +-------------+ +-^------+ +------------+ +-------------+ | ...
user avatar
0 votes
2 answers
95 views

What's the pattern to share database to other module in security perspective?

In a large iOS application, I have a database module which is dedicated to handle application databases with read/write public APIs for other module. UI module has a feature to share the database, in ...
user avatar
36 votes
10 answers
7k views

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

Suppose I'm creating a game played on a 2D coordinate grid. The game has 3 types of enemies which all move in different ways: Drunkard: moves using type 1 movement. Mummy: moves using type 1 movement,...
user avatar
  • 471
1 vote
1 answer
63 views

Tips for module naming and criteria for grouping files in a directory

It appeared, that I have in my pet project two abstractions: asset loaders and drawing tasks. For each abstraction I have some classes representing them (currently a single class for drawing task ...
user avatar
3 votes
3 answers
184 views

confused with abstraction definition?

I have some years of oop programming experience,I though I know what abstraction is (using abstract class and interface), but I am confused with the definition that appear in a book which says: "The ...
user avatar
6 votes
2 answers
461 views

Is it good design to have one constructor that supplies a "default" concrete class to another that takes an abstraction?

I like to invert dependencies whenever possible by depending mostly on abstraction and allowing the concrete implementations to be passed into the object by clients, or a factory. I've found this to ...
user avatar
0 votes
2 answers
87 views

How do you handle abstraction when you have no control over the attribute class?

Python, has the library pathlib with the concrete class Path. I have a class called Cleanup, that looks like this: from pathlib import Path Cleanup: def __init__(self, source : Path, ...
user avatar
1 vote
1 answer
88 views

Designing a generic graph

I am looking at designing a Graph class, that should work for both lists and matrix. For ex: something like, class Graph { public: virtual ~Graph() = 0; virtual bool AddEdge(int src, int dest)...
user avatar
  • 131
3 votes
2 answers
447 views

What is an example, in Javascript, of the difference between Abstraction and Indirection?

I thought I understood what abstraction meant - refactoring code so that it applies to more general use cases. However I have recently learned that some types of abstraction may actually be ...
user avatar
  • 167
11 votes
5 answers
2k views

Too much abstraction making code hard to extend

I'm facing problems with what I feel is too much abstraction in the code base (or at least dealing with it). Most methods in the code base have been abstracted to take in the highest parent A in the ...
user avatar
  • 127
1 vote
7 answers
473 views

Dealing with large code base quickly in agile

At my current company, the project I work on is coded in Java, at least for the systems / backend part. Whenever I get assigned a task dealing with the Java code, it take me hours or even days to ...
user avatar
  • 121
0 votes
1 answer
122 views

How can I use disparate concrete classes that share similar functionality to create an interface that abstracts those similarities?

I've run into this issue a few times. I have preexisting framework objects that do not share a common ancestor. An example of this would be a class representing a an environment variable and a class ...
user avatar
  • 191
1 vote
2 answers
147 views

Not understanding ADT concept from book "Object-oriented software construction 2/e"

I've been learning object-oriented concept from this book, and stuck in a specified concept in the middle of chapter 6. No one could understand my question without brief prologue, so I'm starting with ...
user avatar
  • 185
1 vote
4 answers
179 views

Can encapsulation/information hiding cause problems in error identifying/locating?

I understand the principles behind opaque data types, encapsulation, information hiding, etc. in theory: preventing alteration to parts of a program can prevent people from accidentally messing it up, ...
user avatar
  • 153
0 votes
2 answers
188 views

How to implement a combination of behaviours for my objects

I need to create a program to manage an association. Members of this association have different roles and each role has specific characteristics. My problem is that I'm not able to abstract this ...
user avatar
  • 59
8 votes
5 answers
2k views

Is there a reason to define an interface for a pure data class?

I am reviewing a colleague's code and as part of the changes, this person introduced a few new pure data classes like so (C#): public class Result : IResult { public bool Succeeded { get; set; } ...
user avatar
2 votes
1 answer
235 views

Approach for implementing Device and Protocol layers in C++?

I'm writing a program that will interface with an external device. It will support numerous devices that may use different communication interfaces like USB, serial, etc. This is what I have so far: ...
user avatar
-1 votes
1 answer
187 views

Database abstraction layer

I'm currently developing an SaaS application in PHP, with Laravel, using its own DB class. Let's pretend we've got 2 classes under 2 namespaces, plus Laravel's own DB - so Illuminate\Support\Facades\...
user avatar
16 votes
7 answers
4k views

What is "premature abstraction"?

I've heard the phrase being thrown arround and to me the arguments sound completely insane (sorry if I'm strawmaning here, Its not my intention), generally it goes something along the lines of: You ...
user avatar
  • 287
0 votes
2 answers
2k views

Usage of the word "override" in C++ and it's virtual functions

I know that the following function is a virtual function and needs to be overridden when extended by another class: virtual int getAge()=0; What i don't understand is the following syntax I have ...
user avatar
  • 29
-3 votes
3 answers
1k views

Object Oriented Programming what is abstraction? [duplicate]

I was hoping that someone could explain to me in the simplest way possible and with an example, what abstraction is with regards to Oop. I've read articles online and I just don't get it. I'm hoping ...
user avatar
17 votes
5 answers
2k views

How to comprehend abstraction in code?

When looking at a new codebase I like to start from a bottom-up approach. Where I comprehend one file and then move up to the next abstraction. But often times I find myself forgetting what the ...
user avatar
0 votes
1 answer
3k views

Unit testing protected methods which have no reason to be public

I need to make a sponsorship system with complex business requirements. Basically, after a user makes a payment, the system should get triggered. There are many different types of sponsoring, so I ...
user avatar
-2 votes
1 answer
91 views

looking to solidify understanding of OOP principles

I just wanted some feedback on my definitions of these terms. Abstraction - only showing relevant information and hiding implementation details. Interfaces and abstract classes are an examples of ...
user avatar
  • 117
2 votes
1 answer
1k views

Is it a good idea to wrap Material-UI Typography components in <H1>, <H2> components etc?

I love the Material-UI library, but some things that I've found annoying: I find Typography too long to write out, especially when I'm having to specify things like gutterBottom, align, etc. Whereas ...
user avatar
  • 2,424
1 vote
2 answers
158 views

Thin Controller: Make a Controller Service wrap other Services?

Say you have a HomepageController that' suppose to show all the blogs, users, gallery, and some members-only info (for logged-in users) Normally, it looks like this: <?php class ...
user avatar
  • 313
2 votes
2 answers
439 views

Is it bad practice when an Object has to be aware of another Object

I was reading this page and came across this sentence in the accepted answer: I don't like A directly knowing about B. But that's a DIP thing not a POJO thing. What if you can't abstract out B ...
user avatar
3 votes
4 answers
844 views

Is Abstracting your code too much a bad use of SOLID Principles?

After an unresolved argument with a friend I decided to ask the stack overflow community. Is there something like abstracting your code too much? Which of the following is the better option. We come ...
user avatar
4 votes
2 answers
7k views

How to deal with exceptions in DLLs?

I recently started working on an existing project written in C++ Builder. The application consists of a MainModule that loads lots of modules (DLLs). The MainModule itself is a DLL (there is a small ...
user avatar
  • 141
-1 votes
1 answer
298 views

Swapping Entities or ORM in repository pattern

Lets say i am following Repository pattern in my application and i have class UserEntity { private $model; public function __construct() { $this->model = new UserModel(); } }...
user avatar

1
2 3 4 5