The tag has no wiki summary.

learn more… | top users | synonyms (1)

1
vote
1answer
84 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 ...
6
votes
8answers
868 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
0answers
27 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
143 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
85 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 ...
0
votes
0answers
71 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
150 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
73 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
197 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
80 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 ...
74
votes
13answers
7k 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 ...
0
votes
0answers
85 views

Creating New Wrapper Objects and Extension Classes and Keeping it Organized

Here's my situation: I'm programming an embedded device with a very simple, but customizable LED array display. It's 10 RGB LEDs linearly setup. The LEDs will be used to display many different ...
3
votes
1answer
174 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
220 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
231 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
143 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
327 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
1k 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
209 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
724 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 ...
1
vote
3answers
305 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 ...
0
votes
1answer
126 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
55 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
277 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
517 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
459 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
303 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 ...
3
votes
1answer
512 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
165 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
286 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 ...
2
votes
2answers
240 views

How does aggregation work when databases are involved?

So I'm reading a book on Design Patterns (Design Patterns Explained 2nd Edition), and all throughout the book it says to "favor aggregation over inheritance". I'm trying to wrap my head around trying ...
6
votes
2answers
158 views

Abstracting user interface from domain

My course text suggests creating a 'facade' class to completely abstract the user interface from the domain layer. That is, the UI uses only basic types, and if it needs a reference to a domain ...
2
votes
5answers
218 views

Short function names for often used function or general concept

I am a bit in a dilemma: Let's suppose I have a very general function and a specialization of it for convenience reasons. Let's also assume that the specialized function is used 90 per cent of the ...
0
votes
2answers
385 views

Refactorable God v.s. too many classe [duplicate]

So I have this problem: in order to structure my code hierarchically, for every new tiny thing, I create a separate sub-folder, file, class ... and in it one 10-line function. It is an anti-pattern. ...
4
votes
5answers
748 views

What is the name of this particular kind of over-engineering? [closed]

When faced with (even a small) project, I tend to fall into the following bad practice. I think about the structure of the problem. Then I create some base classes, derive from them and then derive ...
1
vote
3answers
153 views

How to call something that can be both a user and a usergroup? [closed]

My idea is, to create an abstract class / interface which can be extended into a user, and into a usergroup. There actually is a good reason for there being this interface connecting the groups with ...
1
vote
1answer
206 views

Why does this article state that graduate education liberate one from concerns like the efficiency of hardware-based integers?

Quoting The Evolution of Haskell Programmer, graduate education tends to liberate one from petty concerns about, e.g., the efficiency of hardware-based integers What exactly does this ...
2
votes
2answers
504 views

Code Reuse and Abstraction in FP vs OOP [closed]

I've been told that code reuse and abstraction in OOP is far more difficult to do than it is in FP, and that all the claims that have been made about Object Orientedness (for lack of a better term) ...
36
votes
4answers
2k views

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 ...
2
votes
1answer
172 views

Adding explicit interfaces to Legacy managed C++ code

I have a bit of a challenge and I am not sure how to approach this. We have a very very large project (that is about 5 years old). The code base is HUGE so a full refactor is out of the question. ...
5
votes
2answers
706 views

Does learning to play an instrument improve programming ability? [closed]

I've seen plenty of questions asking if listening to music boosts productivity, etc. but I haven't been able to find one about performing music. Learning to play the piano has been on my to-do list ...
0
votes
3answers
375 views

Designing a SQL-like encapsulation object for programmatic use

In the last few weeks, I have been working on a Data Mapping Library, which has involved lots of research, experimentation, crying, blaming the whiteboard for not being big enough, and more research. ...
7
votes
3answers
716 views

Refactoring an existing abstract class and its parameters

I have an abstract class A which declares an abstract method doStuff. Currently there are many classes that inherit from A and implement doStuff. The class' instances are initialized at run-time ...
4
votes
1answer
489 views

Is this over-abstraction? (And is there a name for it?)

I work on a large Django application that uses CouchDB as a database and couchdbkit for mapping CouchDB documents to objects in Python, similar to Django's default ORM. It has dozens of model classes ...
3
votes
2answers
338 views

Is there a name for being able to quickly find the relevant code? [closed]

I notice that a property of codebases that I like hacking on is that it's quick to find the relevant code for some feature, without knowing much about the code base at all. For example, searching for ...
8
votes
5answers
854 views

Why does Java use so many middlemen? [closed]

For example to read data from a website we do: HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = ...
2
votes
1answer
714 views

Using a DAO to abstract our ORM from the rest of the application

We're using MySQL with Sequelize.js as the ORM. What we're wondering is whether a DOA layer of abstraction is worthwhile. Here are our options: To use the Sequelize models throughout the ...
11
votes
6answers
666 views

What changes are too big to be made easy by proper design?

This is a rather vague question, but it's something I've never felt has been answered in a satisfactory way when reading about proper design. Generally, when learning about Object Oriented ...
24
votes
8answers
2k views

Do frameworks put too much abstraction? [closed]

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 ...