All Questions
Tagged with functional-programming object-oriented-design
19 questions
79
votes
10
answers
17k
views
How functional programming achieves "No runtime exceptions"
How does a functional programming language, such as Elm, achieve "No runtime exceptions"?
Coming from an OOP background, runtime exceptions have been part of whatever framework that is based ...
30
votes
10
answers
5k
views
How would Functional Programming proponents answer this statement in Code Complete?
On page 839 of the second edition, Steve McConnell is discussing all the ways that programmers can "conquer complexity" in big programs. His tips culminate with this statement:
"Object-oriented ...
27
votes
7
answers
4k
views
Does functional programming ignore the benefits gained from the "On the Criteria To Be Used in Decomposing Systems into Modules" (data hiding)?
There's a classic article named On the Criteria To Be Used in Decomposing Systems into Modules that I just read for the first time. It makes perfect sense to me, and is probably one of those articles ...
18
votes
6
answers
3k
views
Does functional programming increase the 'representational gap' between problems and solutions? [closed]
Since machine language (e.g., 0110101000110101) computer languages have generally evolved to higher forms of abstraction, generally making it easier to understand the code when it's applied to a ...
13
votes
3
answers
27k
views
Is it a better practice pre-initialize attributes in a class, or to add them along the way?
I'm sorry if this is a ABSOLUTELY sophomoric question, but I'm curious what the best practices are out there, and I can't seem to find a good answer on Google.
In Python, I usually use an empty class ...
11
votes
4
answers
3k
views
Why not apply Interface Segregation Principle to "extreme"
Providing that clients would typically consume just one method, though methods would be conceptually related, why not always apply the Interface Segregation Principle to the extreme and have [many] ...
11
votes
4
answers
2k
views
Design in "mixed" languages: object oriented design or functional programming?
In the past few years, the languages I like to use are becoming more and more "functional". I now use languages that are a sort of "hybrid": C#, F#, Scala. I like to design my application using ...
10
votes
3
answers
1k
views
Long parameter list versus long state variable list
In a C++ book, the author says we no longer need a function with a long parameter list because most of the parameters can be refactored into state variables in a class.
On the other hand, a ...
6
votes
3
answers
2k
views
Functional programming strategies in imperative languages
I've been convinced for awhile now that some strategies in functional programming are better suited to a number of computations (i.e immutability of data structures). However, due to the popularity of ...
6
votes
1
answer
611
views
Functional core for elevator system design
How can Gary Bernhardt's "Functional Core / Imperative Shell" architecture be used to design software for an elevator system?
Specifically, let's say there are a few elevators, each with call buttons ...
5
votes
5
answers
597
views
Implicit reading/writing of state in OOP hurts readability, maintainability, and testability. Good way of mitigating this damage?
OOP makes state reads and writes implicit. For instance, in Python:
class Foo:
def bar(self):
# This method may read and/or write any number of self.attributes.
# There is no way ...
3
votes
2
answers
2k
views
design a model for a system of dependent variables
I'm dealing with a modeling system (financial) that has dozens of variables. Some of the variables are independent, and function as inputs to the system; most of them are calculated from other ...
3
votes
0
answers
353
views
Lightweight data modeling vs traditional classes [closed]
I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
2
votes
1
answer
885
views
What is the correct granularity for events in the context of designing a rule-based decision system?
Introduction
We need to design a system that, given a set of events that are happening in the source application, reacts to them and if some conditions have been met, actions can be triggered. Users ...
1
vote
2
answers
249
views
Connecting classes by passing method references
I am trying to find a good way of allowing two objects that are separated by a intermediate object to communicate while keeping the architecture loosely coupled. A solution I have developed is to pass ...