Hacker News new | ask | show | jobs
by Const-me 2913 days ago
> I think it because high-level languages are closer to the problem domain (or our thinking)

Mostly agree.

> same for recursion

I don’t know about you, but in my problem domains loops are closer then recursion. Also loops are closer to my thinking. YMMV.

> Not pleasant experience when you have hundreds of objects

No one forces you to design your OO apps this way. When you only have a few objects, or when you only process them sequentially, there’s no need in complex OO model, a functional or procedural code will do fine.

However, there’re apps where there’re hundreds of interacting objects, such as a web browser.

> For desktop at least it's definitely not "a couple of megabytes".

On Windows it’s usually (=for apps linked with default settings) 1 megabyte.

1 comments

If you are dealing with something other than a sequence, such as a tree or a more general network, recursion is often the more insightful way to think about a solution.

Actually, the simplest example I can think of where this the case involves a sequence: binary search.

On the other hand, if you have to significantly rework the conceptual recursive solution to put it in tail-recursive form, an implementation using loops may end up being easier to understand.