[Haskell-beginners] From some "High-Performance Computing" book; "It is hard to eradicate from C++'ers the need for objects, classes, etc. ..."

Homero Cardoso de Almeida homerocda at gmail.com
Tue May 22 21:20:14 CEST 2012


Imho, the quote is slightly wrong.

A more correct one would be "It is hard to erradicate from *object-oriented
programmers* the need for objects, classes, etc...".

See, those who came to C++ with a background from C (me included) don't
have a lot of trouble filtering through useful abstractions and over
engineering. C++ is a multi-paradigm programming language after all, and
does not enforce an object-oriented architecture.

The problem is that much more of the C++ developers these days come with a
background of (almost) pure OO languages, looking for more performance.
Specially Java.

If you code C++ like you code in Java, you will have all the pitfalls of
over-engineering over you.

I haven't learned much of haskell myself, I have more of a curiosity than a
need to learn it. But just trying to solve some simple exercises and
forcing yourself to break your code into simpler, smaller function flows,
has already done marvels to me.

One of these days I started a new, private project in C++. I started
thinking with classes and suddenly got overwhelmed with all the flows and
small objects that had to be created and such. Then I stopped and thought
"What's the simplest way of doing it?" and then I remembered Haskell. God,
it's so much simpler working just with STL containers and plain old
functions!

Sooner or later I had to create a type myself, but after all it seemed just
right and just contributed to the application design, not getting in the
way of the code logic. This is the "right" way of programming: use the
right tools for the job.

Does it make sense to have a class to encapsulate something that could be
represented by a simple string object? Then create this class. Otherwise,
stick with the what you already have available and use functions.

Homero Cardoso de Almeida

--------------------------------------------------------------------------------
    B.el Ciência da Computação - UNIFEI 2006
--------------------------------------------------------------------------------

"Yeah. I can fly."
       -- Iron Man
+ homerocda at gmail.com
+ (19) 8139-3700


On Tue, May 22, 2012 at 4:04 PM, KC <kc1956 at gmail.com> wrote:

> "For high-performance computing you want to avoid such software
> engineering abstractions as classes, objects, etc...."
>
> Therefore, I would say, since Haskell makes possible many fine-levels of
> abstraction, if the compiler can strip most of these away, then it would
> come close to the speed of C (i.e. C++ without most of the software
> engineering abstractions).
>
>
> Still, I remember that quote that, "Another level of indirection solves
> everything."
>
> Or
>
> If you're Penn & Teller, "Another level of misdirection solves everything."
>
> Casey
>
> --
> --
> Regards,
> KC
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120522/f74e1d6f/attachment.htm>


More information about the Beginners mailing list