OOP is an industry of its own which generates a ton of incidental complexity. See "Object-Oriented Programming is Bad" by Brian Wills ( https://www.youtube.com/watch?v=QM1iUe6IofM ) and most of Rich Hickey's excellent videos, especially his keynote at Rails Conf 2012 where he basically told the Ruby crowd they're doing it wrong ( https://www.youtube.com/watch?v=rI8tNMsozo0 ).
99 Bottles of OOP now available in Python
41–50 of 93 posts
Re: 99 Bottles of OOP now available in Python
#42Earlier quoted context omitted.
Why on earth do you put composition and OOP as opposing techniques? Composition is just one more technique in the OOP toolbox and there is nothing in OOP that mandates an inheritance based architecture.
Mainstream OOP languages (looking at you Java) have failed to make composition as convenient as inheritance.
Re: 99 Bottles of OOP now available in Python
#43Earlier quoted context omitted.
Why on earth do you put composition and OOP as opposing techniques? Composition is just one more technique in the OOP toolbox and there is nothing in OOP that mandates an inheritance based architecture.
Mainstream OOP languages (looking at you Java) have failed to make composition as convenient as inheritance.
So you have to use composition.
Re: 99 Bottles of OOP now available in Python
#44I’m gonna buy the book but I prefer composition over OOP. I prefer to have an init that takes some params where those params are fully baked clients of whatever services I need and then the class just uses them as needed. I don’t see a lot of value in having a Python class that might have a few or more classes that it extends where all the functions from all the classes crowd up the classes namespace. Class Foo.__ini…
Then you're going to be pleasantly surprised, because composition is actually a genuine OOP technique and Sandi Metz advocates for exactly this kind of sane OOP focused on encapsulation and objects making sense, instead of masturbating with class hierarchies.
Re: 99 Bottles of OOP now available in Python
#45I’m gonna buy the book but I prefer composition over OOP. I prefer to have an init that takes some params where those params are fully baked clients of whatever services I need and then the class just uses them as needed. I don’t see a lot of value in having a Python class that might have a few or more classes that it extends where all the functions from all the classes crowd up the classes namespace. Class Foo.__ini…
The GoF book (the design patterns book) says in a page right near the start, "Prefer composition over inheritance", in the middle of an otherwise blank page, presumably to emphasize the importance of that advice.
As others have replied, composition is one technique you can use in OOP, not something that is the opposite of OOP.
You can also use composition in non-OOP procedural languages like C, by having a struct within a struct.
https://www.google.com/search?q=can+you+have+nested+structs+...
Re: 99 Bottles of OOP now available in Python
#46OOP is an industry of its own which generates a ton of incidental complexity. See "Object-Oriented Programming is Bad" by Brian Wills ( https://www.youtube.com/watch?v=QM1iUe6IofM ) and most of Rich Hickey's excellent videos, especially his keynote at Rails Conf 2012 where he basically told the Ruby crowd they're doing it wrong ( https://www.youtube.com/watch?v=rI8tNMsozo0 ).
> OOP is an industry of its own which generates a ton of incidental complexity. I think you're confusing "OOP is used in projects and I've seen accidental complexity in projects" with "OOP generates accidental complexity". The truth of the matter is that developers create complexity. It just so happens that the vast majority use OOP. I challenge you to a) start by stating what you think OOP is, b) present any approac…
b) The best style is no style, or at least pick a more recently popular dogma like FP, at least it gets you easy/safe parallelism in exchange for throwing some of the tools out of your toolbox.
Re: 99 Bottles of OOP now available in Python
#47Earlier quoted context omitted.
Why on earth do you put composition and OOP as opposing techniques? Composition is just one more technique in the OOP toolbox and there is nothing in OOP that mandates an inheritance based architecture.
Mainstream OOP languages (looking at you Java) have failed to make composition as convenient as inheritance.
Re: 99 Bottles of OOP now available in Python
#48OOP is an industry of its own which generates a ton of incidental complexity. See "Object-Oriented Programming is Bad" by Brian Wills ( https://www.youtube.com/watch?v=QM1iUe6IofM ) and most of Rich Hickey's excellent videos, especially his keynote at Rails Conf 2012 where he basically told the Ruby crowd they're doing it wrong ( https://www.youtube.com/watch?v=rI8tNMsozo0 ).
> OOP is an industry of its own which generates a ton of incidental complexity. I think you're confusing "OOP is used in projects and I've seen accidental complexity in projects" with "OOP generates accidental complexity". The truth of the matter is that developers create complexity. It just so happens that the vast majority use OOP. I challenge you to a) start by stating what you think OOP is, b) present any approac…
Meanwhile its creators can not hold the whole complexity in mind (often barely in spec) and still can produce a artifact that produces correct results.
Re: 99 Bottles of OOP now available in Python
#49Re: 99 Bottles of OOP now available in Python
#50Previous Discussion Bottles of OOP - https://news.ycombinator.com/item?id=12129821 - July 2016 (71 comments)
that was not for the Python version