# Functional Classes

DevFeed: [Functional Classes](<https://devfeed.tech/articles/functional-classes-21799.md>)

Original publisher: [Read original article](<http://blog.cleancoder.com/uncle-bob/2023/01/18/functional-classes.html>)

Published: 2023-01-18T00:00:00Z

Content type: article

Language: en

Sources: [Robert C. Martin](<https://devfeed.tech/sources/robert-c-martin.md>), [The Clean Code Blog](<https://devfeed.tech/sources/the-clean-code-blog.md>)

Topics: [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [java](<https://devfeed.tech/tags/java.md>)

## AI overview

The article argues that functional programs can and should be organized into classes, even when they use immutable data structures. It defines a class as a cohesive group of narrowly focused functions operating on encapsulated data, and examines how abstraction and classification shaped object-oriented languages.

## Source excerpt

I recently tweeted the following: Should you subdivide a functional program into classes the way you would an object oriented program? Yes. You should. Because the rules don't change just because you've chosen to use immutable data structures. -- Uncle Bob Martin (@unclebobmartin) January 17, 2023 This led to a bevy of interesting responses about the difference between classes and modules. In answer to those responses I tweeted this: A class is a group of cohesive and narrowly defined functions that operate on an encapsulated data structure. The functions may, or may not, be polymorphically deployed. -- Uncle Bob Martin (@unclebobmartin) January 17, 2023 Of course that only led to an increased number of interesting responses. And so I thought that it might be wise to blog about my reasoning rather than to continue trying to cram that reasoning into tweets. If you are in doubt about what FP is, and about what OO is, and about whether the two are compatible, then I recommend this old blog of mine. What is a class? According to the dictionary a class is: A set, collection, group, or configuration containing members regarded as having certain attributes or traits in common; a kind or category. Now consider that definition when reading the next paragraph. In OO languages we organize our programs into classes of objects that share similar traits. We describe those objects in terms of the attributes and behaviors that they have in common. We strive to create hierarchies of classification that those objects can fit within. We consider the higher level classifications to be abstractions that allow the expression of general truths that are independent of irrelevant details. (Indeed, I once defined abstraction as: The Amplification of the essential, and the elimination of the irrelevant.[1]) In 1966 the power of abstraction by classification led the authors of Simula to create the keyword class. In 1980, Bjarne Stroustrup continued that convention and used the class keyword in C