FAQ Database Discussion Community


Abstraction over MongoDb and Entity Framework

c#,entity-framework,mongodb,dependency-injection,abstraction
I might be on mission impossible, due to this quote by Mark Seemann: If you have a specific ORM in mind, then be explicit about it. Don't hide it behind an interface. It creates the illusion that you can replace one implementation with another. In practice, that's impossible. But what...

Can we say that a standalone function provides Abstraction? [closed]

c++,oop,abstraction
I am learning about Abstraction, and as I have understood so far, Abstraction is basically providing an interface of how to use an object while hiding the implementation details. But does the concept of Abstraction only applies to OOP, I mean if we think of a standalone function (without being...

How to abstract/remove redundent methods in the following class sample

c#,inheritance,xna,abstraction
I'm trying to remove the redundancy I have in my Enemy0, Enemy1, ... classes that inherit from my abstract Enemy class. This is all Monogame/XNA. My abstract class looks like so: public abstract class Enemy { public abstract Vector2 Position { get; } public Enemy() {} public abstract void Update(GameTime...

Nested abstract class in an abstract class and how to implement it

c#,abstract-class,inner-classes,abstraction
I have an abstract class A and a abstract method with a parameter which is again abstract class B defined in the same abstract class A. When I extended this abstract class A as apart of another class C how can I implement the method with parameter of nested abstract...

Reused abstraction principle in C#

c#,oop,abstraction,solid-principles
In our C# MVC application we have a lot of interfaces that map 1 to 1 with the objects that implement them. ie: basically, for each object created, an "extract interface" operation has been performed. The interfaces are used by Moq to generate mock objects for our unit tests. But...

Creation of object using abstraction fails, likely a simple fix I cannot see

java,object,constructor,abstraction
A novice question about abstraction and constructors. I feel like I'm missing something obvious. I have an abstract class Piece, this is the constructor: public abstract class Piece { private int[] location = new int[2]; private final char color; public Piece(char color, int[] location) { this.location = location; this.color =...

Can't cast superclass to subclass

c++,inheritance,rendering,abstraction
I'm currently writing an abstraction layer between my game and the rendering engine. Unfortunately, I came accross a problem: I just can't seem to cast a superclass (The abstract interface) to a subclass (The implementation for a concrete engine). Here is my code: IInitationSettings.h class IInitationSettings {}; OxygineInitiationSettings.h #include "IInitiationSettings.h"...

How does the GDK android camera example work?

android,google-glass,google-gdk,abstraction,android-file
So I'm a little confused about what is going on towards the end of this code (inside processPictureWhenReady()). Before this method is called (within onActivityResult()) we have the image file path... So a file has already been stored. We then have the file declaration pictureFile using the filepath of the...

Abstraction over single c++ object and std::pair of objects using templates

c++,c++11,design,abstraction
Assume the following template construction: enum class ENUM {SINGLE, PAIR}; // General data type template<ENUM T, class U>class Data; // Partially specialized for single objects template<class U>Data<ENUM::SINGLE, U> : public U { // Forward Constructors, ... }; // Partially specialized for pairs of objects template<class U>Data<ENUM::PAIR, U> : public std::pair<U,U>...

Abstraction with Java in Android

java,android,refactoring,abstraction,modularity
I was studying some tutorials concerning the Java language. I was wondering if I should abstract every time that I code something, and on any type of standard and stack? I have seen that with every Spring Services for example, we could even abstract controllers, using interfaces with EJBs on...

How to Abstract the way this concrete Thread classes are called?

python,multithreading,concurrency,abstraction
I'm making concrete classes that are subclassed from Thread class, so in fact they are threads. Class A and B in my example. My class Foo gets a settings dict, and gets a list of accounts (dict items too). For each account then I create a thread A that takes...

Calling child method

c++,abstraction,object-slicing
In my C++ project I have a class called Trap. A Trap is an NPC and an NPC is an Entity. Now I want to loop through all NPC's and do stuff with them. For example, I want a Trap to update. I do that in the following way. for...