OOP is garbage. It's one of those things that intuitively makes sense at first glance but turns out it's actually a terrible fucking idea. This video is pretty good IMO, if a bit too edgy at times: https://www.youtube.com/watch?v=QM1iUe6IofM
Basically what it boils down to me is when you're programming you're not working with real world objects, you're working with representations of real world objects in a computer where you need to do computer things, not real world object things.
For example duck.quack() makes intuitive sense at first but in reality what you're gonna be initializing an audio interface and sending a quack.waw sound to the sound card so that it plays. If you want to fit this in an OOP paradigm and not have your code be unmaintainable garbage from the get go you're gonna have to do some dumb mental gymnastics with the various "OOP patterns" where you'll have SoundInterfaceFactories and implement IPlayable for your Duck object or have a SoundPlayerVisitor for your various objects that you want to play a sound with etc. At that point the OOP paradigm is more trouble than it's worth really and you've already thrown the original promise of OOP out the window, which is programming intuitively with representations of real world objects.
Also most "OOP patterns" are basically emulating basic features of a lot of functional languages.
Basically OOP is capitalism and functional programming is communism.
I generally agree that the industry focus on OOP isn't great, there are a lot of problem spaces where OOP is just not a great fit compared to even just simple procedural approaches and many spaces where OOP can do a good job, functional languages can do better with less apparent complexity. the focus on OOP being "the best" has lead to a lot of bad design decisions and unnessacery complexity.
I also generally agree that Javascript isn't a great language because of some specific design decisions.
That said. Typescript is not Javascript, nearly all of the issues Javascript has are solved in Typescript. Also, Javascript is not the kind of OOP most people would think of seeing as it's prototype-based, it's much closer to functional languages in some respects because of that.
Typescript is great for what it is but it's still tacked onto a bad language and ecosystem IMO.
Personally I'd start new projects in .NET Core in either C# or F#.
.NET ecosystem is solid as fuck and C# isn't bad for an OOP language. I wish F# was more supported though, it's a great language but the tooling and ecosystem is a bit lacking, although you can just use any .NET library but you're gonna be writing a lot of glue code.
I agree that C# is a great language, but I actively work to avoid the .NET runtime for reasons that may at this point be largely historical; first impressions and all.
I'd have loved to keep the project in Rust if the tools had been up to snuff, or we'd been able to get compile times down, but that wasn't in the cards. I'd also have loved to use Go (another great language without OOP). But, in the end we decided that it was much more important to choose a language where we had the best chance of getting more devs. and the tools were. mature enough that we could make smart decisions
This is completely getting. any language where {} / [] === NaN ->true is... a trash heap. why couldn't the web run of lua? that at least would have been the same style of Lang without as many problems.
oop doesn’t encapsulate real world objects, it encapsulates data and implementation that concerns that data. it allows programs to be built up of messages passed between these structures, which can be coordinated flexibly with late binding.
This is not how OOP generally gets taught, also this encapsulation tends to become more trouble than it's worth in the long run.
but, in general, fairly dogmatic FP is entirely unsuitable for most software development today.
I agree, and I think Rust struck a good balance there. I just wish the ecosystem was better, also perhaps an opt-in GC for Rust for when you don't really care about performance that much.
I dunno I think strictly tying data to particular code is in general not good.
In my experience it doesn't facilitate good code at all, in fact it often does the exact opposite when an inexperienced dev discovers inheritance. I've seen in production code really ridiculous stuff like 2DChart inheriting 2DPoint and weird shit like that or you have some monster IGodInterface with a bunch of methods having blank implementations for most concrete implementations.
Personally I've found once you get the hang of it a functional-first approach makes it way easier to do with the data what you want done without contorting your brain to fit an OOP model. You just do the stuff you want with the data, you don't have to think too hard where you'll put the data and where you'll put the code that churns the data.
Functional programming has spoiled C# for me. These days, I just use pattern matching on base classes and pretend it's an algebraic data type. To much jumping around in code for visitor patterns.
Basically OOP is capitalism and functional programming is communism.
deleted by creator
OOP is garbage. It's one of those things that intuitively makes sense at first glance but turns out it's actually a terrible fucking idea. This video is pretty good IMO, if a bit too edgy at times: https://www.youtube.com/watch?v=QM1iUe6IofM
Basically what it boils down to me is when you're programming you're not working with real world objects, you're working with representations of real world objects in a computer where you need to do computer things, not real world object things.
For example duck.quack() makes intuitive sense at first but in reality what you're gonna be initializing an audio interface and sending a quack.waw sound to the sound card so that it plays. If you want to fit this in an OOP paradigm and not have your code be unmaintainable garbage from the get go you're gonna have to do some dumb mental gymnastics with the various "OOP patterns" where you'll have SoundInterfaceFactories and implement IPlayable for your Duck object or have a SoundPlayerVisitor for your various objects that you want to play a sound with etc. At that point the OOP paradigm is more trouble than it's worth really and you've already thrown the original promise of OOP out the window, which is programming intuitively with representations of real world objects.
Also most "OOP patterns" are basically emulating basic features of a lot of functional languages.
Basically OOP is capitalism and functional programming is communism.
I generally agree that the industry focus on OOP isn't great, there are a lot of problem spaces where OOP is just not a great fit compared to even just simple procedural approaches and many spaces where OOP can do a good job, functional languages can do better with less apparent complexity. the focus on OOP being "the best" has lead to a lot of bad design decisions and unnessacery complexity.
I also generally agree that Javascript isn't a great language because of some specific design decisions.
That said. Typescript is not Javascript, nearly all of the issues Javascript has are solved in Typescript. Also, Javascript is not the kind of OOP most people would think of seeing as it's prototype-based, it's much closer to functional languages in some respects because of that.
Typescript is great for what it is but it's still tacked onto a bad language and ecosystem IMO.
Personally I'd start new projects in .NET Core in either C# or F#.
.NET ecosystem is solid as fuck and C# isn't bad for an OOP language. I wish F# was more supported though, it's a great language but the tooling and ecosystem is a bit lacking, although you can just use any .NET library but you're gonna be writing a lot of glue code.
I agree that C# is a great language, but I actively work to avoid the .NET runtime for reasons that may at this point be largely historical; first impressions and all. I'd have loved to keep the project in Rust if the tools had been up to snuff, or we'd been able to get compile times down, but that wasn't in the cards. I'd also have loved to use Go (another great language without OOP). But, in the end we decided that it was much more important to choose a language where we had the best chance of getting more devs. and the tools were. mature enough that we could make smart decisions
Yeah I get it, I'm not saying it's a bad choice, developer availability is a pretty big factor, I'm just salty as fuck that Javascript got so popular.
This is completely getting. any language where
{} / [] === NaN -> true
is... a trash heap. why couldn't the web run of lua? that at least would have been the same style of Lang without as many problems.Yeah apparently the creator of Javascript took a whole 10 days to design the thing and here we are.
deleted by creator
This is not how OOP generally gets taught, also this encapsulation tends to become more trouble than it's worth in the long run.
I agree, and I think Rust struck a good balance there. I just wish the ecosystem was better, also perhaps an opt-in GC for Rust for when you don't really care about performance that much.
deleted by creator
I dunno I think strictly tying data to particular code is in general not good.
In my experience it doesn't facilitate good code at all, in fact it often does the exact opposite when an inexperienced dev discovers inheritance. I've seen in production code really ridiculous stuff like 2DChart inheriting 2DPoint and weird shit like that or you have some monster IGodInterface with a bunch of methods having blank implementations for most concrete implementations.
Personally I've found once you get the hang of it a functional-first approach makes it way easier to do with the data what you want done without contorting your brain to fit an OOP model. You just do the stuff you want with the data, you don't have to think too hard where you'll put the data and where you'll put the code that churns the data.
Functional programming has spoiled C# for me. These days, I just use pattern matching on base classes and pretend it's an algebraic data type. To much jumping around in code for visitor patterns.
What would logic programming be?
Uuuuh Plato's ideal state ruled by a philosopher king.
No I will not explain.
".....the problem is really not classes...."
To the camps!