News for hackers. Stuff that matters.
Re:The faster you unlearn OOP, the better for you and your s... by bvrmn on Sunday November 25, 2018 @08:03AM (#18526702)
> What probably is true however is that a lot of people should unlearn the OOP they learned in school.

Can you provide references for proper OOP?

Re:The faster you unlearn OOP, the better for you and your s... by alasdair_ on Sunday November 25, 2018 @09:55AM (#18527107)
>Can you provide references for proper OOP?

Joshua Bloch's "Effective Java" is well worth a read. He outlines specific principles like "Favor composition over inheritance" (https://medium.com/@rufuszh90/effective-java-item-16-favour-...) in just a couple of pages each.

I also want to strongly recommend Martin Fowler's "Refactoring" since it covers a lot of "good" OOP design and gives practical advice on how to take bad code and make it better.

The original "gang of four" "Design Patterns" book is also pretty good, although definitely less practical than the other two.

Re:The faster you unlearn OOP, the better for you and your s... by itronitron on Sunday November 25, 2018 @08:48AM (#18526843)
The Java Swing API is a good example of OOP done well.
Re:The faster you unlearn OOP, the better for you and your s... by coldtea on Sunday November 25, 2018 @09:40AM (#18527035)
Huh?

If there was a worse example of over-engineering and crappy difficult to use API that would be Swing.

Re:The faster you unlearn OOP, the better for you and your s... by itronitron on Monday November 26, 2018 @10:29AM (#18533954)
Swing can't be the worst example, it has no JButtonFactory.
Re:The faster you unlearn OOP, the better for you and your s... by tonyedgecombe on Sunday November 25, 2018 @02:19PM (#18528398)
I'm not sure about that, how many methods does the JButton class have?

https://docs.oracle.com/javase/7/docs/api/javax/swing/JButto...

Re:The faster you unlearn OOP, the better for you and your s... by itronitron on Sunday November 25, 2018 @06:00PM (#18529651)
only a few more than the classes it inherits from :)
Re:The faster you unlearn OOP, the better for you and your s... by hoorayimhelping on Sunday November 25, 2018 @08:10AM (#18526725)
https://en.wikipedia.org/wiki/SOLID

I wish they would have taught me this in school. Instead, I learned that a cat is an animal, and a car has wheels, and a car is a vehicle. But not what any of these things have to do with one another and how to actually use them.

Re:The faster you unlearn OOP, the better for you and your s... by abernard1 on Sunday November 25, 2018 @08:26AM (#18526780)
SOLID still doesn't accomplish what the author is criticizing in my opinion.

If I have a SOLID codebase, how do I unroll the object graph to get, say, a hydrated JSON representation of that? (this is the data focus the author is talking about).

I think a person who has maintained an ORM like Hibernate or Rails and wants a simple data projection without having to use their specific tools to do so implicitly understands this pain. A data oriented approach where records are passed through to the business logic as necessary doesn't have this problem.

SOLID still has things like "cat.drivesIn(car)", and so even if the concretions are supposedly hidden behind an abstraction of that interface, the coupling is right there: "drivesIn" irrevocably binds a cat and a car together. In a data oriented, more functional approach, there is a function which happens to know something about cats and cars, and it pulls in two separate records to do its work. This is more of an a la carte approach to building relationships, whereas SOLID makes every consumer potentially need to worry about that because the coupling is in the contract.

Re:The faster you unlearn OOP, the better for you and your s... by bvrmn on Sunday November 25, 2018 @08:18AM (#18526755)
I saw many SOLID code bases hard to grasp and maintain because implementation hides data flow. The most evil workers are [D]-purists.
Re:The faster you unlearn OOP, the better for you and your s... by justaaron on Sunday November 25, 2018 @08:42AM (#18526822)
The I in solid sounds like a major issue WRT a cross-cutting concern like security, in which hermetically sealed should mean airtight, not a piecemeal approach, etc.
Re:The faster you unlearn OOP, the better for you and your s... by timbit42 on Sunday November 25, 2018 @10:22AM (#18527217)
Smalltalk does "OOP" properly because it focuses on message passing, the real benefit of "OOP". Any OOPL that isn't based on message passing is degenerate.
Re:The faster you unlearn OOP, the better for you and your s... by hota_mazi on Sunday November 25, 2018 @10:48AM (#18527318)
Right. Because Objective C and Smalltalk are such resounding successes, uh?
Re:The faster you unlearn OOP, the better for you and your s... by armitron on Sunday November 25, 2018 @07:46PM (#18530114)
Going by what you write here, we should all praise PHP and Javascript.

Popularity amongst the masses of 9-5 brogrammers who code for money and have no artistic sense when it comes to programming doesn't really imply quality. All the programming languages that are truly technically great - today - have small userbases. They're not easily digestible by mediocre coders, require some upfront effort and an open mind. Since the vast majority of professional programmers today are average at best, languages like Erlang, Haskell, Ocaml, Lisp, Smalltalk will never be popular.

It follows then that when looking for quality one should actually reverse popularity.

Re:The faster you unlearn OOP, the better for you and your s... by hota_mazi on Sunday November 25, 2018 @10:40PM (#18530867)
You do not sound condescending at all!

While it's true that popularity does not equal quality, one should be careful to go full tilt in the other direction and assert that non popularity means quality.

Objective C and Smalltalk were decent languages twenty years ago, but terrible languages by today's modern standards, starting with the fact that they're both dynamically typed, which we know today, is an evolutionary dead end in PLT.