The tag has no wiki summary.

learn more… | top users | synonyms (1)

-1
votes
3answers
112 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 ...
0
votes
0answers
48 views

A layer of abstraction too far?

Using an enterprise service bus, a message translator pulls a message off the queue ready to be consumed by a service. The translator picks up the message in a canonical data model (CDM) form and ...
2
votes
2answers
58 views

Is it possible to avoid abstraction inversion in this scenario?

I'm designing a library built on web scraping that tries to provide an API to a popular news site. I am representing each of its articles as a collection of 'elements' (IElement), such as images, ...
4
votes
1answer
52 views

Use StringLike instead of String in Scala?

Scala has the StringLike trait. Let's say I want to create a case class Name and internally it should save the name with some characters. Should I use case class Name(name: StringLike) or case class ...
0
votes
0answers
13 views

Abstracting AutoLayout sensibly - why is this so conceptually tough and where should I begin?

Below are some babbling, probably incoherent thoughts, but I am so stuck on this problem and I feel like an elegant solution is possible. Though it is indisputably awesome, and makes programatic view ...
1
vote
1answer
122 views

Why sequences are recommended as conventional interfaces?

From the reference of berkeley's version of sicp text, It is mentioned that: Expressing programs as sequence operations helps us design programs that are modular. That is, our designs are ...
0
votes
0answers
66 views

Abstract Web API from validation and configuration management in embedded system

Im working with embedded Linux for a router. There is a web GUI for the user to configure router options. When user fill a web form this is submitted to a web server function that is responsible of ...
-2
votes
3answers
78 views

Is LinkedList an Abstract Data Structure? [duplicate]

This quote is from the book HeadFirst C: A linked list is an example of an abstract data structure. It’s called an abstract data structure because a linked list is general: it can be used to ...
1
vote
1answer
237 views

Building Data abstraction for rational numbers using “objects”

I follow this definition of "object":An object is a value exporting a procedural interface to data or behavior. Objects use procedural abstraction for information hiding, not type abstraction. Object ...
1
vote
1answer
78 views

Event action abstraction and trigger control

I am thinking of abstracting Event action in order to make further alteration/implementation/maintenance easy since the project I am currently working on has volatile requirement. So I thought of the ...
0
votes
3answers
278 views

Abstraction in algorithms

I asked some questions about algorithms, and some replied they are abstract concepts, however I don't know what abstraction means for algorithms or how it applies. For objects, I know if we remove ...
6
votes
3answers
806 views

Can “higher order function” feature allow/maintain abstraction and encapsulation?

Below is the function repeat written using a functional paradigm, such that when called as repeat(square, 2)(5) it will apply the square function 2 times on the number 5, something like ...
1
vote
2answers
388 views

Which design (pattern) would be suitable to abstract logging platforms?

I need to create a simple system to abstract logging platforms. The idea is that I'd like to be able to exchange or activate a logging platform (nlog, log4net, enterprise library) via some ...
1
vote
1answer
144 views

Open closed principle vs abstraction leaking (Java enums)

In Java, an enum is not a plain replacement for a number (like in C/C++), but a family of objects which can have properties. For instance public enum Order { NAME("Ordering by name"), ...
0
votes
1answer
61 views

Implementing an interface already implemented by a parent class?

If a class extends a parent which defines an interface, should that class also explicitly implement the interface? As an example, is it better to include or remove the portion in square brackets ...
16
votes
6answers
1k views

Does functional programming increase the 'representational gap' between problems and solutions? [closed]

Since machine language (e.g., 0110101000110101) computer languages have generally evolved to higher forms of abstraction, generally making it easier to understand the code when it's applied to a ...
-1
votes
1answer
103 views

Why is it said that a class represents an abstraction? [closed]

I think that abstraction represents only the essential things needed for the purpose as there are so many unnecessary properties. So why is it said that a class represents an abstraction?
0
votes
3answers
165 views

Should I be extracting strings from source in core java the way android does?

I just started doing android development stuff after getting pretty comfortable with Java. Android apps tend to do this weird thing where they have all strings for their program held in an XML file ...
5
votes
2answers
153 views

Is it good design to put abstract methods in an abstract class even though the methods are already defined in its interface?

Let's say we have an interface Foo with a method "public void someMethod()", and we have one or multiple abstract classes that "implement" Foo but don't necessarily themselves provide an ...
3
votes
1answer
254 views

Why is close() implemented in InputStream/OutputStream?

It make sense to see close() as non-core functionality of stream objects. This is the reason this method is placed in interface Closeable. One evidence is that class ByteArrayInputStream does not ...
5
votes
9answers
1k views

Why isn't software abstract on a grander scale?

Consider the following example: The user wants a program to calculate a few fibonacci numbers. Sounds easy enough. pseudocode: stdout.write("How many fibonacci numbers do you want to calculate? ") ...
0
votes
4answers
1k views

Why 'List<E>' is an 'interface' but not 'abstract class'?

Amidst defining the hierarchy, firstly, one can think to embed the abstract method(behavior) in abstract class only because the derive concrete class possess that behavior as core behavior with it's ...
0
votes
0answers
32 views

Restructuring similar interfaces to one unified design

In my project, I have several types of Web API controllers (and their corresponding services and repositories). When I started out, I made an interface of a generic type that would describe the basic ...
0
votes
3answers
189 views

Why static members can't be abstract and don't implement polymorphism? [duplicate]

I'm a Java/C#/PHP developer, through my OOP programming experience I find myself asking the same question: Why static members can't be abstract and don't implement polymorphism especially in ...
0
votes
2answers
106 views

When should you create/destroy underlying object in a class that wraps it

(note: I used Java to make it easer to explain my question, but the actual language is irrelevant for this dilemma) TL; DR: I have a wrapper around some underlying class. At which point should I ...
1
vote
0answers
122 views

Am I following a good design thought process? Is the Abp framework overkill?

As I finish one project and start another, I have a small time window to come up with an architecture for the new. I am coming from the following design: Web applicationReceives domain models & ...
0
votes
2answers
178 views

Designing Nested List<Class> Property in a Class

I'm currently in the class modeling phase of my project. Real life Scenario: Let's say I have a Project that is composed of Main Components and each Main Component is composed of Sub Components and ...
20
votes
7answers
4k views

Is there a more intelligent way to do this besides a long chain of if statements or switch?

I'm implementing an IRC bot that receives a message and I'm checking that message to determine which functions to call. Is there a more clever way of doing this? It seems like it'd quickly get out of ...
5
votes
1answer
76 views

Designing communications for extensibility

I am working on the design stages of an application that will a) collect data from various sources (in my case that's scientific data from serial ports), keeping track of the age of the data, b) ...
0
votes
4answers
217 views

Why encapsulate container variables? [duplicate]

I wasn't sure how to formulate the title, but there's something that's made little sense to me in OOP I understand the idea of encapsulation, which is to create a layer of protection, and ...
2
votes
1answer
88 views

How to handle errors best addressed in a higher abstraction layer and dependent on state inferred in current layer?

I have a use-case that can be repaired, but the logic for repairing it is best done in a higher level of abstraction. Just throwing exception/failure is ugly because it's hard to pass back up through ...
77
votes
12answers
8k views

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 ...
3
votes
1answer
182 views

Should I assert in packages? [duplicate]

I have read a few asserts vs exception questions already; I ask specifically about package visible classes though. When you write a package, the classes marked with "public" are exposed to the ...
2
votes
3answers
250 views

Abstraction concept in OOP

I hear that Abstraction is a technique that helps us identify which specific information should be visible, and which information should be hidden. Encapsulation is then the technique for packaging ...
6
votes
3answers
274 views

Dependency Injection vs Mixing Levels of Abstraction

I've been reading Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. One point he makes: G34 Functions should descend only one level of abstraction However, I'm ...
0
votes
3answers
155 views

Is declaring STL variables in a class definition too revealing?

If you are trying to hide implementation, would declaring STL variables be too revealing? // in Word_Bucket.h class Word_Bucket { private: std::vector<std::string> contents; ...etc } ...
0
votes
1answer
671 views

How to use namespaces to separate interface from implementation, in c++?

As far as I can tell, you can make your interface known to others by providing your .h file. Your .cpp is the implementation. Then they can see the function names, the parameter types, the return ...
3
votes
3answers
2k views

Empty virtual method on base class VS abstract methods

I couldn't find a question that was not too specific to some case, so I'll try to make this very generic. We need an extractor base class to a set of documents, for example. Each document has its ...
2
votes
2answers
216 views

I'm struggling with abstracting my animation code in my game using a functional style. How can I do this?

My game is a top down 2D shmup programmed in a functional style. I'm struggling with abstracting the code that is responsible for animating the projectiles. There are many types of guns with many ...
3
votes
5answers
1k views

Why is Encapsulation considered a primary principle in OOP?

I am currently trying to understand more deeply the 4 principles of OOP: Abstraction, Encapsulation, Inheritance, and Polymorphism. After studying the four principles, I don't fully understand why ...
2
votes
3answers
7k views

Confused about the definition of 'abstraction' in OOP

I am trying to understand the definition of 'abstraction' in OOP. I have come across a few main definitions. Are they all valid? Is one of them wrong? I'm confused. (I re-wrote the definition with my ...
1
vote
1answer
150 views

Names for generic classes - how to avoid naming them just “object”? Use synonyms?

When programming, I often end up naming some generic class (think of an abstract base class for stuff you manage in your project) something like FooObject, FooComponent or FooItem (where Foo is an ...
0
votes
1answer
65 views

Would it make sense to add parameters of an inferred type to inheritance?

I'll write this in PHP (where this thought originated), but this is generic to any object-orientated language. Basically, this is an addition to abstract classes that defines the implementation of its ...
3
votes
3answers
366 views

Does Exception Handling Violates “Program to Abstraction”? [duplicate]

I am talking based on experience with Java and C#. I do not know if other language have different exception handling implementation. In order to achieve loose coupling, we need our code being ...
2
votes
3answers
1k views

What is an “abstraction layer”?

I need a very simple explanation because I'm not a professional programmer. I found the terminology "abstraction layer" reading the documentation of mysqli extension where is described the difference ...
4
votes
5answers
503 views

Is my understanding of abstract datatypes correct?

After reading lots of pages on various sites, I came to the conclusion that abstract datatype helps to separate the use of datastructure from its implementation. We can easily map the data into a ...
4
votes
3answers
403 views

How to avoid unmaintainable code when using SQL in an MVC setting?

I want to present a list of products to the user. This list is paginated and can be sorted by the user by product ID or product name in ascending or descending order. I am using an MVC setting, where ...
4
votes
1answer
674 views

Am I right to be skeptical of ASP.NET MVC “Html Helpers”? [closed]

ASP.NET WebForms seemed really great until that moment of realization the abstraction you'd welcomed was producing HTML that was worlds away from what you needed. Wrestling with that framework to ...
3
votes
1answer
232 views

Understanding abstraction

I am trying to understand object oriented code better and I decided to start at abstraction. If I am not incorrect, abstraction means that you hide information that isn't relevant to what task you ...
2
votes
2answers
326 views

Why is it not standard to implement abstraction layers for the file system?

I have been taught to access databases through abstraction layers. I was wondering why it is not also standard practice to access the file system through an abstraction layer? It seems to me unit ...