|We don't bite newbies here... much|
Is it possible to meld OO and functional programming together? I mean more than just having closures as your attribute values, but really meld the two? Or, for that matter, meld OO and declarative or functional and declarative?
I'm asking the question because it's unclear to me if the various styles are blendable or not. And, this meditation just puts it into perspective for me.
My personal style is to use objects as the gross organizer, but to use a curious blend of procedural and functional within the methods of those objects. I use inheritance as a gross form of reuse and interface enforcement. (Except, of course, when I use it for other things.) And, declarative is used whenever I drop into SQL. Except, I build those declarative statements using that curious blend of OO, functional, and procedural.
Speaking of functional ... functional has always seemed, to me, to be more about data than OO is. Functional builds functions from functions, but that's just so you can process lists. The lists are what actually go through the functions-of-functions. So, in a way, functional programming is the style of programming most closely tied to the data-flow diagram. Everything just flows, like the Mississippi delta, at its own pace. Kinda like the Sixties.
OO, on the other hand, is much more like urban life. Everyone distrusts everyone, doesn't allow anyone to peek inside the windows, and everything has a contract. If you violate the contract, you're taken out back and shot like the dog you are.
Declarative, to me, has always seemed to be the style of programming that Louis XIV or Henry VIII would have used. "Give me THIS, and be snappy about it!" No if, ands, or buts.
Procedural is what you do when you're speaking to an 8 yr. old who just couldn't care about what you're asking, but he'll still do it. You just have to be really specific. It's not enough to say "Clean your room." You have to say "Pick up the stuff on your floor, organize your desk, make your bed, and fold your clothes". Even then, you'll miss something.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose