All Questions
Tagged with functional-programming object-oriented
34 questions
3
votes
1
answer
108
views
Sequentially find the indexes of an element into a collection
Util class to find into a collection the indexes of a given element with multiple occurrences from the first index or relative to a given index.
...
1
vote
1
answer
147
views
Transform an array into object and set index for an unique key in javascript
I have a method that merges keys and indexes from an array into an object.
I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler.
Goal
get an array of objects ...
3
votes
0
answers
77
views
A Haskell-style "maybe" type in Python, version 2
I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
4
votes
2
answers
749
views
MP3 Playlist Class in Python
Background Info
I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
0
votes
1
answer
250
views
Refactoring this code into OOP & less functional programming
I got feedback from an interview test where they wanted me to prove that I've got a grasp of OOP php programming. This file especially I got feedback on that it's more functional than it is Object-...
10
votes
3
answers
764
views
JavaScript OOD: 2048
I wrote a 2048 game in JavaScript with an object-oriented paradigm. The game board is presented with a two-dimensional array and each tile holds an integer.
Here is the implementation:
...
1
vote
1
answer
122
views
JavaScript, looping, and functional approach
Data Structure coming back from the server
...
1
vote
1
answer
57
views
-2
votes
1
answer
67
views
python - class not returning the expected result. I am using function and a class [closed]
I am trying to pass 2 values from a function to the class and get a result from the class. For example, if I send value "dog" I should get the result as "dog runs" as a returned result. Need help with ...
0
votes
1
answer
86
views
Functional vs Object Oriented Approach for UI codes
I have the following snippets. which formats error messages based on a map. I can do it as a simple function call the function for transforming the error. or create a class and handle it in that way.
...
2
votes
0
answers
66
views
Immutable-Object-like Structure in PHP
I made a closure-based PHP structure that behaves mostly like a classical object.
To change the object's state, one must derive a new copy by passing the altered state to the ...
2
votes
1
answer
560
views
Constructor function for persons with hobbies
I'm trying to write a constructor function that generates instances of a user. One of the properties of the user class is an array of the user's hobbies. I'd like ...
15
votes
2
answers
2k
views
Message-formatting code with pluralization, revised to be more functional
I'm a C++ dev, and I've recently started working my way through Clean Code*. Whenever I encounter an example I think I could improve, I try to re-implement it in C++.
On pp. 28-29 there is an example ...
2
votes
0
answers
61
views
Dispatch different parameters to different classes with single interface [closed]
I have a set of classes that have similar funcionality but very different interfaces. I created two interface classes with polymorphic methods so I can operate over then. When creating calling the ...
1
vote
1
answer
943
views
Graph implementation in C++ using adjacency list
there is my final code for implementing a Graph in C++ using adjacency list and Object-oriented. I got some help from StackOverflow and it was really helpful, but now I would ask about some advice for ...