PDA

View Full Version : The Growing Backlash to Object Oriented Programming.



robertoortiz
06-28-2013, 10:31 AM
Rob note: We rarely talk about what under the hood of what we do… I think this is a topic that would interest a lot of you.
ANd I do know this will be controversial since OO has its fans and its place (you could not have made Maya without OO).

"The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle."

Joe Armstrong


Recently I have noted a trend that there seems to be a growing backlash against Object Oriented Programing Languages.

"Object-oriented programming (OOP) is a programming paradigm that represents concepts as "objects" that have data fields (attributes that describe the object) and associated procedures known as methods. Objects, which are usually instances of classes, are used to interact with one another to design applications and computer programs.[1][2] Objective-C and Java are examples of object-oriented programming languages."
http://en.wikipedia.org/wiki/Object-oriented_programming

For a lot older developers (like me) we feel like things changed for the worst in the programming world after the mid 90's. Applications that were developed by small teams in a very short amount of times, all of the sudden started taking longer to develop and maintain.

We used to have a now unheard of 6 month development cycle, and all of the sudden it jumped to years. And the teams started getting larger and larger.

What changed?

Object Oriented programming took over the programing world almost like a cult.


Paul Graham has suggested that the purpose of OOP is to act as a "herding mechanism" that keeps mediocre programmers in mediocre organizations from "doing too much damage". This is at the expense of slowing down productive programmers who know how to use more powerful and more compact techniques


And more recently (in 2011) Object Oriented Programming was eliminated from the Carnegie Mellon University Computer Science Introductory Curriculum
Professors Robert Harper and Dan Licata, Professors of Computer Science at Carnegie Mellon University, explained in a a blog why they decided to "eliminate entirely" OOP from the introductory curriculum.

“it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum. A proposed new course on object-oriented design methodology will be offered at the sophomore level for those students who wish to study this topic.”

Instead they are teaching "Functional programming (http://en.wikipedia.org/wiki/Functional_programming)"

I am looking forward to your comments and opinions.

Ryan Roye
06-28-2013, 11:20 AM
From my perspective, the point of object oriented programming isn't for long-term software, it's for constructing software from the ground up faster.

You think of all the programming languages floating out there and it is pretty easy to see why people wouldn't want the learning process to be complicated. I hate bloatware just as much as anyone else, but there is a line that has to be drawn. Inefficiency is acceptable when the final result has zero impact on the user's experience and proper modular methods are used to keep the code manageable. The key is understanding how expandable any given program is and planning ahead if creating something that will outgrow object-oriented programming (IE: A company that manages gargantuan databases).

You can use a paving machine to flatten dough... it doesn't mean you should go out and actually do it ;)

COBRASoft
06-28-2013, 01:04 PM
As a developer, I've written in assembler, C, C++, Fortran, Pascal, Cobol, JavaScript, Basic and .Net. I write software for 28 years already, so I have quite some understanding about OOP and all :).

OOP makes the live of the developer a LOT easier, makes code more readable and easier to understand. It gives programs more structure and guidance to newcomers to that code (junior developers). Many developers become system architects after 5 to 10 years now and don't develop so much code anymore, so it's mostly the younger developers who code what the architect tells them to code. A lot has changed since the nineties...

That said, I tell every graduate that comes in my company, forget everything you've learned about OOP and start from scratch, specially in the way you think about programming. For me, it is the computer that has to execute the code, not you. I suggest them to use OOP where it can be usefull and drop it on all other places. E.g. a 'person' or 'product' class to maintain all the values read from a database in memory. The code to read/write from the database must be as optimal as possible without the overhead. Same goes for a 3D object, all points/polygons/modifiers/history can be OOP. The drawing and manipulation part of that object must be as fast as possible and no OOP.
Too many teachers nowadays swear by OOP and multi-layer design patterns. Design patterns can be good as a guideline, not as obligatory.

Just my 2 cents...

stiff paper
06-29-2013, 04:27 PM
It's been a long time since I was a programmer, but...

Like almost every other "set of rules for doing things" in life, OOP came about because some crappy, worthless and incompetent people were completely unwilling to accept that it really was, after all, they who were crappy, worthless and incompetent. No, because crappy, wothless and incompetent people always know that it can't possibly be them. It must be the system that's wrong. And so they design a new system. One that they insist is much better. Unfortunately, the problem from the very beginning really was that they're crappy, worthless and incompetent, and so, naturally, is their new system. It's just better for them. Also, they design systems now instead of programming, so they never get that nagging feeling of crappy, worthless incompetence hanging around them like a bad smell.

dballesg
06-30-2013, 04:42 AM
For a lot older developers (like me) we feel like things changed for the worst in the programming world after the mid 90's. Applications that were developed by small teams in a very short amount of times, all of the sudden started taking longer to develop and maintain.

Beign a hobbist programer now, but done 6 continous years as a paid one, all for a span of 32 years.
I've seen come and go so many techniques and languages, more than the ones I want to remember.

My problem this days with all the OO oriented programming, its really it's implementation on the the languages and it's "real implementations" on the compilers.
C++11 for example with their new "icons" : [] for anonymous functions, really?
It wasn't easier to add a "anonymous" keyword??
Not other symbol that can be confused with an Array on so many other languages??? :cursin:

It remembers me threads we had here about the icons vs no icons on the GUI :devil:

How many times you find a nice open source library, and suddenly the errors you get trying to use it on another compiler? GCC, Intel or Visual C++ for example.
The indiscriminate addition of flags to make the compilers behave as well. The different ABI compatibilities you can find between C and C++, etc...

But remember where this languages originated, university labs mainly, and which proffesional fields made use of them forcing them into change so much.
3D was at it's infancy.

Last yeare tried to read a few articles about Haskell, I got a headache!! :(

And if someone is interested, I can't stop reccomending this book :
The Definitive ANTLR Reference: Building Domain-Specific Languages (http://pragprog.com/book/tpantlr/the-definitive-antlr-reference)

A fascinating read about parsing of languages and creation of language compilers.



"The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle."

Joe Armstrong

That quote we can apply it to the design of 3D programs as well.
As new versions come out, we start getting more and more tools, added on a disorganized and inconsistent way.
And that affects every single 3D application out there.

A big example comes to ming. The Qt library, started as really nice library, this days is a behemoth that takes hours to
compile. Only because everyone wanted a "unfied library" that did everything, from GUI, to networking, to OpenGL to sound.
I think we need to submit a request to Digia so it does our cooking as well!! :D

I think we only can be sorry for the development team trying to support two platforms at the same time.
And survive to those libraries commercial or not they need and force to use. Without theirs friend the compilers! :D
It's a daunting task. So our hats to them! :thumbsup:

P.D: That doesn't mean it will stop us to keep asking for the "best" and the latests innovations on the smallest time frame! :devil:

Cheers,
David

dsol
07-01-2013, 05:30 AM
The irony here is that OO was created in part to make it easier to maintain large projects. And generally it does do a better job at that than just bashing out everything procedurally in C. Maybe the problem lies with the fact that not all OO languages are equal - some have uglier syntax and weirder quirks than others, but the worst ones give the others a bad name.

As for parallelism and concurrency issues, procedural languages have EXACTLY the same issues as OO languages. Those are problems that are damn difficult to solve - and may require new languages and paradigms in order to tackle them best (for example, things like Google's Go)

VonBon
07-01-2013, 09:46 AM
so lets say in some language i have a "Sun" function = that computes the Sun to be orange
and its light shines yellow and the temperature is 3 million degrees.

OK so, I don't agree, i believe that the "Sun" function should compute the Sun to be Yellow
and its light shines orange but changes to yellow after going through the atmosphere of the
earth and the temperature is 5 million degrees.

:stumped: what language should i learn if i don't agree with predefined function libraries?

VonBon
07-01-2013, 09:49 AM
Also, would Functional Programming be used for things like programming an AI?

dsol
07-01-2013, 09:50 AM
so lets say in some language i have a "Sun" function = that computes the Sun to be orange
and its light shines yellow and the temperature is 3 million degrees.

OK so, I don't agree, i believe that the "Sun" function should compute the Sun to be Yellow
and its light shines orange but changes to yellow after going through the atmosphere of the
earth and the temperature is 5 million degrees.

:stumped: what language should i learn if i don't agree with predefined function libraries?

Um... in this case, you just have to write your own version of the function. Though a good "Sun" function - or Class - should offer methods to change these parameters.

dsol
07-01-2013, 09:52 AM
Also, would Functional Programming be used for things like programming an AI?

Well, no-one's actually "Programmed an AI" yet. Though for AI-like systems in games and simulations, OO coding makes vastly more sense - as each entity in the simulation will be an object (and the number can scale arbitrarily). Otherwise, you have to manually manage it with arrays and linked lists

GregMalick
07-01-2013, 10:20 PM
As a developer, I've written in assembler, C, C++, Fortran, Pascal, Cobol, JavaScript, Basic and .Net. I write software for 28 years already, so I have quite some understanding about OOP and all :).

OOP makes the live of the developer a LOT easier, makes code more readable and easier to understand. It gives programs more structure and guidance to newcomers to that code (junior developers). Many developers become system architects after 5 to 10 years now and don't develop so much code anymore, so it's mostly the younger developers who code what the architect tells them to code. A lot has changed since the nineties...

That said, I tell every graduate that comes in my company, forget everything you've learned about OOP and start from scratch, specially in the way you think about programming. For me, it is the computer that has to execute the code, not you. I suggest them to use OOP where it can be usefull and drop it on all other places. E.g. a 'person' or 'product' class to maintain all the values read from a database in memory. The code to read/write from the database must be as optimal as possible without the overhead. Same goes for a 3D object, all points/polygons/modifiers/history can be OOP. The drawing and manipulation part of that object must be as fast as possible and no OOP.
Too many teachers nowadays swear by OOP and multi-layer design patterns. Design patterns can be good as a guideline, not as obligatory.

Just my 2 cents...

I totally agree. I've worked in all those languages (plus RPGII and Python) and been doing it close to 40 years.
I gotta say that I am now working almost exclusively in Java using Eclipse - and it's a dream.
I absolutely adore it. Definitely a programming language written by and for programmers.
Can you write linear non-OOP - you betcha - and needing a quick utility I've done it a few times.
But OOP can be so elegant.

I want to stress that word ELEGANT.

Just like any language (English, German, French...etc.) you can write Prose or Poetry that is Clumsy or Elegant.
Same thing when programming.

Elegant code is clear and concise and easy to read and maintain.
It's extensible, nothing is cute or coded to be clever.
Words say what they mean and they are named in a standard way.
Methods are verbs and attributes/classes are nouns.

And if you've done your job right, you've written test tools that make regression testing a breeze.

Obviously, I love my job. And I love OOP - been doing Java for about 5 years now.
But it's like any human endeavor - there's The Good, The Bad, and The Ugly.

cheers
:beerchug:

COBRASoft
07-02-2013, 04:12 AM
For some reason, I fell in love with BASIC a long time ago and have used it ever since. I avoid Java and Eclipse (tried it, hated the language and IDE). For Android development I went to Basic4Android and DXTreme (DevExpress with .Net). .Net and Java are very alike actually when it comes to functionalities and possibilities. Semicolumns give me headaches :).

I totally agree on the elegant part of code. And yeah, sometimes you can write poetry with code!

rcallicotte
07-02-2013, 06:44 AM
I'm a programmer for a living and found that the benefit of understanding OOP is organization. That said, I implement what works, which I see more like the old C system - header files. The whole idea I need to complicate a cup of coffee is appalling and prevents the programmer from just getting the work done. On the other hand, organizational wisdom is imperative and that is what I've gleaned from the entire concept of OOP.

rcallicotte
07-02-2013, 07:03 AM
From my brother, who has programmed in C for about 35 years, speaking about OOP - "It's just a huge drain on efficiency. Instead of just getting one book out of the library you have to take the entire library, and lug it around with you. It also has hidden the technical information from the programmers. You don't care how it works any more just as long as it does."

dsol
07-02-2013, 07:24 AM
Sometimes efficiency is waaaaay less important than getting something working quickly. And the runtime speed benefits of working with procedural code (which isn't guaranteed either) are not outweighed by the increased complexity and - by extension - bugs that come with using that methodology for large apps.

Using existing libraries is smart - and there's a wealth of C++ libs out there. The best code is the code you don't have to write yourself!
http://www.codinghorror.com/blog/2007/05/the-best-code-is-no-code-at-all.html

HarverdGrad
07-03-2013, 10:02 AM
Teaching Functional Based programming for an "Introductory Curriculum" (note: INTRODUCTORY) makes total sense to me, because it's easier to grasp the concept of Inputs and Outputs with the function itself being blind to what is calling it, and where it will be used.

Overall, I think subject for this discussion topic is misleading. "The Growing Backlash to Object Oriented Programming" makes it sound like OOP has reached a critical point. Several sources are quoted from different places, different times, and possibly different context(?)
My awesome (not humble), opinion.

COBRASoft
07-03-2013, 04:05 PM
I think OOP has reached the same point that database managers (SQL Server, Oracle, DB2, ...) have reached. The now 'classic' model of normalization has fallen apart and more modern ways to approach this is by using NoSQL databases to store TB's of somehow structured data. Normalized databases can still be used, but for certain parts only. Instead of using 1 heavy, expensive computer to do the job, hundreds of cheap, small computers do the same job.

OOP will face the same 'problems'. Things like MVC, MVVM and so are nice in theory but slow things down too much, certainly on the net and smartphones. Direct HTML5 with JavaScript and CSS3 is the fastest way for the net and this will win in the coming years.

jwiede
07-03-2013, 05:49 PM
Overall, I think subject for this discussion topic is misleading. "The Growing Backlash to Object Oriented Programming" makes it sound like OOP has reached a critical point. Several sources are quoted from different places, different times, and possibly different context(?)

Agreed. Just because someone invents a socket wrench doesn't necessarily make the screwdriver obsolete. Devs always cycle between different "emphases" in design, implementation, and process management therein, and trending away from OOP towards functional does not automatically indicate a "backlash against OOP". Nor do teaching trends reliably translate into industry programming practices -- one only has to look at relative usage of java in academia versus industry to see ample evidence of that

tburbage
07-04-2013, 12:51 AM
I would question many of the assertions made in the original post. I don't sense any real "backlash" against OOP and design, though pragmatic programmers have learned not to go overboard with it. In application development, simplicity is a virtue for maintainability.

What OOP gave us was a way of conceptualizing software design in a way most ordinary people could get their head around. It made sense and helped us to be able to visualize data and the operations needed to act on it in a straightforward, logical manner. However, design of complex systems is very hard to get right, so it isn't surprising that OOP-related facilities of the popular languages could often be mis-applied, or over-applied, resulting in bloated software that was hard to maintain much less extend.

C++ was designed to be a better C and I think for the most part it succeeded. I work in an environment where virtually all product code is written in C++ (as are virtually all major commercial applications), and the only programmer I know who would go back to using C is over 65. Of course, C++ is a complex language and environment, especially where, as we do, everything has to be cross-platform. Where I feel any sort of "backlash" today is not against OOP concepts and design principles, but against unnecessary design and implementation complexity.

Per functional programming, that movement in modern times, at least in C++, has been driven by some brilliant folks who were first mathematicians, and second programmers. I had the privilege of working with Alex Stepanov, one of the original STL (C++ standard library) designers, who designed that library working very much from a mathematician's point of view. It emphasizes reusable data structures (containers) and standard algorithms which operate on them. That work has changed the face of C++ and how it is used in many ways, but IMHO it hasn't really changed the way most programmers approach application-level design, and it very much still uses many of the OOP facilities of C++ (so isn't in some way a repudiation of OO concepts).

I've participated in interviews of quite a few CS Masters grads looking for programming positions, and I can't think of one who cited functional programming as a focus in their studies. In fact, it was mostly Java, with some C and C++. And Javascript and web tech.

Python can be described as an OOP language, and as you know it is now the predominant platform used for extension of applications in the CG space.

warmiak
07-05-2013, 10:26 PM
I think OOP has reached the same point that database managers (SQL Server, Oracle, DB2, ...) have reached. The now 'classic' model of normalization has fallen apart and more modern ways to approach this is by using NoSQL databases to store TB's of somehow structured data. Normalized databases can still be used, but for certain parts only. Instead of using 1 heavy, expensive computer to do the job, hundreds of cheap, small computers do the same job.



NoSQLs serve different purpose than SQL databases.

The classic model hasn't fallen apart - it is still very much used for heavily transactional datastores - it is just majority of data being served out there can be pre-cooked into domain specific , denormalized documents and served in that form much faster and cheaper.

COBRASoft
07-06-2013, 05:08 AM
Indeed they serve a different purpose, but more and more applications benefit from NoSQL and denormalization. Our database is completely normalized (250+ tables) and slowly but surely we are dropping normalization steps in some tables for speed and less complex queries. A guy from Microsoft visited us the other day and he told us that SQL Server and the like are being used less in favor of NoSQL and similar solutions. We are making our 'own' hybrid system now using SQL Azure, Blob storage and tables. The speed gain was impressive and our customers are shifting fast to this new system.

That being said, any1 here uses OO database managers? I know they exist, but never used one.

IgnusFast
07-08-2013, 05:19 PM
OOP will face the same 'problems'. Things like MVC, MVVM and so are nice in theory but slow things down too much, certainly on the net and smartphones. Direct HTML5 with JavaScript and CSS3 is the fastest way for the net and this will win in the coming years.

You do realize that Javascript is also an OOP language, right?

I think OOP has it's place, like many other programming paradigms. Things like reflection, interfacing, and even general web services would be much more complicated without OOP.

jwiede
07-08-2013, 07:32 PM
You do realize that Javascript is also an OOP language, right?

Hehe, both the HTML5 DOM, and CSS3 model are based on object-oriented foundations as well. The idea that OOP is implicitly "slow" is no more accurate than any other such sweeping over-generalization. The devil is in the design details, and it's no help that "slow" is an extremely subjective concept.

COBRASoft
07-08-2013, 07:59 PM
.Net is also OOP if you want, but this doesn't mean you have to develop your own programs in complete OOP. As I said before, OOP has its benefits (and I use them for sure), but it shouldn't be the rule, more a guideline like I stated above.

If the cpu has to go through 100 lines of codes in 5 different classes to write '<p>hello world</p>', then the OOP idea has failed in my opinion. If you can use 1 line for binding a grid with a datasource, that's another story. But this still doesn't mean that the 1 line will execute faster than writing plain HTML with divs.

I find LINQ a beautiful example of OOP. LINQ can be a real time saver in many occasions for the developer, but sometimes a good old loop can be faster to get the desired result.

IgnusFast
07-08-2013, 08:05 PM
No doubt. I actually frequently write classes that contain only methods and public variables, only using properties either for serialization or eschewing them completely. I use the parts of OO that benefit me, without regard to much beyond functionality. But I love writing code in c# - .Net has been engineered to easily write fairly complex GUI applications with a minimum of user-written code. Especially using LNIQ.

warmiak
07-08-2013, 08:48 PM
For a typical program probably not ... but for performance sensitive code OOP is slower for modern CPUs because it is very cache-unfriendly.

With OOP most code gets organized in the form of

Object:
X
Y
Z

If you are want to quickly process tons of these ,and you are interested in some kind of aggregate of of Object.X values, you code will be much slower than if you were to organize your data in non OOP way ( X1,X2,X3 , Y1,Y2,Y3 , Z1,Z2,Z3 etc ...) vs OOP way ( Object1.XYZ, Object2.ZYX etc )

Silkrooster
07-08-2013, 11:07 PM
the thing that I noticed with most of the OOP languages is how similar they are in syntax. Making it much easier to learn more than one language (if needed). what I would like to see though is more JIT compilers for other systems. It would be kind of cool to stick with a single language and port to other systems. Or I should say stick with a language you already know and not be forced to learn another language unless you wish to.
So in that sense, I can see why .net was created even though it does create overhead. Frankly thats the part I like about C++ is the lack of overhead. Creating a single exe file with no libraries. But somebody had to make money and therefore there is the signature files.

Silkrooster
07-08-2013, 11:19 PM
For some reason, I am having a hard time getting my head around LINQ, ADO, Entity and any other database related framework. I think it is due to there being so many ways to access data. And MSDN library doesn't go into enough detail. For me anyway.

pauland
07-09-2013, 02:53 AM
Hmm.. crisis in Object Orientation? I don't think so.

I am a long term developer - so long term that I started programming at school in assembler code, later working through a plethora of non-OO languages - Basic, Fortran, Cobol, Algol, Coral 66, BCPL, C, Pascal. We did great things with those, but I can categorically say that productivity took a major leap forward when I started using OO based languages - particularly Java. Today most of my time is spent coding in Actionscript, Objective-C and javascript.

OO triumphs for a few reasons - organisation of code and hierarchy, class libraries that allow developers to piggyback on the work of others and extend their functionality comparatively easily. Hand-in-hand with OO technology has been the adoption of patterns for code organisation and operation - most notably MVC. MVC coupled with OO has transformed by productivity and removed the temptation to write rats-nest code that is hard to maintain and modify.

When I was introduced to OO techniques, the big thing that seemed to be touted as THE reason to use it was code-reuse. In my experience that hasn't been the case, except through the class libraries supplied with the language, or specialist class libraries for a specific problem domain.

Writing code using OO techniques isn't a magic bullet to code greatness. I can write code badly just as well now as I ever could. With more experience I can probably write seriously bad code. I'm not an OO purist, I write code the best way I can to get things done with regard to future maintenance by other developers and hopefully prevent my code not turning my code into an unmanageable mess.

One of my challenges is that working with developers of all kinds of skillsets, I sometimes tweak my code if they aren't familiar with some OO techniques or patterns, just so they can follow what is happening.

It used to be that my code would have taken months or years to write and have a lifetime of many years, but these days I write code faster and it becomes disposable because technology and requirements change much more quickly. Thank Goodness for OO, I say.

There is no crisis in OO development.

COBRASoft
07-09-2013, 05:21 AM
For some reason, I am having a hard time getting my head around LINQ, ADO, Entity and any other database related framework. I think it is due to there being so many ways to access data. And MSDN library doesn't go into enough detail. For me anyway.

LINQ requires some time to get used to, specially with Lambda expressions directly in your code. The nice thing is that you can learn it by using it on Lists and arrays. So, no need to implement database stuff in the beginning if that scares you.
I used to work with Typed Datasets for a long time. I've used EF for a very short time and now I'm using DevExpress XPO for everything. The speed of XPO (CRUD) is simply amazing compared to all the other technologies. EF is probably the most simple one to learn, just 'learn' that you have to use the ObjectContext to get something done and why you have to use it. From there, the rest get's easier.

Lightwolf
07-09-2013, 07:07 AM
I agree that the major advantage of OOP is how you think about your code - which can translate to non-OOP languages as well (but also makes things a bit more verbose then).

Also, the amount of baggage varies a lot from language to language. C++ for example has been designed in a way to only impact performance if functionality not present in C is used (and even then it's not necessarily true and has also improved quite a lot since the inception of it).

I would argue that, in the end, it depends a lot of the domain one develops in. It makes little sense to start a, say, CG application using one of the few functional languages and then needing to struggle with required (to make it a full blown application) libraries that are developed in C/C++ - or to implement them from scratch (simple example: OpenEXR).

So, effectively, not much has changed. What and how to use it depends on the judgement of the developer. If the access pattern is a struct of arrays and not an array of structs, then one needs to design for it.

Cheers,
Mike (Basic, Assembler, Modula-2, C, LScript, AS, Lingo, JS, PHP, C++, C#, Obj-C)

roboman
07-11-2013, 08:28 AM
I did some software for a machine control and a new engineer rewrote it all in oo formats. Of course he blew off all the comments in the rewriting. Once the comments and a bunch of notes on the objects were added back in, it was a little bit easier to update and add things, but was a bit bigger and the controller needed to run through a bit more excitable steps to do the same job. I was never in love with oop. Some times it's useful and other times it's not. It's kind of like the other extreme from assembly language. OOP is less like the computer thinks and closer to the way people think, so you throw the extra onto the computer to make it easier on the programming side, assembly you throw the whole idea of needing to do things the best way for the computer onto the programmer, but it would take a life time to write a really large program. Tools and trade offs. Software needs to execute as you can get it to in x amount of development time, so you use the tools that will get you there, with the idea that the next ver also needs to be done in x amount of development time. So you use oop where it makes sense and throw in as much asm to speed up critical areas as time permits and where it will actually be faster. It would be nice to write every thing in optimized asm with no OS over head, but that could take several life times on a program as large as Lightwave