Earlier quoted context omitted.
I'm a recent FP convert after 15ish years of OO. I don't hate OO now or anything, but maybe a little? It adds so much more to think about for what I now consider to be no benefit, at least for the types of systems I've worked on in my career. A big thing I've realized is that everything I've worked on has modelled things that are already abstract. For example, I'm working on a scheduling app right now. In real life,…
I've come full cycle: 0) Procedural 1) OO 2) FP 3) Really started to dislike mutability 4) Developed various FP frameworks 5) Back to pure (immutable!) OO and messages!
Joe Is Wrong (2009)
81–86 of 86 posts
Re: Joe Is Wrong (2009)
#82Re: Joe Is Wrong (2009)
#83Earlier quoted context omitted.
I've come full cycle: 0) Procedural 1) OO 2) FP 3) Really started to dislike mutability 4) Developed various FP frameworks 5) Back to pure (immutable!) OO and messages!
What made you transition from 4) to 5) ?
Lenses look like a solution to transition 'deep' immutable state, but I find them cumbersome: YMMV.
Object Orientation has excellent composability with regards to state and with minimum fuss.
The step I took is to eradicate mutable OO state, and replace it with a pure OO substrate.
Re: Joe Is Wrong (2009)
#84These discussions tend to boil down to OOP vs FP. That's a false dichotomy. The alternative to OOP is not FP, it's pre-OOP imperative programming with various techniques a la carte. Should data and functions be together? That's a choice you can make on a case-by-case basis. It makes total sense that a HashMap has an insert() method. On the other hand, maybe your Player object is just some data which is interpreted by…
A paricular point people don't get is that Java joined functional programming instead of beating it. The Hotspot compiler was based on a research runtime for a functional language. Type inference is basically the same as ML family languages. With heavy use of Lambdas and higher-order functions some of my Java looks like ML. If i want to have functions like maybe(x, f1, f2, ...) that works (emphasis) like the maybe mo…
Re: Joe Is Wrong (2009)
#85Earlier quoted context omitted.
Not necessarily: C#, for example, has a lot of FP like moments. Its not particularly relevant how are those internally implemented.
Not op, but I think you missed his / her point. Let's take static void main as example. It's a series of operation called at the beginning (at least during my era), does not need to be in a class. The very reason we put it on class (let's say) Start, feels like language limitation. The same with class Math, such as Math.floor and Math.ceil. Is Math a class or is it more suitable as a namespace? Since no object instan…
I still want to group them somehow and this "somehow" better have name "Math" so other people would see what it is.
Why are people so attached to name "class". Call it "namespace with state capabilities" if you're annoyed by "class" so much. Or just use namespaces like in C#. You still want namespaces, that's the point.
And speaking about your example. More often than not, we've got quite a bit of functionality attached to program startup and I'd rather have it focused in one single module "Start"/"Application"/"Runner" whatever you want to call it but I want it to be _focused_ and easily searchable, not floating in a see of function.
And by the way, same argument can be made about functions, why do I have to create "main()" at all, why not just start writing instructions like in bash script or python?
Re: Joe Is Wrong (2009)
#86Earlier quoted context omitted.
Not op, but I think you missed his / her point. Let's take static void main as example. It's a series of operation called at the beginning (at least during my era), does not need to be in a class. The very reason we put it on class (let's say) Start, feels like language limitation. The same with class Math, such as Math.floor and Math.ceil. Is Math a class or is it more suitable as a namespace? Since no object instan…
> The same with class Math, such as Math.floor and Math.ceil. I still want to group them somehow and this "somehow" better have name "Math" so other people would see what it is. Why are people so attached to name "class". Call it "namespace with state capabilities" if you're annoyed by "class" so much. Or just use namespaces like in C#. You still want namespaces, that's the point. And speaking about your example. Mor…
The central, first-class “namespace with state capabilities” in OOP is an object. A class is a namespace with state capabilities that may (or may not, because pure static classes are a thing) be an object factory, may or may not be an object or first class entity, and, probably, if the language has static types, is also a type.
And all of that is also true of objects, except the last, and objects are always first class in OOP. So, aside from static typing, classes are superfluous, unless they are just a name for objects with certain common feature.