News for hackers. Stuff that matters.
Re:30k U.S. organizations newly hacked via holes in Microsof... by disgruntledphd2 on Saturday March 06, 2021 @06:27AM (#26366714)
I think OOP is useful where you need to have state and functions kept together.

It's a little easier to have foobar.update(), rather than update(foobar, state).

I started off mostly programming in R, so using mostly bare functions, but I have to admit that objects are really, really useful when you need to maintain state. Yes, you can do it with closures, but it's a little harder and a little uglier.

That being said, the mutability that makes objects useful is also problematic in that you can end up with magically updating references without defensive copying.

Re:30k U.S. organizations newly hacked via holes in Microsof... by kaliszad on Saturday March 06, 2021 @11:47AM (#26368608)
The point is exactly, it is somewhat easier exactly in that one case when you have a single state _foobar_ somewhere and work with it all the time. In almost all other cases the second case is actually simpler.

I don't know R and I don't really want to know it. For me, it doesn't seem to bring anything extra to the table that I couldn't do in Clojure or ClojureScript much more consistently and simply. If in my project, I have a number of transformation functions for my state, passing it around isn't a huge deal as it is just a nested map usually. It forces you to be very consistent and helps you as the project grows. Also, most of the functions are easily transferable between projects even when the state would have a very different structure.

Of course the whole thing is a complicated topic and in some cases you want mutability and local state e.g. because the performance is a bit better. Usually, that involves a few simple transformations.

Re:30k U.S. organizations newly hacked via holes in Microsof... by disgruntledphd2 on Wednesday March 10, 2021 @06:20AM (#26410109)
See, this is because you don't deal with data and statistics on a regular basis, which I do.

And if you figure out how to fit a generalised additive model in clojure with one line of code, please let me know :)

So, in DS/stats you end up needing mutability because the datasets are really large, and the models take a long time to run, so copying is generally bad.

Re:30k U.S. organizations newly hacked via holes in Microsof... by FpUser on Saturday March 06, 2021 @10:26AM (#26368005)
I feel that many of the theories concerning software developer's practice are concocted concocted mostly out of the author's desire to show that their way is the only one and capitalize on that. It is their own business. Not mine. I have bigger fish to fry and do not dwell on my screwdrivers.