Click here to Skip to main content
15,891,943 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: OO is not all that and a bag of chips Pin
Martin ISDN28-Mar-20 20:50
Martin ISDN28-Mar-20 20:50 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 1:36
mvahoney the codewitch29-Mar-20 1:36 
GeneralRe: OO is not all that and a bag of chips Pin
Greg Utas29-Mar-20 2:05
professionalGreg Utas29-Mar-20 2:05 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 2:21
mvahoney the codewitch29-Mar-20 2:21 
GeneralRe: OO is not all that and a bag of chips Pin
Mark_Wallace28-Mar-20 21:07
Mark_Wallace28-Mar-20 21:07 
JokeRe: OO is not all that and a bag of chips Pin
Sander Rossel29-Mar-20 1:22
professionalSander Rossel29-Mar-20 1:22 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 1:31
mvahoney the codewitch29-Mar-20 1:31 
GeneralRe: OO is not all that and a bag of chips Pin
Sander Rossel29-Mar-20 2:22
professionalSander Rossel29-Mar-20 2:22 
That code is uber 1337! Big Grin | :-D
But usually...

TL;DR: I agree with your post.

The long version:
I tend to write a bunch of interfaces (as necessary) that explain the function of the code.
Take, for example, an IUserRepository.
When I see a (ASP.NET Core) Controller being injected with an IUserRepository I know this Controller does something with users.
I don't know (or care) where the users come from, but I know I need them.
If you look at the specific code that uses the IUserRepository you'll find stuff like userRepository.GetUser(id), which is way more descriptive than some code that accesses a database.
So in that sense, I often use classes and methods to describe what my code is doing.
That, for me, and to lesser extent re-use of code, are the biggest pros of OOP.

I'm not a big fan of re-use anymore.
Back in the day I re-used all the things, but just because two pieces of code incidentally need the same results doesn't mean they do the same thing.
I now make a clear split of functional re-use and technical re-use.
Functional re-use is rare, because that would mean a user has two ways to do the exact same thing.
It happens, but not all that often.

I think I write my code less "OOP" than seven or even five years ago.
The OOP I still write is more architectural in nature (like I now make heavy use of DI and interfaces, but not so much of base classes and such).

I've written some simple programs in Haskell, a purely functional language, but I think that doesn't work all that well.
It comes natural to think in objects and to have side effects at some point.
Nevertheless I started to write more functional in my OOP code, mostly no side effects.
I'm pretty sure my bug-to-code ratio went down since I've employed the no side effects approach.
A function just does its thing and produces a result, but it won't affect the overall flow or state of the program.
All the results come together in the calling function, mostly a controller, and then I do all the side effects in one spot.
Makes the code a lot easier to read and you have a lot less to think about.
It's still OOP, so it doesn't always work like that, but I try when I can.
Another change in my code is the use of delegates instead of one-function interfaces.
Makes for less abstraction and classes and it's still easy to read.

The biggest game changer for me, and this saved me a lot of bugs, was when I started to use curly braces for one line if and loop statements though Big Grin | :-D

GeneralRe: OO is not all that and a bag of chips Pin
Member 1477477029-Mar-20 4:17
Member 1477477029-Mar-20 4:17 
GeneralRe: OO is not all that and a bag of chips Pin
Nelek29-Mar-20 4:33
protectorNelek29-Mar-20 4:33 
GeneralRe: OO is not all that and a bag of chips Pin
Rick York29-Mar-20 11:15
mveRick York29-Mar-20 11:15 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 5:58
mvahoney the codewitch29-Mar-20 5:58 
GeneralRe: OO is not all that and a bag of chips Pin
W Balboos, GHB29-Mar-20 11:18
W Balboos, GHB29-Mar-20 11:18 
GeneralRe: OO is not all that and a bag of chips Pin
Martin ISDN29-Mar-20 13:27
Martin ISDN29-Mar-20 13:27 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini29-Mar-20 20:57
mveCPallini29-Mar-20 20:57 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 21:34
mvahoney the codewitch29-Mar-20 21:34 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini29-Mar-20 21:37
mveCPallini29-Mar-20 21:37 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch29-Mar-20 21:40
mvahoney the codewitch29-Mar-20 21:40 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini29-Mar-20 21:59
mveCPallini29-Mar-20 21:59 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch30-Mar-20 4:26
mvahoney the codewitch30-Mar-20 4:26 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini30-Mar-20 4:38
mveCPallini30-Mar-20 4:38 
GeneralRe: OO is not all that and a bag of chips Pin
honey the codewitch30-Mar-20 4:48
mvahoney the codewitch30-Mar-20 4:48 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini30-Mar-20 5:02
mveCPallini30-Mar-20 5:02 
GeneralRe: OO is not all that and a bag of chips Pin
kalberts29-Mar-20 21:54
kalberts29-Mar-20 21:54 
GeneralRe: OO is not all that and a bag of chips Pin
CPallini29-Mar-20 22:00
mveCPallini29-Mar-20 22:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.