Questions tagged [abstraction]

Abstraction is a computer science concept in which an implementation is separated from its interface.

Abstraction is a computer science concept in which an implementation is separated from its interface. Abstraction allows an implementation to be modified without changing the interface, so that other code which relies on this interface does not have to be modified.

For instance, a function prototype in C would be considered the function's interface, and its definition is considered the implementation. The function definition can change (for instance, to improve performance or fix a bug), but as long as the function signature (as specified by the prototype) is the same, any code calling the function can remain the same.

1121 questions
0
votes
1 answer

Abstracting a Test Class

I have a few tests right now that uses PowerMock and Mockito to "mock objects". The problem is, all those tests create the same mocks over and over again. Is it possible to have an abstract class from which my test derive that pre-mocks these…
roblabla
  • 113
  • 1
  • 10
0
votes
1 answer

Alternate name for BackingStoreException

I'm about to undertake the task of abstracting out all SQLExceptions from an ORM's public interfaces with something more generic - that is declaring a generic exception which would in most cases wrap say an SQLException), and I'm wondering about…
putgeminmouth
  • 583
  • 4
  • 7
0
votes
3 answers

Parameterized Constructor for Polygon

I am creating a brick breaker game for school using ArrayLists, abstraction, and polymorphism. I have created an abstract class DrawableBrick that includes a draw method. I have already successfully created the other subclasses that fill my…
0
votes
1 answer

Abstracting the Request object

I'm running some basic unit tests on an MVC4 application. Within one of the main controller methods there is a call to Request.UserHostAddress. However when I run my unit test it fails (Object null reference) which I presume is because the Request…
higgsy
  • 1,991
  • 8
  • 30
  • 47
0
votes
1 answer

Abstracting away boiler plate sqlalchemy call to allow different options in a try/except block

I'm trying to abstract my sqlalchemy query call, the complete unmodified call looks like this: Session.query(User).options(FromCache('redis1')).filter(User.id == user_id).all() The dynamic parts I need control over is User, redis1 and the last call…
moodh
  • 2,661
  • 28
  • 42
0
votes
1 answer

Writing a save method in php for a general api

I have recently been playing with some very general OOP Concepts and learning to abstract my code. For this purpose I wrote a general car api that saves data to an array. The problem is I can add, list, delete and find the data but when it comes to…
Adam
  • 37
  • 1
  • 6
0
votes
1 answer

composition vs MI example

I have come across this library, orocos bfl. It uses external matrix libraries, and in wrapping them, they use multi-inheritence; such as class Matrix: public Matrix_Wrapper, public Boost::Matrix { //some implementation } as oppose to…
aiao
  • 4,621
  • 3
  • 25
  • 47
0
votes
1 answer

Sql views vs jdbc select-join, where to abstract?

I have 3 tables (see below), Table A describes a product, Table B holds inventory information for different dates, and Table C holds the price of each product for different dates. Table A ------------------ product_id product_name 1 …
fo_x86
  • 2,583
  • 1
  • 30
  • 41
0
votes
1 answer

Using variables to denote class names for static properties in PHPStorm

I'm trying to write some abstract MVC classes in PHP using PHPStorm. Some of the overriding class properties I am using for generic class wrappers tend to be better suited to using static methods and properties. The code works fine, but whenever I…
Scott
  • 7,983
  • 2
  • 26
  • 41
0
votes
1 answer

Abstracting a global variable to a property?

I'm reading DOM Scripting and have a beginner question about the abstraction below. The original code didn't include "clearTimeout", and "movement" was declared as a global variable. While the code ran fine, it wasn't a smooth animation which is why…
KMcA
  • 1,155
  • 1
  • 11
  • 21
0
votes
1 answer

Providing common functionality for aggregates derived from the same base object using the Repository Pattern

I'm attempting to use the Repository Pattern to write a data access layer on an existing DB2 schema. This schema has several aggregates all having a common base entity of a "Document." When building the business objects, I created the Document…
AJ.
  • 16,368
  • 20
  • 95
  • 150
0
votes
2 answers

How do I make my API available to everyone?

I want to create an abstract linked-list implementation (having general operations to createList, destroy, addNode, deleteNode, etc.). How do I make these functions available to anyone who is using the OS? (I am using Ubuntu.) I can have the…
Deepankar Bajpeyi
  • 5,661
  • 11
  • 44
  • 64
0
votes
1 answer

Best practice for separating application logic

In my application Ive separated next levels of application logic: Utilities Application abstraction Simple/common implementation of the application abstraction (#2) Concrete application implementation (additional functions and classes to append #3…
pleerock
  • 18,322
  • 16
  • 103
  • 128
0
votes
1 answer

Abstracting initialization

I have some classes that I want to initialize only if the passed parameter is true. It turns out that every implementaion of this method is the same, but is just used for a different class. public static NamedScene getScene(boolean init) { if…
NightRa
  • 10,701
  • 3
  • 16
  • 22
0
votes
1 answer

C# Custom Object Validation Design

I currently have to validate custom Field Objects for my application. Simply put, each Field object consists of information about the validation for the field, as well as the value of the field. I am validating fields in bulk, so currently, I have a…
Jeff
  • 623
  • 3
  • 8
  • 22