Recent

Author Topic: declaration public - private  (Read 1482 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8260
  • Debugger - SynEdit - and more
    • wiki
Re: declaration public - private
« Reply #15 on: July 27, 2022, 01:01:49 am »
Classes have a bad rep at the moment, because it's easy to break things if you change a base class to do what you want, without taking all the ones into account that inherit from it. And it's even more frustrating if you cannot explain to the programmer who did it why that was very wrong.

Class hierarchies can be very big and complex. That's what they were designed to cope with. If you only look at a small piece and ignore the rest, you will break it. That's why things like anonymous functions are so popular: KISS and easy to understand. Because the scope is small and there are no dependencies.

Oh the same old FUD.

Non-OO code just hides the dependencies somewhere else. Local variables that gets passed from one function to the next function, and again to the next function, very many functions deep.... And if one of them changes.... The exact same issue.
Of course you can "flatten" your calling structure (Though sometimes depth may be the better solution / "no one shoe fits all"). But you can also create smaller, less dependent class hierarchies.
- They are a tool, like any other tool. You are responsible how you use them.
- 3rd party code may not be as you like it. But that issues exists with non-OO 3rd party code too.
« Last Edit: July 27, 2022, 01:03:40 am by Martin_fr »

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1086
Re: declaration public - private
« Reply #16 on: July 27, 2022, 11:01:00 am »
Oh the same old FUD.

Yes, I agree. Those small and simple apps tend to grow into big and complex ones over time, and without OO you have less tools to deal with it.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8260
  • Debugger - SynEdit - and more
    • wiki
Re: declaration public - private
« Reply #17 on: July 27, 2022, 05:15:21 pm »
Oh the same old FUD.

Yes, I agree. Those small and simple apps tend to grow into big and complex ones over time, and without OO you have less tools to deal with it.

Not what I said. I did not place one over the other. In neither direction.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1086
Re: declaration public - private
« Reply #18 on: August 01, 2022, 02:00:41 pm »
Oh the same old FUD.

Yes, I agree. Those small and simple apps tend to grow into big and complex ones over time, and without OO you have less tools to deal with it.

Not what I said. I did not place one over the other. In neither direction.

Fair enough. To make it more general:
- You need a way to compartment a project into understandable pieces
- You want as little globals as possible
- You need interfaces that describe how (the individual) parts communicate with one another
- If you have shared data, you need an interface for that as well
- Make it as readable as possible and try to use the same strategy for all the different parts

Like that?

 

TinyPortal © 2005-2018