[Haskell-cafe] [OT] thoughts about OO vs. functional "philosophy"
damien.mattei at gmail.com
Mon Mar 11 07:51:28 UTC 2019
I think functional programming really help simplifying the things: you need
to do a complex thing, so you build it with more simple functions that you
compose, you make a simple function and reuse it in a more complex one...
for each function you have arguments in input and get an object (list,
array, int ,string....) in output.
OO programming seems at first glance to provide a way to do this by calling
methods of a class that are encapsulated in it, but when using a method of
a class you always have to instantiate an object, you have to set some
things before doing the work. For any simple things your minds tends to
create virtual or real classes that you will perhaps have the needs,example
you needs a square object, nothing else, but you will tends to create first
edges, as class of square, and put square in a super class named polygons
which will also be in a class of.... you understand the problem? ;-)
so after another people reading your code will say, "hey what's all this
mess?" , and you're code will be hard to read , and even for you when
making big program you will have tons of classes, inheritance and will move
in a maze of classes!!! a nightmare.... sometimes, i experienced it! at the
opposite functional programming is so easy, so clear for your mind.
If you had strong typing which almost always the case in OO programming,
non immutable object like in C++, copy constructor, object requiring
canonical normal form of Copine,
OO programming can become really stressing to develop with in my opinion.
On Mon, Mar 11, 2019 at 8:18 AM PY <aquagnu at gmail.com> wrote:
> 10.03.2019 23:50, Ramnath R Iyer wrote:
> > whereas functional relies on categorization based on 'what actions can
> > be done' (aka functions)
> that's what interfaces are for.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe