开发者

Some solid OOP criticism? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.

I want to ask you to provide m开发者_StackOverflow中文版e with some articles (maybe books), which you possibly have found very convincing criticising the OOP methodology.

I have read some in the WWW on this topic and I didn't really find a 'definitive demotivator'.

It's not much about my personal attitude to the OOP, but I really would like to have something constructive, rigorous foundation for any kind of discussion and just abstract thinking.


You can post some original research too, but please be very constructive (as my personal request).


Which version of OOP? Alan Kay's original vision? The bastardized modern form of it that misses the point entirely and thus encumbers us with bizarre access control, member variables, etc? Inheritance-centric? Prototype-based? Compositional OOP?

Each form of OOP has its strengths and its weaknesses; its advocates and its detractors; its domains of utility and its domains of uselessness. There's nothing magical about OOP that makes it the Killer Paradigm and there's nothing infernal about it that makes it the Killer (of Programmers) Paradigm.

I can't really point you to any books or articles that killed my interest in OOP as a Silver Bullet (as opposed to one of many techniques I can use to keep my projects survivable). I can point to the funniest critique of a specific brand of OOP, however: Steve Yegge's classic "Execution in the Kingdom of Nouns".


Rick Hickey's Are We There Yet ? - A Deconstruction of Object Oriented Time was an eye opener for me. It's the most logical OO criticism I have come across.


If you want a criticism of OO programming, here's what I'd recommend:

  1. Learn Smalltalk
  2. Learn Erlang
  3. Learn Scheme

Once you've done that, you will have plenty of criticism of the common interpretation of OO programming.

(Hint: OO was in many ways intended to more closely resemble the Actor model of computation, but the common interpretation of it is effectively a modification of the procedural/structured model)


Problem is - most people don't really know Object-Oriented Programming, so many designs SUCK.

Read the works of Scott Ambler, including his (now pretty old) Building Object Applications That Work. This has been eye-opening for quite a lot of people.


Maybe not quite what you were looking for but have a look at the Jan/Feb issue of IEEE Software magazine: Object-Oriented Analysis: Is It Just Theory?. The basic conclusion is that OOA does not provide a good cost/benefit ratio so is poorly utilized.

Given that OOA is not effectively utililzed or supported in the "real world", I suspect that for larger development projects the overall system architecture, deployed object model and class hiearchy end up being sub-optimal and poorly understood (implemented) by various parts of the development team. A second article in the same journal: Four Trends Leading to Java Runtime Bloat point to some common OOP issues that detract from deploying high-volume Java (OOP) systems. The observations made in this article probably apply to most highly architected OOP applications.

Do not take this as OO bashing, it just reflects that as software practictioners we have quite a bit of work to do toward developing better person-to-person communication mechanisms to convey highly complex and abstracted process models.


When you define a process in natural language. You use sentences where you define the subject who will do an action on one or more objects.

The only fix point is the action, the predicate of the sentence.

I don't think assigning actions to objects is a good idea. There is only one verb, but can be multiple nouns.

In OOP you can write a file in at least 3 ways:

file.write(data);

or

data.writeToFile(file);

or

OperatingSystem.write(file, data);

Which object should implement the method? You need to think about this too. While in the procedural way, you probably write

write(file, data);

And the only thing you need to think is the order of the operands which is usally does not matter.

(Well file and data may not be the best example but you probably see the point)


You should really see Mr. B. Jacobs's:

OOP Myths Debunked

(also known as OOP Oversold.)


http://cat-v.org has a great page on Object Oriented Programming.

Most of the page consists of humorous but not terribly informative quotes. However, at the bottom of the page are a number of links to articles challenging OOP. They are:

  • Bad Engineering Properties of Object-Oriented Languages by Luca Cardelli.
  • Why OO Sucks by Joe Armstrong
  • Pitfalls of Object Oriented Programming – By Tony Albrecht of Sony Computer Entertainment Europe, Research & Development Division.
  • Object-Oriented Considered Harmful by Frans Faase.
  • Object Oriented Programming Oversold!
  • I Hate Patterns – By Parand Tony Darugar.
  • Why arc Isn’t Particularly Object-Oriented – By Paul Graham.
  • The questions about inheritance in the Java IAQ.
  • Stop Writing Classes – Great talk about how classes are often used and abused. By Jack Diederich.

If you are interested in alternatives to Object-Oriented Programming:

  • cat-v.org. From their 'about' page: Cat-v.org hosts a series of sites dedicated to diverse subjects that share an idiosyncratic intellectual perspective, questioning orthodoxy and fomenting elitism and high standards in topics from software design to politics, passing by art and journalism and anything else interesting.

  • Structure and Interpretation of Computer Programs. Specifically teaches functional programming. Available free online here, for sale here. I cannot recommend this highly enough. It is absolutely revolutionary. It will change the way you think.

  • Any and all writings/videos/lectures by Rob Pike and Steve Yegge. Of particular interest is Yegge's Whirlwind Languages Tour.


I'd recommend learning a different programming paradigm or reading pro arguments for specific paradigms (http://www.info.ucl.ac.be/~pvr/VanRoyChapter.pdf). Besides OOP, I think the most widely used is the functional paradigm (search f.e. "Why functional programming matters"), but also have a look at the other ones. When you start looking at programming from a different perspective, the flaws of OOP start to appear automatically.

Simple exercise: define the objects IPerson, CMale and CFemale and implement the methods "sex" and "reproduce".


hows about steve yegge's execution in the kingdom of the noun for java style OO


The Gideon Bible of object-oriented design patterns, aptly named Design Patterns. One of the best software design books I've ever read.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜