The tag has no wiki summary.

learn more… | top users | synonyms (1)

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 ...
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 ...
30
votes
9answers
843 views

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

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 ...
27
votes
25answers
9k views

What is abstraction? [closed]

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 ...
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 ...
22
votes
17answers
2k views

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 ...
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 ...
15
votes
6answers
508 views

Should all programmers learn at least one very-high-level language? [closed]

One mandatory course I took in uni was about functional and logical programming languages (Haskell and Prolog). It was mildly interesting, and most I talked to showed even less interest to the course ...
15
votes
2answers
767 views

Is DDD-Lite a pattern language for dependency injection?

I stumbled upon Greg Young's talk 7 Reasons why DDD Projects Fail where he mentions something he calls DDD-Lite at 7:20. Summarizing, he basically says some use DDD as a pattern languages (entities, ...
13
votes
4answers
427 views

Can increased usage of higher and higher programming languages lead to a deficit of programmers with computer architecture knowledge?

Quote from Wikipedia of the article "High-level programming language": A high-level programming language is a programming language with strong abstraction from the details of the computer. In ...
13
votes
3answers
2k views

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 ...
13
votes
1answer
803 views

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 ...
12
votes
10answers
2k views

What's the next level of abstraction? [closed]

Since programming languages initially only used lines of code executed sequentially, and it evolved into including functions which were one of the first levels of abstraction, and then classes and ...
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 ...
10
votes
5answers
3k views

Understanding Abstract Data Types (ADTs)

Just browsing through Code Complete last night and I came across the explanation of abstract data types. I must have read it 5 times, and the Wikipedia article doesn't help much either. So what I'm ...
9
votes
3answers
18k views

Abstract Data Type and Data Structure [duplicate]

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 ...
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 = ...
8
votes
4answers
1k views

Is rethrowing an exception leaking an abstraction?

I have an interface method that states in documentation it will throw a specific type of exception. An implementation of that method uses something that throws an exception. The internal exception ...
8
votes
4answers
709 views

Should database queries be abstracted out of the page itself?

When writing page generation in PHP, I often find myself writing a set of files littered with database queries. For example, I might have a query to fetch some data about a post directly from the ...
7
votes
4answers
3k views

Abstract methods vs instance variables for reusable objects

I have quite a bit of Java code that I'm re-working to be re-used. The problem is that there are many pieces that are project specific so there are ends up being a higher level of coupling between ...
7
votes
3answers
189 views

Rules about the concreteness of method parameter types, return types and property types

Some time ago I read a kind of "rule of thumb" about the concreteness of method parameter types, return types and property types, but I just do not remember it. It said something about keep your ...
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 ...
7
votes
7answers
395 views

Is there a canonical book on general abstractions and modeling? [closed]

I've been trying to understand the fundamentals of general abstractions and modeling: there are quite a lot of books when you search for abstractions, but most of those seem to be about learning ...
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? ") ...
6
votes
6answers
559 views

When to write Abstract code and when to be more specific?

I'm working on a small tool as a toy project to show the difference between two directories, showing which files/directories were added, removed, modified, etc. I was trying to represent these ...
6
votes
3answers
2k views

Good use of wrapper functions?

What do you consider good use of wrapper functions? When are they useful abstractions and in what cases harmful and unnecessary complexity?
6
votes
1answer
1k views

Understanding the levels of computing

Sorry, for my confused question. I'm looking for some pointers. Up to now I have been working mostly with Java and Python on the application layer and I have only a vague understanding of operating ...
6
votes
1answer
536 views

Are “wrapper” and “shim” synonymous?

Are the words "wrapper" and "shim" more or less synonymous, or is there a distinction, perhaps connotative?
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 ...
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 ...
6
votes
2answers
511 views

What's the real benefit of meta-modeling?

After reading several texts about meta-modeling I still do not really get the practical benefit. Sometimes I think it is only an interesting mind game but no useful tool. Sure it is wise to clarify ...
5
votes
2answers
995 views

How does strengthening of pre conditions and weakening of post conditions violate Liskov Substitution principle?

I read that Liskov substitution principle is violated if : Pre conditions are strengthened . Post conditions are eased out. But I don't get fully yet how these two points would violate Liskov ...
5
votes
3answers
552 views

Is there too much abstraction in the Ruby on Rails community?

Rails, to me, seems like a perfect level of abstraction for most types of web development. However, having watched some seasoned Rails consultants build an application, I'm finding that they use Gems ...
5
votes
1answer
280 views

Using High Level Abstractions

I'm not sure if I'm using the correct term, but would you program using High-level abstractions like Powerbuilder, or some CMS like MODx or DotNetNuke? I haven't dabbled in any of these yet. The ...
5
votes
1answer
1k views

How is the facade pattern different from abstraction layers?

I just read about the facade pattern and found this example where a client (user of a computer) invokes a startComputer() method which calls on all the complex stuff: Source: wikipedia /* Complex ...
5
votes
3answers
1k views

Thick models Vs. Business Logic, Where do you draw the distinction?

Today I got into a heated debate with another developer at my organization about where and how to add methods to database mapped classes. We use sqlalchemy, and a major part of the existing code base ...
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 ...
5
votes
1answer
172 views

Is there a standard for machine-readable descriptions of RESTful services?

I've interacted with a few RESTful APIs that provided excellent documentation for humans and descriptive URIs, but none of them seem to return machine-readable descriptions of themselves. It's not ...
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) ...
5
votes
1answer
484 views

Abstract Factory Method and Polymorphism

Being a PHP programmer for the last couple of years, I'm just starting to get into advanced programming styles and using polymorphic patterns. I was watching a video on polymorphism the other day, and ...
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
5answers
494 views

Should concrete classes avoid calling other concrete classes, except for data objects?

In Appendix A to The Art of Unit Testing, Roy Osherove, speaking about ways to write testable code from the start, says, An abstract class shouldn't call concrete classes, and concerete classes ...
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 ...
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 ...
4
votes
2answers
1k views

Is dependency injection by hand a better alternative to composition and polymorphism?

First, I'm an entry level programmer; In fact, I'm finishing an A.S. degree with a final capstone project over the summer. In my new job, when there isn't some project for me to do (they're waiting ...
4
votes
2answers
237 views

Should Sequence Diagrams be Specific or Abstract?

I'm creating a sequence diagram for a simple program I'm working on for work. The diagram I'm currently working on is very high level - it defines the interface with lots of alt paths, but does not ...
4
votes
2answers
163 views

Does KISS encourage tools and frameworks that expose complex leaky abstraction layers?

Tools and frameworks make complex tasks simple. This seems like something that would be supported by KISS(keep it simple stupid). Tools and frameworks also have the potential to introduce leaky layers ...
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
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 ...
3
votes
2answers
456 views

I have data that sends in “bursts” of 100 records with a significant delay. How do I structure my classes for multithreading?

My datasource sends information in 100 batches of 100 records with a delay of 1 to 3 seconds between batches. I would like to start processing data as soon as it's received, but I'm not sure how to ...