Very interesting question, I will attempt to answer all of your
questions here, but if I am unclear, or lacking on any point please
let me know, and I will try to clear things up. Just for your
information I am hold a BS in computer science and have been
professionally employed as such for ~5 years.
Ok here we go:
Differences between functional and objected oriented programming can
be summed up as follows:
In object oriented programming everything (or almost everything) is
treated as an object that can be modified and that can perform tasks,
or in OOP speak one might say objects have state and behavior. What it
buys you (among other more advanced things) is: modularity,and data
hiding.
Here is an example: You might have an object that models a ball, from
above the ball can be modified (i.e. you can change its state) for
example you may be able to change the color of the ball. It can also
perform tasks (i.e. it also has behavior) for example the ball can
roll, or be thrown. As an object it is bundled neatly in a package
that provides methods to change the state of the ball, and to make the
ball perform actions. This package is usually called a module, in
addition to the methods used to change state, and perform actions, the
module also has data that is used to store any state information
needed.
Because this module is a complete package that models your object
competely, the module can easily be reused in many different
applications. Once it is wirtten and working anyone should be able to
use the module without fully understanding internals. For examplea all
one needs to know is that they want a red ball to throw. :)
Here is a good resource on OOP:
"Object-Oriented programming concepts"
http://java.sun.com/docs/books/tutorial/java/concepts/
In functional programming what you have basically are a set of
functions each of which performs a task. Selectively executing these
function results in the solution to the problem at hand.
For example you might have a function that takes the coords. of a
square computes the area, and you may have another function that
computes the area of a triangle. By executing the square function 6
times you could compute the area of a cube. Or by executing a
combination of the square and triangle functions you could compute the
area of a rhomboid. As you can see you can build quite complex systems
based on simple functions.
Technically choosing OOP of FOP (or vice versa) you can always
accomplish the same results in either paradigm, however what may be
very easy to do with an OOP approach may prove to be very difficult in
FOP, and the converse may also be true depending on the problem.
Which leads to: Why has the whole world moved from FOP to OOP...
Welp this one is simple, it hasn't (in my opinion). Much of the world
is moving to OOP, and OOP is getting all the press of late. But there
is still a TON of work going on in the FOP world. But I digress, that
is a different debate.
I think the examples above may have already shed some light on this
question, but simply put OOP makes it easier to conceive very large
complex systems. Because it gives the developers the ability to break
the system down to small tangible.. uhh.. objects... :) which can be
designed, developed, and tested independently.
In a functional paradigm what invariably happens as a large system
grows: it becomes a huge pile of functions. All of which are
interconnected, and dependent on each other. Which means if you change
one function you break 10 others, it becomes impossible to manage. A
*good* large program written in a functional language is usually
designed with OOP principles in mind. (i.e. it is designed as a set of
modules that are not inter-dependent on other modules)
What was the pre-UML UML? well there were (and are) many modeling
languages out there. Many people used pen, and paper to draw flow
charts, diagrams, or write pseudo-code. I have to confess that
modeling languages are not my strong suit, but here are some links on
their history:
"History of UML"
http://pigseye.kennesaw.edu/~dbraun/csis4650/A&D/UML_tutorial/history_of_uml.htm
"UML"
http://www.inforingpress.com/computer_information/uml.htm
I hope this helps, please let me know if you have any other questions:
thanks,
--jld |