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.

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. Unless it is describing the method of emulation itself, not just the use of it.

217 questions
123
votes
12 answers

Why would Square inheriting from Rectangle be problematic if we override the SetWidth and SetHeight methods?

If a Square is a type of Rectangle, than why can't a Square inherit from a Rectangle? Or why is it a bad design? I have heard people say: If you made Square derive from Rectangle, then a Square should be usable anywhere you expect a…
user793468
  • 1,363
  • 2
  • 10
  • 12
89
votes
28 answers

Why is cleverness considered harmful in programming by some people?

I've noticed a lot of questions lately relating to different abstraction techniques, and answers saying basically that the techniques in question are "too clever." I would think that part of our jobs as programmers is to determine the best solutions…
Larry Coleman
  • 6,101
  • 2
  • 25
  • 34
61
votes
7 answers

Can too much abstraction be bad?

As programmers I feel that our goal is to provide good abstractions on the given domain model and business logic. But where should this abstraction stop? How to make the trade-off between abstraction and all it's benefits (flexibility, ease of…
Random42
  • 10,370
  • 10
  • 48
  • 65
60
votes
11 answers

Why is the use of abstractions (such as LINQ) so taboo?

I am an independent contractor and, as such, I interview 3-4 times a year for new gigs. I am in the midst of that cycle now and got turned down for an opportunity even though I felt like the interview went well. The same thing has happened to me a…
Matt Cashatt
  • 3,315
  • 5
  • 24
  • 35
48
votes
4 answers

Abstract Data Type and Data Structure

It's quite difficult for me to understand these terms. I searched on google and read a little on Wikipedia but I'm still not sure. I've determined so far that: Abstract Data Type is a definition of new type, describes its properties and…
user42183
44
votes
4 answers

How to determine the levels of abstraction

I was reading a book today called "Clean code" and I came across a paragraph were the author was talking about the levels of abstraction per a function, he classified some code as low/intermediate/high level of abstraction. My question is what is…
OKAN
  • 725
  • 1
  • 5
  • 8
39
votes
24 answers

What is abstraction?

Is there a generally agreed upon definition for what a programming abstraction is, as used by programmers? [Note, programming abstraction is not to be confused with dictionary definitions for the word "abstraction."] Is there an unambiguous, or even…
mlvljr
  • 1,249
  • 2
  • 13
  • 25
36
votes
10 answers

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, except when it's near the main character, in…
Frank
  • 471
  • 4
  • 8
34
votes
9 answers

Abstraction: The War between solving the problem and a general solution

As a programmer, I find myself in the dilemma where I want make my program as abstract and as general as possible. Doing so usually would allow me to reuse my code and have a more general solution for a problem that might (or might not) come up…
Bryan Harrington
  • 2,502
  • 1
  • 19
  • 22
32
votes
13 answers

Help in understanding computer science, programming and abstraction

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 works. this question, this question and an answer…
31
votes
17 answers

What is the value in hiding the details through abstractions? Isn't there value in transparency?

Background I am not a big fan of abstraction. I will admit that one can benefit from adaptability, portability and re-usability of interfaces etc. There is real benefit there, and I don't wish to question that, so let's ignore it. There is the other…
user606723
  • 1,169
  • 9
  • 13
30
votes
11 answers

How many design patterns and levels of abstraction are necessary?

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 differently concerning these points. Some do abstract…
29
votes
9 answers

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 example, I can talk to a business analyst about a Post…
w0051977
  • 7,031
  • 6
  • 59
  • 87
25
votes
8 answers

Do frameworks put too much abstraction?

I've been programming for a little under a year and have some experience writing systems applications, web apps, and scripts for businesses/organizations. However, one thing I've never really done is working with a framework like Django, Rails or…
user1427661
  • 465
  • 5
  • 6
24
votes
1 answer

Why doesn't Haskell have type-level lambda abstractions?

Are there some theoretical reasons for that (like that the type checking or type inference would become undecidable), or practical reasons (too difficult to implement properly)? Currently, we can wrap things into newtype like newtype Pair a = Pair…
Petr
  • 5,507
  • 3
  • 29
  • 46
1
2 3
14 15