changing comp sci for all the wrong reasons

December 15, 2011

Normally, I try to keep this blog from straying into minutia or the fine points of computer science because how to write and debug code isn’t exactly a rousing topic that will be eagerly read by someone not looking for a very specific issue to solve. However, this little tidbit of news has been bothering me since it surfaced in March on the web and was brought up in several of my architecture classes, and dammit, it’s getting a post. Now, don’t worry, there won’t be any code samples or in depth analysis of how to write methods and classes. No, this is about the professors at Carnegie-Mellon University deciding to drop object-oriented programming as a comp sci course requirement, stating that it’s inferior to functional programming and unsuitable for student use, and instead, teaching good, old fashioned C to their undergraduate students. All fine and good were we back with the programming paradigms of, oh, three decades ago or so, but certainly not adequate for today’s world where object-oriented programming is considered to be the de facto standard for design and development.

To be fair, there really is a germ of a point in their view of functional vs. object-oriented programming but their ultimate decision is both baffling and based on a number of statements and assumptions that are confusing to put it mildly. Let’s get familiar with the difference between procedural and object-oriented programming first though. Perhaps the easiest and most straightforward way to think about the disparity in the approaches is to consider procedural programming as exchanging data between functions which perform calculations, logical operations, and basic manipulations of data, and object-oriented programming as exchanging objects which are instantiated to hold and manipulate data. The former is extremely useful for calculations and retrieval and storage of data. The latter is extremely useful for dealing with complex custom entities and higher-level logic on these custom entities. So it would be one thing if CMU decided that procedural programming was the way to go because they wanted to focus on a certain type of applications. But instead they said the following…

Object-oriented programming is eliminated entirely from the introductory curriculum, because it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern [ Comp Sci ] 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.

Whoa, whoa… back it up, back it in, let me begin, to quote the poets of Basement Jaxx. Modularity in programs depends on their design because at the end of the day, you’re dealing with the same data types in a different set of containers and at different levels of abstraction. To simply say that it’s easier to plug new functions into existing function sets than a new class into existing business logic ignores how such functions and classes are meant to work together. If you simply try to dump new methods and collections into an existing program, it will have about the same results as trying to shove a triangular peg into a circular hole. To someone like me, who works with SOA architecture, modularity is taken for granted and modern object-oriented languages can easily handle object exchange between very different systems, much less within the same application. And in the same vein, we can also disagree about the supposed anti-parallelism of object-oriented programming. In languages able to use the .NET LINQ library (such as VB, C#, Iron Python, and C++) and Java, built in or quite easily added utilities can easily parallelize computation so the basis for this critique is simply wrong.

It seems that the committee which decided on this change looked at object-oriented programming sometime between the 1980s and the mid 1990s, decided to write if off, and after years of neglecting to catch up with the tools and architectural approaches using this paradigm, decided to consign it to the optional bin. This myopia is going to hurt their students when they try to find a job after college since most programming in the business and government realms relies on object-oriented languages, and demonstrates an alarming lack of familiarity with what goes on outside CMU’s ivory towers. Modern object-oriented languages and all their offshoots have been trending towards hybrid approaches with function-like utilities or allowing classes to be optional instead of treating every block of code as part of an object to be instantiated and ran, trying to incorporate the strengths of the procedural paradigm. To leave them off your computer science program is to turn your program into an endangered and very vulnerable creature and do a major disservice to your students. If they find designing an application with objects too difficult, well… maybe they should study harder or reconsider their major.

Share
  • http://www.chriswarbo.tk Warbo

    The article you linked to doesn’t make any specific mention of procedural programming at all. It discusses imperative programming (performing a sequence of steps) and functional (evaluating and/or composing functions).

    Also, LINQ is pretty functional (first-class functions, monads, etc.)

  • Greg Fish

    CMU is using C for their introductory comp sci class and C is a procedural language. And what is procedural programming other than just another way of doing imperative programming?

    LINQ is a .NET library offering useful extension methods for collections and C# 3.0 and above offers first class functions as part of the code (i.e. Funcs and Action classes) as well as delegates.

  • http://www.chriswarbo.net Warbo

    C certainly is a procedural language, not at all a functional one (unless you count Conal Elliott’s tongue-in-cheek arguments http://conal.net/blog/posts/the-c-language-is-purely-functional ).

    The report http://reports-archive.adm.cs.cmu.edu/anon/2010/CMU-CS-10-140.pdf only mentions Python. This would make sense for the imperative parts of the course and the introductory functional parts, but considering how much practical functional programming relies on type theory, I assume they’d be using Haskell or ML for later stages.

  • Greg Fish

    Wow, we’re getting really deep into semantics here, aren’t we?

    After reading the report, I still stand by my original criticisms. You can do parallel and distributed computations with an OO language and their concept of modular design hasn’t been updated since 1990.