News for hackers. Stuff that matters.
Re:The faster you unlearn OOP, the better for you and your s... by gameswithgo on Sunday November 25, 2018 @09:41AM (#18527045)
No true Scotsman.

>Because it's easy

There are lots of cases when forcing yourself to stick to OOP styles or programming is much less easy. You could look at various comparisons of code line counts of equivalent programs between C# and F# code as some basic examples.

I don't mind having classes that can inherit available in a language, but languages like Java and C# that force you to use only those things leads to a lot of unecessary boilerplate. You can work around this with static classes full of static functions that you can treat as 'modules' full of free functions. Which, is what I do a lot :D

But I wish I didn't have to bother with that workaround.

Re:The faster you unlearn OOP, the better for you and your s... by zippy5 on Sunday November 25, 2018 @10:14AM (#18527181)
I would suggest that boilerplate is small price to pay for having a compiler enforce design discipline and conventions. Remember that code should be written for both the run time environment and next coder who will have to understand it. Constraints enforced in java often make it easier for the next dev. I suspect part of this is that in unconstrained languages, there are so many ways of doing the same thing that pattern recognition become more difficult for all but the most experienced programmers.
Re:The faster you unlearn OOP, the better for you and your s... by naasking on Sunday November 25, 2018 @10:50AM (#18527332)
> pattern recognition become more difficult for all but the most experienced programmers.

In fact the opposite is the case. The boilerplate obscures underlying patterns because it forces you to read twice as much to infer the same amount of information. Roughly the same design patterns are used in more expressive languages, just without all the boilerplate. This makes the pattern being employed completely obvious since it's only a few lines of code.

Re:The faster you unlearn OOP, the better for you and your s... by scarface74 on Sunday November 25, 2018 @11:16AM (#18527433)
Once you use a language for awhile you develop boilerplate blindness just like people have developed ad banner blindness.
Re:The faster you unlearn OOP, the better for you and your s... by naasking on Sunday November 25, 2018 @11:23AM (#18527462)
I'm sure, and yet it remains true that you spend a lot more time scanning and scrolling your wheel mouse than is necessary. You can also fit far less context on screen, making debugging and "learnability" harder.
Re:The faster you unlearn OOP, the better for you and your s... by scarface74 on Sunday November 25, 2018 @01:17PM (#18527987)
There is overhead but with that overhead becomes maintainability, type safety, etc.

For me, on one side is Python. No compiler overhead, very little boilerplate, no complicated IDE etc but no type safety and harder to maintain for larger projects and C# with all of the overhead of a heavyweight compiler but the type safety and great IDE makes it perfect for larger projects where multiple people will be working on it simultaneously.

For simple scripting, where can I mentally keep everything in my head and think through how one change will affect everything else, Python is my go to language. For larger projects C#.

I’ve hated all scripting languages I’ve encountered over 20 years, but for some reason I love Python. It’s also a great teaching language.

Re:The faster you unlearn OOP, the better for you and your s... by naasking on Sunday November 25, 2018 @01:28PM (#18528062)
I agree Python is good for teaching, but the maintainability and type safety aren't features of the boilerplate. This is clear when considering languages like OCaml, Haskell and other languages featuring type inference.
Re:The faster you unlearn OOP, the better for you and your s... by dragonwriter on Sunday November 25, 2018 @01:30PM (#18528079)
Python has an external static type checker with type inference.
Re:The faster you unlearn OOP, the better for you and your s... by atoav on Monday November 26, 2018 @12:32AM (#18531310)
I learned Rust after learning Python. I do solve similar problems in Rust as I did in Python.

The single worst thing that python thought me, is that it would be cool/useful to make classes. Some call that a “sea of objects”. When I tried similar concepts in Rust I learn quickly that things started falling apart much faster at a point reached much earlier.

However this was also happening in Python – only much later in the game. This made me realize: instead of focusing on the flow of data and useful abstractions (”blackboxes”) over it, I actually made a lot of classes and objects and tried to pipe them into each other, without giving too much thought on the flow of data.

It felt so reassuring to make a Car-class for car objects, wit a Wheel class for its wheels, that I somehow forgot to think about the actual data that I wanted to work on.

The danger of OOP is IMO that it highly encourages bringing in preexisting patterns of abstraction that seem to make so much sense that you discard other, potentially more useful abstractions.

I have more broken Python code than I have broken Rust code, and one of the reasons is, that a lot of the stuff I did in Python (rightfully so) wouldn’t even compile in Rust.

Re:The faster you unlearn OOP, the better for you and your s... by naasking on Sunday November 25, 2018 @02:37PM (#18528539)
Not a compete one. Full Python semantics is not soundly typeable. Which type checker are you referring to?
Re:The faster you unlearn OOP, the better for you and your s... by Paradigma11 on Sunday November 25, 2018 @09:50PM (#18530666)
To go with the above example of c# vs f#. I find f# far easier to understand because the compiler enforces a strict top down compilation order. Combined with the encouraged basic type system (records and DU) this enforces a very rigid design structure that is easy to understand.

Compared to that c# is a ball of wool where not only have you to follow all strands but also understand when something will happen.

Re:The faster you unlearn OOP, the better for you and your s... by mpweiher on Sunday November 25, 2018 @10:01AM (#18527121)
> You could look at various comparisons of code line counts of equivalent programs between C# and F# code as some basic examples.

People have done this methodically, and the results may surprise you:

http://www.cs.bsu.edu/homepages/dmz/cs697/langtbl.htm

That's the one from 1996, there was a newer one that pretty much confirmed the results.

Re:The faster you unlearn OOP, the better for you and your s... by scarface74 on Sunday November 25, 2018 @10:02AM (#18527126)
I agree. Even in Domain Driven Design, sometimes you just have transaction scripts. Call a spade a spade and write your code accordingly.