Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Design patterns in Object Oriented Programming signal systemic problems of the paradigm of OO? [duplicate]

Possible Duplicate:
Are design patterns really language weaknesses?

After spending years pouring over books on OOP and the techniques of OOP, and recently getting involved more and more in Functional Styles of programming, would it be fair to extrapolate that design patterns are pointers to systemic problems with Object Oriented programming as a whole. Is there a fundamental flaw in Object Oriented Programming (not to be confused with Design), in that in the treatment of state through encapsulation, has led to more and more patterns to resolve the problems with such a paradigm.

I have not come to any conclusions on this, but my "gut" feeling is that there might be something more seriously wrong with the paradigm of OOP.

Is the very idea of encapsulation causing more problems than they solve.

like image 634
WeNeedAnswers Avatar asked Jan 30 '11 16:01

WeNeedAnswers


People also ask

What is the relationship between the object-oriented paradigm and design patterns?

Object Oriented Programming is a programming methodology or concept of programming that organizes code into objects and relationships of objects. Design Patterns would suggest proven-successful methods of constructing types/objects to solve a certain scenario in a program.

Which OOP concept is used in design patterns?

Based on the purpose, design patterns were classified into three types. Creational — Concerns the way objects and classes were created. Structural — concerns the composition of classes and objects. Behavioural — characterizes the ways in which classes or objects interact and distribute responsibility.

What is problem solving in OOP paradigm?

The object-oriented problem solving approach, in general, can be devided into four steps. They are: (1) Identify the problem, (2) Identify the objects needed for the solution, (3) Identify messages to be sent to the objects, and (4) Create a sequence of messages to the objects that solve the problem.

What is the concept of OO programming?

Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.


1 Answers

A very good question and something that I have thought about some time ago. This is my conclusion \ opinion:

  1. The idea of object oriented programming is not without flaws, but does provide the most complete design paradigm. If the problem domain is expressed properly, clearly defined object, who knows their responsibilities, can interact in a fairly elegant way, that closely resembles the real world interaction of the objects. (or ideas).

  2. To make some of the more abstract concepts, specific, OOP makes some assertive statements. (Like encapsulation, not expose more than you have to and object responsibility).

  3. Like all generic assumptions, there would be exceptions, when what normally would be a good idea, may not fit a particular problem in hand. It is also not helped by the fact that OOP, covers almost all problem conceived ( unlike AOP or even the more complex semantic modeling, that caters to a specific kind of problem).

  4. So in situations, when you need to make exceptions and move away from OOP assertions, the designers needed a way to keep in bounds of good design, so that they do not stray far too much from accepted design practices.

  5. So design patterns, for me is just case studies of problems, that will not be served by some of the core assertion of OOP. Apart from collaboration and collation of solution, design pattern also helps augment OOP. (especially for newbie designers).

Note: Most of the time, design patterns are not needed. There needs to be, clear justification for using patterns. I know, some greenhorns, trying to implement some design pattern, just because they know them ( and sometime not so greenhorns ;)). Its square peg, round hole problem

like image 165
uncaught_exceptions Avatar answered Sep 19 '22 23:09

uncaught_exceptions