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 Database and Proper Controller Implementation

I'm using MongoDB as a backend for my project, but I don't specifically want a dependency on Mongo for the life of the project in case I later decide to change it or in case unit testing is easier without the database. As written, however, my…
senfo
  • 28,488
  • 15
  • 76
  • 106
0
votes
1 answer

How would you hide the specific ORM implementation in: class Project < ActiveRecord::Base

Let's say I have a model class called Project, but instead of this: class Project < ActiveRecord::Base I wanted to write this: class Project < ORM so that the specific ORM implementation is not present in my model class. How would I need to write…
parlia
  • 37
  • 1
  • 4
0
votes
1 answer

Symfony Model abstraction (to SQL or NoSQL)

I am starting a new (and first) project with Symfony2, but I didn't choise Database engine yet. And it could be MySQL or NoSQL engines like MongoDB or others, or also it could be changed along the proyect cycle. So, I would like to start working…
Martin B.
  • 760
  • 2
  • 8
  • 21
0
votes
1 answer

What is the advantages and disadvantages using UdpClient over Socket

I'm currently using Socket class on both server and client to establish udp connection, right now it is working very well but I saw there was another way of using udp sockets, the UdpClient class. My question is what should I use for 3d multiplayer…
UnTraDe
  • 3,747
  • 10
  • 36
  • 60
0
votes
1 answer

Generate a nested CRUD form

From a logical perspective it sometime doesn't make sense, for example, to add an Address before you add a Customer. db.define_table('address', Field('line1','string', required=True), Field('line2','string'), Field('suburb','string',…
A T
  • 13,008
  • 21
  • 97
  • 158
-1
votes
2 answers

C++ selectively overloading [ ]?

Given: class example { public: std::vector> a; int b; } func() { example e; ... // populate e I could then use examples members like so. int n = e.b; int n2 = e.a[2][3]; However, could I…
alan2here
  • 3,223
  • 6
  • 37
  • 62
-1
votes
1 answer

Why is my Python list not passing through to another function that's dependent on the list even though it did in a less abstracted method?

TRACE LOGS: Traceback (most recent call last): File ".../GradeCalculatorPlus/run.py", line 127, in calculate_grade_final(summatives, formatives, course) File ".../GradeCalculatorPlus/run.py", line 60, in…
SaltyScrimp
  • 43
  • 1
  • 7
-1
votes
1 answer

How abstract classes, interfaces hides implementation details

Here in below mentioned code we have abstract class with abstract method and implemetation is present in child classes. and We can create object of child classes with referance var of parent class and can access the methods. So how we are hiding…
-1
votes
1 answer

what is the main purpose technically speaking about the abstraction in programming using DI, Interfaces, and Abstract Classes?

I viewed a couple of answers online regarding Abstractions, Abstract Classes, Interface's, DI, and Loose coupling. But none of these answers are answering my question. I grouped these topics because they are related to achieving abstractions. Got a…
Mohamed
  • 55
  • 9
-1
votes
1 answer

Implement/extends class without implementing all methods

I'm looking to have a method return a class Job, that has different methods based on the job type. For example, the job type could be BackupJob or RunCommandJob. They don't share methods, but it's needed to get them from a single method,…
-1
votes
1 answer

Remove independent if conditions

Refer below code structure which I want to refactor: @Builder @Value class ReasonAndAction { String reason; String action; } ReasonAndAction decideReasonAndAction(Input input) { …
zargam08
  • 11
  • 2
-1
votes
1 answer

is there a way to combine these functions?

I am working on a little website, which loads the first page but keeps the others hidden until the user clicks the relevant button. So, when the user clicks "Start Page 2" then the html has an onclick method: onclick="startPageTwo()" below is the…
-1
votes
3 answers

Multiple inheritance using interaces

Please consider the attached figure. What I want is that the (technical-) "User" can use methods from class A, B or C by an instantiate of "HeadClass". What I try to avoid is, that I have to add a separate function for each method defined in Class…
RadioMan85
  • 337
  • 1
  • 11
-1
votes
1 answer

Abstract away nested loops in C++

I am relatively new to C++ and am building a matrix class for carrying out with it common linear algebra operations. Some snippet of the hpp: template struct Matrix3D { const int shape[2] =…
mosegui
  • 664
  • 6
  • 15
-1
votes
1 answer

Java code abstraction, generics, I don't understand the generics java code here

public abstract class BaseDataItem> implements DataItem { } public abstract class SingularDataItem extends BaseDataItem> { …
Siddharth Kumar
  • 2,672
  • 1
  • 17
  • 24