this post was submitted on 14 Mar 2024
136 points (96.6% liked)

Programming

17433 readers
222 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] mox@lemmy.sdf.org 13 points 8 months ago* (last edited 8 months ago) (7 children)

Object oriented programming rose to popularity a few decades ago, along with a great deal of indoctrination and marketing for both the paradigm and related products. It was pushed so hard and so widely that more than a few folks grew into their developer roles assuming it was the best approach to every problem. Of course, it isn't.

(It definitely is useful at times, though, so please don't condemn it just because it's sometimes a square peg in a round hole.)

I'm glad to see you have discovered an alternative, and I hope you will continue to expand your toolbox and aim for simplicity.

[–] mac@infosec.pub 5 points 8 months ago (4 children)

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

[–] Kache@lemm.ee 3 points 8 months ago* (last edited 8 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.

load more comments (3 replies)
load more comments (5 replies)