Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

3
votes
4answers
367 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 ...
1
vote
2answers
194 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 ...
0
votes
1answer
81 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(); } }...
0
votes
1answer
59 views

What abstraction to use for hiearchical sum from ordered list

I am looking for an abstraction from which to solve a class of problems similar to the following: I have this ordered ResultSet (in this case sorted for NATION,REGION,DISTRICT,COUNTRY): CITY' Table ...
1
vote
1answer
112 views

Abstraction of VAOs, VBOs and Models

I have gone down the rabbit hole that is abstracting away a working game engine in OpenGL and C++. Before reaching the other side I'd like to ask about my current design, which is - the more I look at ...
1
vote
1answer
146 views

Data layer Abstraction from Business layer for search

This is regarding designing a search api. We have 3 tier architecture now using Spring MVC. All communications are via REST api. UI <-> Business <-> Data(sql). Now to implement faster ...
12
votes
6answers
2k views

When is Primitive Obsession not a code smell?

I have read plenty of articles recently that describe Primitive Obsession as a code smell. There are two benefits of avoiding Primitive Obsession: It makes the Domain Model more explicit. For ...
3
votes
4answers
374 views

What is the benefit of encapsulating a collection inside a class?

Please see the code below: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public string FirstName { get; set; } ...
-1
votes
2answers
75 views

Firmware development philosophy in function wrapping

I wrote some code in the past for 8bit MCUs, realizing that every time I gained experience, the next iteration will be with a wrapper API or something more distant from the "bare metal" register ...
-1
votes
1answer
79 views

variables as abstractions for the memory cells

How are variables abstractions for the memory cells of the machine? Is it because you can change the value stored in the memory cell by assigning a different value to the variable associated with the ...
-3
votes
1answer
67 views

What to call a API and DB code layer [closed]

In a recent MVVM mobile app project I wrote a set of API classes and Database classes where there was a clear flow of logic between both api and db code. To enforce the way api and db interacted I ...
1
vote
1answer
65 views

Service with abstract model initiation

I want to implement an abstract module to store credits and I have the following structure: Model: Credit (abstract) Dao: CreditDao (interface) Service: CreditService The Credit model should be ...
2
votes
2answers
250 views

Limiting your call stack can guide you to use less abstraction?

I've been watching an presentation from Jonathan Blow on Software Quality. He as a point that adding more and more layers of abstraction gives you not only more difficulty to manage your code, but ...
0
votes
2answers
1k views

Design Pattern for a “manager” type of class

I have a class that I usually end up calling XManager. This class usually acts a dispatcher. Where it will read a config and do what the config says. Assuming that I have the following class ...
29
votes
11answers
5k views

How many design patterns and levels of abstraction are necessary? [closed]

How can I tell my software has too much abstraction and too many design patterns, or the other way round, how do I know if it should have more of them? Developers I work with are programming ...
0
votes
2answers
74 views

How to use functions based on configuration?

let's say that I am working with an IoT device. The device can have many sensors, each of them has an address, i/o direction and a reading method. temperature=d2,input,digital humidity=d3,input,...
1
vote
2answers
103 views

Are there any rules how the number of indirection layers should be limited?

Just like the two opposing mirrors are enough for infinity, most of design patterns can be applied repeatedly producing any amount of LOC desired. We can always create a factory for any factory or ...
4
votes
3answers
465 views

Clarification on the Dependency Inversion Principle

I'm reading the book "Agile Software Development, Principles, Patterns, and Practices" by Robert C. Martin. When he talks about the Dependency Inversion Principle he gives the following example of a ...
0
votes
2answers
148 views

The meaning of abstract method? [duplicate]

Edit: the difference between my question and What are the differences between abstract classes, interfaces, and when to use them, What are abstract classes and abstract methods? is that the chosen ...
1
vote
1answer
80 views

Are there any cases when an abstraction should inherit ISerializable?

There is a @Mark Seemann's cite from a conversation which states that an abstraction must never implement IDisposable: I like how @nblumhardt put it almost six years ago: an interface [......
-2
votes
1answer
338 views

What is a software abstraction? [duplicate]

This page on JS Promises says it is a software abstraction. What is a software abstraction and why is the JS Promises called software abstration?
1
vote
2answers
282 views

clarification about DAL and MySQLi functions in PHP

Up to now, I was considering MySQLi functions in PHP one example of DAL. And I initiated a simple project to publish in an article with the title "starting with PHP and DAL and MySQL" But when I made ...
-1
votes
2answers
219 views

Design pattern name for thin wrapper for unit testing purpose

Assuming I'm using a class from third party library that does not implement an interface, for example: class ThirdPartyLibClass { void DoThis() { ... } void DoThat() { ... } } I want to ...
-3
votes
1answer
673 views

Turn based game class design

I wrote abstract base for some turn-based games (like chess or tic-tac-toe) and wrote game based on this base. And I stuck with choosing how to design class hierarchy. Here is two variants for wich I ...
-2
votes
2answers
391 views

Is 'List' a leaky abstraction?

Abstraction - Creates barrier between representation & usage of List ADT Encapsulation - Ensures maintaining in-variants of List ADT. An invariant is a fact about a data structure that is ...
2
votes
3answers
4k views

C++ derived class copy constructor

If I have an abstract class Drink which has a derived class Coffee, what would the copy constructor for Coffee look like? If it accepts a reference of Type Coffee as a parameter then I wouldn't be ...
4
votes
1answer
108 views

What alternatives are there to using an object of a contravariant interface polymorphously?

The gist of what I'm trying to do is get an instance of the appropriate user service, then pass it whatever subtype of User we're working with. Models: public class User { public string ...
1
vote
2answers
541 views

Creating abstraction over API

I'm trying to figure out how to create abstraction over different APIs, which have common things. For example let's take the mobile platforms you have Android, Windows Phone and IOS. Let's say I want ...
-1
votes
1answer
139 views

abstract classes or other generalization classes?

i have a question about software engineering best practice. Let's consider a class "User", with 2 subclasses "Student" and "Teacher" if we need to specify some data for "University special council" ...
1
vote
1answer
93 views

Are terms “abstraction” and “abstract data types” connected with each other?

I am new to OOP. I've read definiton of both terms in many different articles and books, but still can't understand whether there is any relationship between them.
1
vote
0answers
146 views

Maintaining consistency with loosely coupled business and data layers

Take the following sequence of events: Business layer requests data x and y from data layer. Data layer returns version 1 of x and y. Business layer starts performing logic based on data x and y. ...
0
votes
1answer
63 views

Reflexive calls of objects in the same hierarchy

I am not sure how to phrase this. I believe this should have been asked somewhere, but I am unable to find it because I don't know the keywords. Basically, I have some types like this: interface Foo ...
4
votes
1answer
635 views

Creating generic actions in redux

I am wondering if there is anything wrong with creating generic actions in redux which dynamically change different properties in the store , so that i can reduce boilerplate code. For example: //...
0
votes
1answer
30 views

What relationship describes two different abstractions of the same dataset

I am wondering if there is a specific term for when multiple representations are data equivalent. Meaning that you can transfer the data from one representation to the other without any loss of data. ...
6
votes
4answers
564 views

How to separate public and “mostly private” code in C#? (Friend classes, PIMPL pattern, etc.)

Reminder: If you have tips, please remember to put the reason objectively, such as "having two distinct SetInt() functions in the same file violates reader expectations that they'll be overloads, and ...
30
votes
13answers
4k views

Help in understanding computer science, programming and abstraction [duplicate]

Until now, I always believed that you should learn programming languages that make you do low-level stuff (e.g. C) to understand what's really happening under the hood and how the computer really ...
1
vote
1answer
212 views

What is the difference between ADTs and objects? [closed]

This question was answered in "Understanding Abstract Data Types (ADTs)", and the top voted answerer (by Frank Shearar) is currently as follows: Objects are not ADTs (*) [editor's note: Links to "...
-1
votes
1answer
160 views

Terminology: abstraction vs models [closed]

I'm building a model of the SQL query language. It doesn't attempt to abstract SQL at all - instead, it tries to model it directly, so it has model objects named Query, Table, Column, Variable, ...
1
vote
0answers
109 views

Having a globally static cached list without breaking encapsulation?

I have a couple wrappers around third party APIs that allow me to retrieve information from certain web services. Querying these services can be rather time intensive, so in my older version of my ...
1
vote
1answer
135 views

Setting up my inheritance model?

I'm working on refactoring a synchronization web app that our company uses. Currently it's merely a set of controllers that fire up a set of helpers that go through a long chain of if-else type ...
1
vote
3answers
214 views

Resistance to abstraction [closed]

I am on an ASP.NET MVC project where we use Razor to define pages. One thing I like to do is to use Razor's @helper to DRY up pretty much any duplication in HTML (i.e. formalize even small UI patterns)...
2
votes
1answer
441 views

How to frame the concept behind CMake?

I'm using CMake for several years now and found that - in the cases where I'm struggling with CMake - I'm still not completely sure about the concept behind CMake (not taking into account CTest, CPack ...
2
votes
1answer
215 views

Using own ArrayList in general purpose C libraries, but allowing a different implementation

I've written a couple of libraries since beginning to use C again last year. One thing that still needs addressing in both of these is the correct use of array-based lists - hereafter, ArrayLists. At ...
4
votes
2answers
345 views

Fix a leaky abstraction (type checking)

I have a method that accepts an interface and does type checking on the parameter, and depending upon the type a decision is made to either send an email or an alert public void Bar(...
1
vote
0answers
1k views

Abstract Alert Dialog Builders (Same Method Calls, Different Objects)

Currently I'm working on an Android library that creates a dialog which allows to select colors from a palette (examples at the end) and I've stumbled upon an interesting design problem. To create ...
5
votes
1answer
387 views

How to make sure people call methods in the right order?

Situation I'm designing a database abstraction layer for sql (mysql, sqlite) and mongoDb. The goal is to give the user/developer a library which is able to create queries for different databases. ...
5
votes
2answers
148 views

How to abstract from a display?

I'm building an embedded text editor consisting of a keyboard, an LCD display and a PIC32 microcontroller, to be programmed in C. The application should look, for example, like the GNU nano editor. ...
3
votes
3answers
408 views

'Encapsulation Vs Performance' trade-off in a lockable linked list

Main purpose of encapsulation is to protect in-variants of any class(in java). Here is the complete code for class DList/class lockDList/class DListNode/class LockDListNode. class DList and it's ...
3
votes
1answer
119 views

Abstract/encapsulating session superglobal usage inside common accessor class

I am in the process of removing direct dependencies from an existing project. I have now come to removing the direct use of $_SESSION inside scripts. This is to make the same scripts available for an ...
-2
votes
3answers
137 views

What design pattern is this? [duplicate]

I'm struggling to come up with the name of a design pattern that I need to write about. I've been lead to think it was abstraction but apparently not. Let's say I had a driver class which has a Drive ...