background preloader


Facebook Twitter

Goodbye, Object Oriented Programming. Goodbye, Object Oriented Programming I’ve been programming in Object Oriented languages for decades.

Goodbye, Object Oriented Programming

The first OO language I used was C++ and then Smalltalk and finally .NET and Java. I was gung-ho to leverage the benefits of Inheritance, Encapsulation, and Polymorphism. The Three Pillars of the Paradigm. I was eager to gain the promise of Reuse and leverage the wisdom gained by those who came before me in this new and exciting landscape. I couldn’t contain my excitement at the thought of mapping my real-world objects into their Classes and expected the whole world to fall neatly into place.

The Wrong Abstraction — Sandi Metz. I originally wrote the following for my Chainline Newsletter, but I continue to get tweets about this idea, so I'm re-publishing the article here on my blog.

The Wrong Abstraction — Sandi Metz

This version has been lightly edited. I've been thinking about the consequences of the "wrong abstraction. " My RailsConf 2014 "all the little things" talk included a section where I asserted: duplication is far cheaper than the wrong abstraction And in the summary, I went on to advise: prefer duplication over the wrong abstraction This small section of a much bigger talk invoked a surprisingly strong reaction. Why I wouldn’t use rails for a new company. We built Scribd into the #3 largest rails site by traffic and it worked for us, but these days I see a lot of new companies using rails and it feels like a mistake.

Why I wouldn’t use rails for a new company

I started using rails in 2006 right after DHH’s screencast which introduced rails to the world with a bang. We wrote the first version of Scribd in rails 0.7, when they hadn’t yet invented fancy things like migrations. At the time, rails had buzz but was far from a safe choice. Most new sites were still being written in PHP or Java, and there were huge numbers of engineers for those platforms. We were making a bet that rails would continue to gain mindshare, creating a deep set of open-source libraries and, most importantly, a pool of developers interested in working in it. The Single Biggest Mistake Programmers Make Every Day — JavaScript Scene.

The Single Biggest Mistake Programmers Make Every Day.

The Single Biggest Mistake Programmers Make Every Day — JavaScript Scene

Simple > complex > complicated. Complicated: involves in too many affairs I once wrote a musical score file parsing routine that goes through all the headers and events at once, all while keeping track the timing information, and generates an image from it.

simple > complex > complicated

The code does it in a very straightforward way. No fancy abstractions, just pure and straight code. That PHP script doesn’t even contain the word ‘function.’ Of course, the script also handles file uploads. But it is hard to test — you can only test the final results, and it is not reusable — you can’t just reuse it in another use case. Object-Relational Mapping is the Vietnam of Computer Science. I had an opportunity to meet Ted Neward at TechEd this year.

Object-Relational Mapping is the Vietnam of Computer Science

Ted, among other things, famously coined the phrase "Object-Relational mapping is the Vietnam of our industry" in late 2004. It's a scary analogy, but an apt one. I've seen developers struggle for years with the huge mismatch between relational database models and traditional object models. And all the solutions they come up with seem to make the problem worse. I agree with Ted completely; there is no good solution to the object/relational mapping problem. Ted posted a much anticipated blog entry analyzing the ORM problem in minute detail. Ted's post is excellent and authoritative, but it's a little wordy; I felt like I was experiencing a little slice of Vietnam while reading it. Abandonment. Ted quickly posted a followup entry which addressed common criticisms of his original post.

To Be Future Friendly Is To Be Device Agnostic by Joe McCann. Whoami @joemccann joemccann Github Creator of Partner at The Node Firm I Blog Here on Open Source Advocate & Contributor Mobile & Platform Architect at Bazaarvoice Client Sends Request → Full Response Comes Back ←

To Be Future Friendly Is To Be Device Agnostic by Joe McCann

Inheritance is evil, and must be destroyed. When I built Animator.js, I got some flack for suggesting that inheritance is not a Good Thing.

Inheritance is evil, and must be destroyed

Keen to avoid a holy war I restated my position to ‘inheritance is often useful, but more often overused.’ Over the last few months I’ve been trying to figure out exactly when it should be used, and have concluded – at least for the kind of systems GUI developers build – never. I’ve been working on a Flash port of Animator.js that’s been pumped up on performance enhancing drugs and given a flame thrower. It’s a fairly complex software component with around 30 classes, but it uses the Strategy Pattern instead of inheritance. I’ve grown fairly passionate about my anti-inheritance stand, and want to take some time to explain myself.

The code samples for this article are in Actionscript but the concept applies just as much to JavaScript, or indeed any object oriented language. Why inheritance sucks Skip this and go straight to the code, if you like Eh? Now suppose you had done it like this: An example.