Skip to main content

FOOP

I have been caught at odds when asked about some of the key differences between Object Oriented Programming and Functional Programming. In fact I’ve felt somewhat like a fraud, in that I regularly work in both paradigms. I often keep in mind the many of the precepts of functional design in the methods of objects I am creating.

So, I was looking to see what others had to say on FOOP (Functional Object Oriented Programming - or perhaps POOF “Programming Object Oriented Functionally”?) and I came across a post on Lambda the Ultimate which let me know I am not alone.

This lead me on to further investigations on the questions I was pondering such as where the different types of programming work - and when they don’t. A good synopsis of this started on Stack Exchange of course... These readings exposed me to a key nub of the problem - concisely stated, which has the name of “The Expression Problem”.

The expression problem is well stated in the best answer in the stack exchange post:

  • Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and the existing classes are left alone.
  • Functional languages are good when you have a fixed set of things, and as your code evolves, you primarily add new operations on existing things. This can be accomplished by adding new functions which compute with existing data types, and the existing functions are left alone.
A look at the expression problem in detail with some ideas towards solutions is nicel addressed in Eli Bendersky’s blog post . His post seems to fit well with the some of the original literature on the problem

This bit of diversionary reading has me puzzling over some recent designs in C#, and I am also thinking of solution to the expression problem in JavaScript (where I am not even convinced I can call it a problem).

Comments

Popular posts from this blog

Unit Testing - What to Test

This I wrote to answer a question that came up when we were discussing our software process and I was training developers on how to unit test. It seems a simple enough question, but I kept pondering it and delving deeper until I realized I needed to write this monograph. What unit tests should we write? How do we know what to test? Ideally, unit tests should cover every path through the code. It should be your chance to see every path through your code works as expected and as needed. If you are practicing Test Driven Development then it's implied everything gets a test. In the real world, you might not be allowed to test everything - for instance, if the testing suite ends up taking a week to run, then the world will have changed by the time it finishes and the test results will be obsolete. Unit testing at it's basic is testing an object, a method - the smallest unit of your code that it can test independently. It should test the inputs "goes into" an...

Healthcare and Health Informatics Glossary

Here is a glossary of terms useful in Healthcare and Health Informatics ACO (Accountable Care Organization) MEDICARE’s outcomes-based contracting approach Arden Syntax an approach to specifying medical knowledge and clinical decision support rules in a form that is independent of any EHR and thus sharable across hospitals ARRA (American Recovery and Reconstruction Act) the Obama administration’s 2009 economic stimulus bill Blue Button an ASCII text based standard for heath information sharing first introduced by the Veteran’s Administration to facilitate access to records stored in VistA by their patients. The newer Blue Button + format provides both human and machine readable formats. CCD (Continuity of Care Document) an XML-based patient summary based on the CDA architecture CCOW (Clinical Context Object Workshop) an HL7 standard for synchronizing and coordinating applications to automatically follow the patient, user (and other) contexts to allow the clinical u...

It's all broken...

So, Scott Hanselman struck a chord again:  Everything's broken and nobody's upset . The worst part is I can see that I'm part of the problem on both sides . I've excused many problems with software - shrugging as I restart the software or reboot. I save my anger for those occasions where I fell I've lost serious work and substantial time. Other than that I accept problems, glitches, crashes as "the cost of doing business". I believe it's actually because I've amused myself and earned a living creating software, that I am able to accept what's often pitiable quality. I've spent time working on systems that are not much more than breadboards with wires cascading from it, where getting something, anything to work was a huge accomplishment. But that was then and this is now. No way would I put up with a car that suffers from numerous small problems as today's software can. And putting these two thoughts together, it's now frightening ...