Tagged Questions

318
votes
18answers
38k views

Does Functional Programming Replace GoF Design Patterns?

Since I started learning F# and OCaml last year, I've read a huge number of articles which insist that design patterns (especially in Java) are workarounds for the missing features in imperative ...
179
votes
9answers
14k views

Monad in plain English? (For the OOP programmer with no FP background)

In terms that an OOP programmer would understand (without any functional programming background), what is a monad? What problem does it solve and what are the most common places it's used? EDIT: To ...
74
votes
5answers
17k views

Functional programming vs Object Oriented programming [closed]

I'm an Object Oriented programmer looking forward to learning a functional language. My questions are: When do you choose functional programming over object oriented ? What are the typical problem ...
68
votes
9answers
4k views

How do functional programming languages work?

I was just reading this excellent post, and got some better understanding of what exactly object oriented programming is, how Java implements it in one extreme manner, and how functional programming ...
47
votes
9answers
3k views

Are 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 ...
46
votes
9answers
3k views

In what areas does F# make “absolute no sense in using”?

Don Syme in his SPLASH talk says that F# is NOT intended to be a replacement for C# even though it has the general capabilities. He goes on to say that there are areas where F# makes no sense in ...
32
votes
5answers
3k views

Design patterns for functional-OO hybrid languages?

Is there already any collection of best practices for languages like Scala? I've found a work on design patterns for functional languages, Design patterns for functional strategic programming. ...
29
votes
7answers
3k views

Why are Haskell algebraic data types “closed”?

Correct me if I'm wrong, but it seems like algebraic data types in Haskell are useful in many of the cases where you would use classes and inheritance in OO languages. But there is a big difference: ...
29
votes
3answers
1k views

OOP in a purely FP context?

Are there any advantages to using object oriented programming in a functional programming context? I have been using F# for some time now, and I noticed that the more my functions are stateless, the ...
29
votes
9answers
1k views

Why avoid subtyping?

I have seen many people in the Scala community advise on avoiding subtyping "like a plague". What are the various reasons against the use of subtyping? What are the alternatives?
21
votes
9answers
5k views

Closures: why are they so useful?

As an OO developer, maybe I have difficulty seeing its value. What added value do they give? Do they fit in an OO world?
21
votes
2answers
1k views

How would I translate a Haskell type class into F#?

I'm trying to translate the Haskell core library's Arrows into F# (I think it's a good exercise to understanding Arrows and F# better, and I might be able to use them in a project I'm working on.) ...
20
votes
4answers
1k views

Why ADTs are good and Inheritance is bad?

I am a long time OO programmer and a functional programming newbie. From my little exposure algebraic data types only look like a special case of inheritance to me where you only have one level ...
19
votes
7answers
1k views

“Closures are poor man's objects and vice versa” - What does this mean?

Closures are poor man's objects and vice versa. I have seen this statement at many places on the web (including SO) but I don't quite understand what it means. Could someone please explain what ...
19
votes
8answers
657 views

Programming Pattern Comparison? [closed]

Is there a book or a website where is explained how to solve some example problem X in OOP style and then is given and explained an opposed functional programming style solution? Perhaps one more ...
18
votes
8answers
496 views

Is there some literature on this type of programming?

In college I took on a class on modern physics, in which we learned about special relativity. I was completely blown away by how different frames of reference could actually observe physical ...
17
votes
11answers
2k views

Is OO design's strength in semantics or encapsulation?

Object-oriented design (OOD) combines data and its methods. This, as far as I can see, achieves two great things: it provides encapsulation (so I don't care what data there is, only how I get values I ...
17
votes
4answers
714 views

Generics and Constrained Polymorphism versus Subtyping

In this PDF presentation on Haskell Type Classes, slide #54 has this question: Open Question: In a language with generics and constrained polymorphism, do you need subtyping too? My ...
16
votes
5answers
1k views

Advantages of subtyping over typeclasses

What are the advantages of OOP subtyping over typeclasses, if any? In other words, now that we have typeclasses, is there any reason to still use OOP subtyping? PS: I am a Scala programmer.
16
votes
5answers
674 views

Achieving polymorphism in functional programming

I'm currently enjoying the transition from an object oriented language to a functional language. It's a breath of fresh air, and I'm finding myself much more productive than before. However - there ...
15
votes
4answers
1k views

Handling incremental Data Modeling Changes in Functional Programming

Most of the problems I have to solve in my job as a developer have to do with data modeling. For example in a OOP Web Application world I often have to change the data properties that are in a object ...
14
votes
6answers
824 views

Problems on migrating from functional to OO

I'm used to work with functional programming (mainly Haskell) and I'm beginning with OO (scala). I'm having troubles on translating my code. For instance, that's my Haskell definition of a B-tree: ...
14
votes
11answers
1k views

Explaining functional programming to object-oriented programmers and less technical people

What are some good examples that I can use to explain functional programming? The audience would be people with little programming experience, or people who only have object-oriented experience.
13
votes
4answers
648 views

“Many functions operating upon few abstractions” principle vs OOP

The creator of the Clojure language claims that "open, and large, set of functions operate upon an open, and small, set of extensible abstractions is the key to algorithmic reuse and library ...
12
votes
10answers
2k views

Why is smalltalk not a functional programming language?

With the renewed interest in functional programming languages, I've seen some similitudes between Smalltalk and FPL, namely closures ( BlockClosures in Smalltalk ) Yet, Smalltalk is not a FPL? What ...
12
votes
4answers
654 views

Difference between OOP interfaces and FP type classes [duplicate]

Possible Duplicate: Java's Interface and Haskell's type class: differences and similarities? When I started learning haskell I was told that typeclasses are more powerful ...
11
votes
15answers
830 views

What would make you try (or not try) a new programming language? [closed]

I've been designing a pragmatic programming language for 5 or so years, and it probably won't be released for several more years (probably until after my current and next startups succeed or fail). ...
11
votes
4answers
472 views

Newbie question: How to model class hierarchies in Haskell?

I am a C# developer and these days I am trying to learn Haskell from the online book Real World Haskell. From what I have learnt so far, I am quite impressed with the language. However coming from OO ...
11
votes
4answers
2k views

Functional programming: state vs. reassignment

I need help getting my head around the difference between my current OOP notion of state, and the way it would be done in a functional language like Haskell or Clojure. To use a hackneyed example, ...
11
votes
11answers
497 views

How do classes help you manage large applications?

This came up in a conversation I was having online, and it occured to me that I have no idea how this is supposed to work: Quite a lot of programmers seem to just take as a given- indeed, obvious that ...

1 2 3 4
15 30 50 per page