Love this essay, I still can't (don't want to) find an appropriate way to OO.
paulgraham.com
paulgraham.com
I can't stand Java for the very same reason: it was created with a very specific commercial purpose in mind: to have enterprise software projects done cheaply. This implies that language should be simple enough (inexpensive training, armies of dispensable coders) and restrictive enough (cheap QA) to cheaply build systems that transfer data from one database to another. Sun, do not forget, is a hardware company. And what many hardware companies want, is to turn software into irrelevant commodity.
It was created to control embedded processors.
I don't use Java because it is too limiting, resulting in inferior/average performance (R&D team's performance, not code's).
I think pg is right not to rush to implement an object system in arc. There are many opinions about what the right object system looks like. Anybody without an opinion should stay out of the way. Someone else can implement an object system for arc later.
Besides, most of pg's gripes about OO are mostly gripes about bad programming. I've seen some seriously elegant stuff done in even the uncoolest of languages. Google runs entirely on OO languages (C++, Java, Python), and you'd be hard pressed to find someone willing to criticize their codebase for bloat, duplication, or inefficiency.
There're some interesting questions about what makes a language an 'OO' language. For one, does a language need only to provide facilities for OO, or must it enforce OO approaches? For another, what flavor of OO must it support or enforce?
Most 'modern' languages will provide facilities that can be seen as supporting some form of OO; data structures are mandatory, and methods are an easy extension of them. However, most of these languages don't mandate an OO approach to coding; for instance, C++ (aka C/C++) doesn't and Python doesn't, although Java may be more dogmatic on the question. (A language that mandates OO approaches wouldn't be to my taste, because I don't believe those approaches to be appropriate for all problems.)
So, it's a bit of a non-sequitur to proclaim that the virtues of OO are demonstrated by the use of 'OO languages'; unless those languages mandate OO approaches you'd need to look at how those languages are being used in practice.
In bad code you can see, for example, a lot of duplication (literally copy and paste) of some small 3, 4, 5-line pieces only because a coder was too lazy to declare another method in the class. In fact in most of such cases a simple static function was needed, not a method. These coders are usually surprised to hear that static/global functions aren't bad, if not best.
Bu that's, of course, is not the only problem with OO.
"The aim of the C++ class concept is to provide the programmer with a tool for creating new types that can be used as as conveniently as the built-in types. [...] A type is a concrete representation of a concept. For example, the C++ built-in type float [...]" --Stroustrup
This emphasis on concrete types is how I use and think about objects. If it doesn't cleanly act like a concrete type, I prefer to write a library that provides the data structures and related functions separately to the user. I hate how languages like Java shoehorn EVERYTHING into objects. It's very useful to keep the distinction between what cleanly forms a type and what doesn't.
"I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." - Alan Kay
I think in Java you actually can access the private methods of an object via Reflection, if you absolutely want to.
This sort of encapsulation is not specific to OO. You can hide data and methods within modules without using classes. In C++ terms you use anonymous namespaces. In C, perl, python(?) and other languages a leading underscore or "static" declaration conveys encapsulation, which is good enough as far as I'm concerned.
Having your whole site as a single class is convenient firstly as your constructor can handle the code that's common to each page, though you don't necessarily need OO to do this. Where this OO approach really shines thought is that you can create a more general web site class such as an online shop, and then subclass it for a particular instance of a shop for a client.
So, don't try to use pseudo arguments to say that object orientation is bad. It's not bad, it's very good. Defend your style, but don't do it by attacking our style. It's not politics here.
Schreiner is the German translation of Kernighan's books and this one is a nice example of using a preprocessor for C, written in awk, to gradually add OO to C so you can understand all the nuts and bolts under the hood of a "native" OO language. English translation PDF available for download. http://www.cs.rit.edu/~ats/books/index.html http://www.cs.rit.edu/~ats/books/ooc.pdf
http://www.amazon.com/dp/0201113716
As the name suggests, the language it describes was developed in 1980.
http://smbx.org/index.php/index.php?option=com_content&task=view&id=18&Itemid=76
If you choose OO, you are automatically bound to the OO limitations (no matter how sophisticated this might be) of the designers of a certain kind of OO.
Already the fact that there exist so many different OO ways, shows clearly that OO is no really uniform, plain and straightforward concept. It is always designed with a certain kind of problems in mind, while in practice every problem has its own needs...
If flexibility is more important to you than some programming paradigm or scheme to follow, you certainly don't choose OO (if possible, depending on the language).