[Tutor] Whats so good about OOP ?
shaleh at speakeasy.net
Sun Mar 13 08:49:28 CET 2005
Brian van den Broek wrote:
> 1) Namespace issues
> With procedural (or imperative -- don't know which is the right terms
> for non-OOP code which employs functions) code, you can have issues
> caused by namespaces. Just yesterday, someone on the main python
> list/newsgroup had code something like:
procedural v. OO
imperative v. functional
In an imperative language you tell the computer what to do (imperative):
"put 5 in X, use X in function foo, store foo's result in blah". The
base component is an imperative statement. If you have not had an
English grammar class recently imperative sentences are things like
"You, bring me my supper".
In a functional language, the base item is a function.
foo(X(blah())) or for the lispy people (foo (x (blah))).
You could do OO in a functional language. Haskell for instance has a
concept of classes, user defined types, polymorphism, etc.
The point is, these are two axes on the programming language chart.
procedural, imperative -> C
OO, functional -> OCaml (close enough anyways)
More information about the Tutor