News for hackers. Stuff that matters.
Re:The faster you unlearn OOP, the better for you and your s... by hliyan on Sunday November 25, 2018 @09:46AM (#18527060)
I've been programming for 15 years (so I was around for the rise of OOP). There's nothing fundamentally wrong with OOP. I still write a lot of classes. But what I haven't written in a almost a decade: code with inheritance, encapsulation or polymorphism. Nothing has exploded.

Also, objects are best when used to represent actual objects (i.e. collections of data rather than collections of functions).

This is OK

    User user = new User("John");
But this:

    StringTokenizer st = new StringTokenizer(str, ",");
    while (st.hasMoreElements()) {
      System.out.println(st.nextElement());
    }
Might not be as clean as:

   stdout(tokenize(str, ",")); // functions are hypothetical
Re:The faster you unlearn OOP, the better for you and your s... by scarface74 on Sunday November 25, 2018 @10:05AM (#18527140)
I was about to reply in C# that would usually be done with LINQ, but then I realized I kind of just proved your point since LINQ is functional programming not OOP....
Re:The faster you unlearn OOP, the better for you and your s... by naasking on Sunday November 25, 2018 @11:01AM (#18527358)
> Also, objects are best when used to represent actual objects (i.e. collections of data rather than collections of functions).

Except these aren't objects, they're just records. I don't think it's a good idea to pollute the word "object" or OOP. You use objects specifically when you need procedural abstraction, otherwise you use other types of values, like products/records, sums/variants, etc.

At high system levels, where you have client/server or other types of protocols, objects fit. At lower levels other paradigms tend to be better.

Re:The faster you unlearn OOP, the better for you and your s... by _old_dude_ on Sunday November 25, 2018 @10:15AM (#18527183)
Thank you for posting this snippet of code, to me, it acts like the episode of the madeleine in the Swann's way.

as you said, nowadays people are using String.split ``` List.of(str.split(",")) `` which is less poetic.

Re:The faster you unlearn OOP, the better for you and your s... by u801e on Sunday November 25, 2018 @12:36PM (#18527809)
> Also, objects are best when used to represent actual objects (i.e. collections of data rather than collections of functions).

This reminds me of a certain blog post about Java flavored OOP[1]

[1] https://steve-yegge.blogspot.com/2006/03/execution-in-kingdo...

Re:The faster you unlearn OOP, the better for you and your s... by theprotocol on Sunday November 25, 2018 @10:43AM (#18527292)
Excellent examples. Minimalist OOP can be beautiful, but over-abstraction e.g. `FactoryObserverFactory` is absolutely disastrous.