This project was interesting. Recently, I’ve been digging into the functional programming paradigm. This is one of my first tries at it. I’ve been doing OOP until recently, but this project really was impressive to me. The whole implementation took about nine hours. Functional programming is much less convoluted. I spent more time programming than deciding on a good name for a certain identifier.

Not only is functional programming more efficient, but I can also see that it’s much less tedious to write automated tests for. I only have to take care of the local scope of the function I am writing a test for; there is no need to deal with the parent’s inherited mess or even any parent’s mere state. I just have to write the test for the function.

I have scraped the Cambridge Dictionary to collect the data.

The project is licensed under MIT at:

https://github.com/eeriemyxi/novi

https://git.envs.net/myxi/novi

  • mac
    link
    fedilink
    arrow-up
    5
    ·
    9 months ago

    Can you give an example of when oop is preferred to functional?

    • Traister101@lemmy.today
      link
      fedilink
      arrow-up
      14
      ·
      9 months ago

      When it’s easier to think about a system in terms of objects. The classic example is video game Entities/Game Objects. GUI stuff has also been very pleasant with OOP as buttons and the like are all easily conceptualized and worked with when seen as objects.

      • Miaou@jlai.lu
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        ECS is arguably a better for game dev, so even that point is debatable.

    • mox@lemmy.sdf.org
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      9 months ago

      I think desktop GUI toolkits are a pretty good use case for object-oriented design, mainly because mapping window/widget families onto class hierarchies is straightforward.

      That’s not to say that a good functional design is impossible; it’s just not particularly obvious.

    • Kache@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      9 months ago

      One of the best use cases is implementing abstract data types and hiding the memory management and other potentially unsafe optimization tricks behind a clean and high level abstraction.

      Also since it’s a logical/mathematical construct and not attempting to model the real world (like business logic), it’s one case where inheritance hierarchies will remain stable.