OOP Isn’t a Fundamental Particle of Computing
Programming in the 21st Century - James Hague - November 13, 2012The biggest change in programming over the last twenty-five years is that today you manipulate a set of useful, flexible data types, and twenty-five years ago you spent a disproportionately high amount of time building those data types yourself.
C and Pascal—the standard languages of the time—provided a handful of machine-oriented types: numbers, pointers, arrays, the illusion of strings, and a way of tying multiple values together into a record or structure. The emphasis was on using these rudiments as stepping stones to engineer more interesting types, such as stacks, trees, linked lists, hash tables, and resizable arrays.
In Perl or Python or Erlang, I don’t think about this stuff. I use lists and strings and arrays with no concern about how many elements they contain or where the memory comes from. For almost everything else I use dictionaries, again no time spent worrying about size or details such as how hash collisions are handled.
I still need new data types, but it’s more a repurposing of what’s already there than crafting a custom solution. A vector of arbitrary dimension is an array. An RGB color is a three-element tuple. A polynomial is either a tuple (where each value is the coefficient and the index is the degree) or a list of {Coefficient, Degree} tuples. It’s surprising how arrays, tuples, lists, and dictionaries have eliminated much of the heavy lifting from the data structure courses I took in college. The focus when implementing a balanced binary tree is on how balanced binary trees work and not about suffering through a tangled web of pointer manipulation.
Thinking about how to arrange ready-made building blocks into something new is a more radical change than it may first appear. How those building blocks themselves come into existence is no longer the primary concern. In many programming courses and tutorials, everything is going along just fine when there’s a sudden speed bump of vocabulary: objects and constructors and abstract base classes and private methods. Then in the next assignment the simple three-element tuple representing an RGB color is replaced by a class with getters and setters and multiple constructors and—most critically—a lot more code.
This is where someone desperately needs to step in and explain why this is a bad idea and the death of fun, but it rarely happens.
It’s not that OOP is bad or even flawed. It’s that object-oriented programming isn’t the fundamental particle of computing that some people want it to be. When blindly applied to problems below an arbitrary complexity threshold, OOP can be verbose and contrived, yet there’s often an aesthetic insistence on objects for everything all the way down. That’s too bad, because it makes it harder to identify the cases where an object-oriented style truly results in an overall simplicity and ease of understanding.
(Consider this Part 2 of Don’t Distract New Programmers with OOP.)
Categories: Blogs Programming in the 21st Century
Erlang on Twitter
» bagus_erlang (Bagus erlanggono): @dindaladin hahahahhahah kocak lu ah..hahahha
» dindaladin (AdinKha): Iyaa om RT”@bagus_erlang: dindaladin hahahahahah iya emak -___-
» tsbps (とうた): 最初はErlangを勉強するつもりが、気付けばHaskellを学んでいて、純粋関数言語をとりあえず理解しない事には始まらないのはわかった。
» DogWhisperer00e (Cesar Millan): @mattalmon_ also the generic unix package will let you use the erlang you have installed
» podmostom (Jonn Mostovoy): RT @totallyerlang: The two day Erlang Camp Amsterdam in August is being sponsored by Spil Games. http://t.co/aEHM8xm9u3
» bagus_erlang (Bagus erlanggono): @dindaladin hahahahahah iya emak -___-
» ErlangInfo (Erlang!): RT @totallyerlang: The two day Erlang Camp Amsterdam in August is being sponsored by Spil Games. http://t.co/aEHM8xm9u3
» dindaladin (AdinKha): Jangan gede2, nanti gajah bisa masul tai ke mulut lo hahaha :) @bagus_erlang: dindaladin hahahahaha,ngakak gua hahahahaha
» hiphoox (Norberto Ortigoza): .@MachinesAreUs @sergiodnila así es. Ya estoy usando la versión R16 de Erlang. Esta increíble
» bagus_erlang (Bagus erlanggono): @dindaladin hahahahaha,ngakak gua hahahahaha
Statistics
Number of aggregated posts: 10651
Most recent article: May 21, 2013
Latest comments
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…