1

easy theory question. I have a couple years experience with PHP and Javascript, trying to branch out into other languages and to connect my experience with some theory.

Have been reading about programing paradigms like imperative, functional, object-oriented, etc. Is there any reason, within a particular program, to commit to one paradigm or another? I can think of reasons to mix, say, object oriented statements with functional statements, but then yo read about like, whole languages that 'belong' to a paradigm (like Lisp and functional programming, for example)

Is there any reason or advantage to commit to a particular paradigm, or is it okay to just roll with what works?

user173361
  • 137
  • 7

1 Answers1

2

Most software today is built using Object Oriented Programming, because this paradigm makes it easy to organize large amounts of code. With that said, the more paradigms you know, the better.

One particular paradigm of interest is functional. While pure functional programming isn't used very often in industry programming, a lot of the ideas are currently spilling over to Object Oriented languages like Java and C# (like the concept of first class functions, and avoiding mutation). Once you learn new paradigms, it'll change (and often improve) the way you program in other, more common or popular programming paradigms.

Oleksi
  • 12,947
  • 4
  • 56
  • 80
  • Object Oriented is what comes naturally to me, but I do find myself dropping some functional stuff in there from time to time. A guy I worked with partially rewrote something I did (in what I now see to be imperative style) and it confused the hell out of me, I just wasn't sure what he was trying to do. I'm still new at this, would you say mixing styles like that is good, bad, or just how shit gets done? – user173361 Feb 08 '12 at 23:57
  • There isn't really a problem with style mixing, as long as you don't use conflicting things from languages. You should try to take the best subset of each paradigm that isn't conflicting. – Oleksi Feb 08 '12 at 23:59
  • That's great man, thanks for the feedback. All appreciation and respect. – user173361 Feb 09 '12 at 00:05