Skip to main content

Questions tagged [functional-programming]

Functional programming is a paradigm which attempts to solve computational problems by the chained evaluation of functions whose output is determined by their inputs rather than the programme state. In this style of programming, side effects and mutable data are deprecated and usually strictly isolated.

2 votes
1 answer
137 views

Is it okay to mix OOP and modular approaches when building a backend with TypeScript/JavaScript?

I’m designing a backend in TypeScript (could also apply to JavaScript), and I’m wondering about the architectural approach. Is it better to stick to a single paradigm (e.g., fully object-oriented or ...
dok's user avatar
  • 167
4 votes
3 answers
279 views

The applicability of functional core - imperative shell to a cli program which contains a wrapper around a binary

Not long ago while I was exploring for solutions to test without mocks I've found out about the functional core, imperative shell architecture. It sounds great, I also think that it would play nicely ...
 sentientbottleofwine's user avatar
3 votes
6 answers
597 views

Is OOP really beneficial for enterprise-scale business software compared to procedural languages like ABAP or COBOL?

I'm currently drafting a Python coding standard for internal enterprise use, primarily targeting business applications that involve heavy data access, reporting, and transactional logic. In this ...
agolta's user avatar
  • 77
4 votes
5 answers
478 views

Anemic Models vs. Rich Models: When to Use?

I'm working on an application and have encountered two different approaches for organizing business logic. There's a general consensus that application rules should be handled in higher layers, so I ...
Azuos's user avatar
  • 49
0 votes
3 answers
260 views

How to filter "locally and remotely" in functional programming

My example applies to reading and deleting files (I/O), but this is probably a common scenario (eg, keeping local and global state in sync in functional programming). I am reading in files from a ...
rpivovar's user avatar
  • 263
3 votes
3 answers
347 views

How to "pass through" data in a functional programming pipeline so that it's accessible later on in the pipeline

I am trying to refactor some JavaScript code to use functional programming principles. I have some functions that I want to use in a series of maps. const transformedData = rawData .map(...
rpivovar's user avatar
  • 263
5 votes
3 answers
695 views

Are "pipelines" in functional programming bad for time complexity?

This question is not meant to be a critique of functional programming, but more hoping for resources and opinions. I am refactoring some historically messy code so that it follows functional ...
rpivovar's user avatar
  • 263
4 votes
2 answers
441 views

How to handle file I/O in a for loop?

(this question is written using javascript for examples) Say I have a bunch of files that I need to access sequentially: 1.json 2.json 3.json 4.json ... Say I want to transform the data in all of ...
rpivovar's user avatar
  • 263
0 votes
1 answer
189 views

(functional programming) What do you call a function that abstracts away a group of function calls?

(this question is written from a functional javascript point of view) say you have some pure functions: function a (arg) { ... return result } function b (arg) { ... return result } function ...
rpivovar's user avatar
  • 263
2 votes
1 answer
328 views

Did the term "decorator" originate with OOP design patterns?

The Decorator pattern allows behaviour to be dynamically added to an existing object, effectively "decorating" it with new behaviour. While the pattern as formalised and named seems to have ...
Iain Galloway's user avatar
1 vote
1 answer
847 views

How could I apply the strategy pattern to a react component? [closed]

For the following component, how would I extract the unit logic to allow for composition? In my actual app I am trying to reduce the amount of logic encoded in the component and I have decided that ...
Tyler Kasper's user avatar
2 votes
1 answer
151 views

OO vs FP: What is a good approach to understanding if heavy wrapper classes should be used?

Consider a processing system which ingests objects from an external source and performs extensive processing. One example could be objects detected by a computer vision system which are then fed into ...
panlex's user avatar
  • 265
1 vote
2 answers
357 views

Why did TC39 name JavaScript's array predicate functions `some` and `every` instead of `any` and `all`?

Python, Ruby, Rust, Haskell, Kotlin, C#, C++, Perl, MATLAB, SQL, and R all call their respective array predicate checking functions any and all. Is there any record of why JavaScript's designers ...
Alex Ryan's user avatar
  • 127
6 votes
2 answers
1k views

Object immutability and persistence

While I was learning functional programming I have encounterd two for me very similar terms: immutability and persistence. Also I have read simular questions from stackoverflow, but I am still ...
DimitrijeCiric's user avatar
1 vote
3 answers
501 views

Scala Option vs. conditional branches

If I'm writing Scala functions and have to check for nulls in situations where I can't avoid it (say, working with Spark UDFs and some legacy Java types), is it better to turn things into Option or to ...
wrschneider's user avatar
  • 1,369

15 30 50 per page
1
2 3 4 5
50