12
votes
8answers
1k views

Mental Models or Real-World-Metaphors for Functional Programming

Does anyone have a good mental model or metaphor for functional programming which references something in the real world? Object Oriented programing intuitively makes sense to me. There are things ...
1
vote
1answer
152 views

Object-Oriented equivalent of LISP's progn function?

I'm currently writing a LISP parser that iterates through some AutoLISP code and does its best to make it a little easier to read (changing prefix notation to infix notation, changing setq assignments ...
-1
votes
1answer
213 views

How to make C# methods work like javascript functions? [closed]

I'll keep it simple, I want to make C#'s methods work like javascript's functions. Mainly so I can convert this - function makeVariable(terp) { var me = {value: 0}; return function () { ...
6
votes
4answers
810 views

Is pattern-matching against types idiomatic or poor design?

It seems like F# code often pattern matches against types. Certainly match opt with | Some val -> Something(val) | None -> Different() seems common. But from an OOP perspective, that ...
2
votes
3answers
523 views

Is procedural programming the root of all object oriented evil? [closed]

If you read Working Effectively with Legacy Code, Clean Code, Refactoring: Improving the Design of Existing Code and Design Patterns you will get what I mean. Many of the examples and topics ...
2
votes
0answers
41 views

idea mapping with global state [closed]

I need to map ideas to ideas to ideas to ideas (four in total, semantically, and a fifth one-to-one): the state is global it can change over time I'm writing the module from scratch Here's my ...
0
votes
0answers
87 views

When You Have Both Options, When Functional and When OOP? [duplicate]

Like (I suspect) a lot of JS devs, I tend to start with intuition first and then come to sound principles/practice with experience informing study of the comp. sci stuff I never really had any form ...
9
votes
6answers
950 views

What Functional features are worth a little OOP confusion for the benefits they bring?

After learning functional programming in Haskell and F#, the OOP paradigm seems ass-backwards with classes, interfaces, objects. Which aspects of FP can I bring to work that my co-workers can ...
17
votes
7answers
1k 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 ...
11
votes
5answers
1k views

How to refactor an OO program into a functional one?

I'm having difficulty finding resources on how to write programs in a functional style. The most advanced topic I could find discussed online was using structural typing to cut down on class ...
1
vote
2answers
2k views

Is the Entity Component System architecture object oriented by definition?

Is the Entity Component System architecture object oriented, by definition? It seems more procedural or functional to me. My opinion is that it doesn't prevent you from implementing it in an OO ...
4
votes
1answer
1k views

Why is imperative programming preferred over functional programming? [closed]

Background: I am proponent of functional programming who works at a VB.NET shop where the prevailing mental model is imperative programming. Being that foundation of our system is WinForms I can ...
13
votes
5answers
957 views

What makes JVM so much versatile to support so many JVM languages?

JVM supports so many languages other than Java like Groovy,Clojure,Scala etc which are functional languages unlike Java(I am referring to Java before Version 8 where Lambda's are not supported) that ...
2
votes
2answers
438 views

Code Reuse and Abstraction in FP vs OOP [closed]

I've been told that code reuse and abstraction in OOP is far more difficult to do than it is in FP, and that all the claims that have been made about Object Orientedness (for lack of a better term) ...
24
votes
1answer
1k views

Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?

In a blog post on F# for fun and profit, it says: In a functional design, it is very important to separate behavior from data. The data types are simple and "dumb". And then separately, you ...
7
votes
1answer
364 views

What are some techniques I can use to refactor Object Oriented code into Functional code?

I've spent about 20-40 hours developing part of a game using JavaScript and HTML5 canvas. When I started I had no idea what I was doing. So it started as a proof of concept and is coming along ...
19
votes
4answers
1k views

How do purely functional languages handle modularity?

I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be ...
5
votes
5answers
4k views

Is there any difference between pointers and references? [duplicate]

References and pointers do the same thing as I know. Is there any difference between them? If there is no difference, why we call them reference not pointer?
11
votes
5answers
1k views

How to code in a more functional style in Java?

I code Java for at least 5 years now and I really appreciate how the language works. When looking at new JVM languages (e.g. Scala, Clojure) there is a trend to more functional ways to code and this ...
3
votes
1answer
1k views

C++ Design: Functional Programming vs OOP

Design Question Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some ...
21
votes
6answers
2k views

Functional programming compared to OOP with classes

I have been interested in some of the concepts of functional programming lately. I have used OOP for some time now. I can see how I would build a fairly complex app in OOP. Each object would know how ...
11
votes
2answers
362 views

FP for simulation and modelling

I'm about to start a simulation/modelling project. I already know that OOP is used for this kind of projects. However, studying Haskell made me consider using the FP paradigm for modelling a system of ...
23
votes
6answers
3k views

Is functional programming a superset of object oriented?

The more functional programming I do, the more I feel like it adds an extra layer of abstraction that seems like how an onion's layer is- all encompassing of the previous layers. I don't know if this ...
5
votes
5answers
1k views

Functional programming readability

I'm curious about this because I recall before learning any functional languages, I thought them all horribly, awfully, terribly unreadable. Now that I know Haskell and f#, I find it takes a little ...
4
votes
4answers
661 views

How are objects modelled in a functional programming language?

In an answer to this question (written by Pete) there are some considerations about OOP versus FP. In particular, it is suggested that FP languages are not very suitable for modelling (persistent) ...
0
votes
2answers
546 views

I cannot understand the application of oops How can I develop the understanding of application of oops?

I am struggling hard to learn the application of Object Oriented Programming since last 2 years. I am a developer in PHP technology, I am aware of almost all the basics of OOPS, but still cannot find ...
21
votes
5answers
2k views

How to make the transition to functional programming?

Lately, I have been very intrigued with F# which I have been working a bit with. Coming mostly from Java and C#, I like how concise and easily understandable it is. However, I believe that my ...
2
votes
3answers
225 views

Turning your code inside out (functional style) compared to a OO paradigm

I have find this article Turning Your Code Inside Out and I want to know how this approach described in article is for OO programmers/languages. Is this style of design used in OO ...
22
votes
10answers
2k 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 ...
3
votes
1answer
1k views

Non-OOP languages advantages and good uses

I'm a C# developer, but I also know Java, JavaScript, XSLT, a little of C and Perl, e some other that I may have forgotten. Still, the paradigm I'm most familiar to is OOP. I have always thought ...
31
votes
18answers
6k views

What would you do if your client required you not to use object-oriented programming?

I am writing a program to simulate the activity of ants in a grid (PDF). The ant can move around, pick up things and drop things. The problem is while the action of the ants and the positions of each ...
7
votes
4answers
1k views

A programming language that does not allow IO. Haskell is not a pure language

Are there any 100% pure languages (as I describe in the Stack Overflow post) out there already and if so, could they feasibly be used to actually do stuff? i.e. do they have an implementation? I'm not ...
9
votes
4answers
4k views

Example of where Functional Programming is Superior to Imperative or Object-Oriented Programming? [duplicate]

Possible Duplicate: Which problems domains are more suited to functional programming solutions I've been reading about functional programming. I've been using mostly C#.net recently, and ...
3
votes
1answer
1k views

Is functional decomposition really an antipattern?

While I was reading The worst anti-patterns you have came across, I clicked on the link in this post to land on the web site about anti-patterns. And the ...
30
votes
2answers
1k views

What did Alan Kay mean by “assignment” in The Early History of Smalltalk?

I have been reading The Early History of Smalltalk and there are a few mentions of "assignment" which make me question my understanding of its meaning: Though OOP came from many motivations, two ...
17
votes
5answers
3k views

Is objected oriented programming paradigm outdated since it is anti-modular and anti-parallel? [closed]

I have read the controversial article Teaching FP to freshmen posted by Robert Harper who is a professor in CMU. He claimed that CMU would no longer teach object oriented programming in the ...
2
votes
7answers
1k views

Architectural patterns for interaction beyond MVC? [closed]

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural ...
27
votes
6answers
3k views

Does learning a functional language make a better OOP programmer? [closed]

As a Java/C#/C++ programmer I hear a lot of talk about functional languages, but have never found a need to learn one. I've also heard that the higher level of thinking introduced in functional ...
10
votes
5answers
2k views

Which paradigm to use for writing chess engine?

If you were going to write a chess game engine, what programming paradigm would you use (OOP, procedural, etc) and why whould you choose it ? By chess engine, I mean the portion of a program that ...
11
votes
4answers
946 views

FP and OO orthogonal?

I have heard this time and again and I am trying to understand and validate the idea that FP and OO are orthogonal. First of all, what does it mean for 2 concepts to be orthogonal ? FP encourages ...
69
votes
5answers
9k views

Functional Programming vs. OOP

I've heard a lot of talk about using functional languages such as Haskell as of late. What are some of the big differences, pros and cons of functional programming vs. object-oriented programming?